Re: [PATCH 4/4] iio: proximity: sx9500: Mark ACPI and OF related data as maybe unused

From: Jonathan Cameron
Date: Sat Mar 11 2023 - 07:28:41 EST


On Sat, 11 Mar 2023 12:14:57 +0100
Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx> wrote:

> The driver can be compile tested with !CONFIG_OF or !CONFIG_ACPI making
> certain data unused:
>
> drivers/iio/proximity/sx9500.c:1039:34: error: ‘sx9500_of_match’ defined but not used [-Werror=unused-const-variable=]
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>

Hi Krysztof

Thanks for looking at these warnings.

Drop the protection macros instead. The tables are trivial in size and
the of_match_ptr() breaks some ways this driver can be used.
ACPI_PTR() isn't as bad, but is pretty much pointless given this size of
the array.

Jonathan


> ---
> drivers/iio/proximity/sx9500.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/proximity/sx9500.c b/drivers/iio/proximity/sx9500.c
> index 8794e75e5bf9..840db1953998 100644
> --- a/drivers/iio/proximity/sx9500.c
> +++ b/drivers/iio/proximity/sx9500.c
> @@ -1036,13 +1036,13 @@ static const struct acpi_device_id sx9500_acpi_match[] = {
> };
> MODULE_DEVICE_TABLE(acpi, sx9500_acpi_match);
>
> -static const struct of_device_id sx9500_of_match[] = {
> +static const struct of_device_id sx9500_of_match[] __maybe_unused = {
> { .compatible = "semtech,sx9500", },
> { }
> };
> MODULE_DEVICE_TABLE(of, sx9500_of_match);
>
> -static const struct i2c_device_id sx9500_id[] = {
> +static const struct i2c_device_id sx9500_id[] __maybe_unused = {
> {"sx9500", 0},
> { },
> };