Re: [PATCH] iio: accel: adxl345: Convert enum->pointer for data in match data table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Aug 12, 2023 at 4:38 PM Biju Das <biju.das.jz@xxxxxxxxxxxxxx> wrote:
>
> Convert enum->pointer for data in match data table, so that
> device_get_match_data() can do match against OF/ACPI/I2C tables, once i2c
> bus type match support added to it.
>
> Add struct adxl3x5_chip_info and replace enum->adxl3x5_chip_info in the
> match table and simplify adxl345_probe().

...

> +       info = device_get_match_data(dev);
> +       if (info->type != ADXL345 && info->type != ADXL375)
>                 return -EINVAL;

I would rather use switch-case.
Anyway, same comments here as for the other patch: ENODEV and trailing commas.

...

> +static const struct adxl3x5_chip_info adxl345_i2c_info = {
> +       .name = "adxl345",
> +       .type = ADXL345
> +};
> +
> +static const struct adxl3x5_chip_info adxl375_i2c_info = {
> +       .name = "adxl375",
> +       .type = ADXL375
> +};

> +static const struct adxl3x5_chip_info adxl345_spi_info = {
> +       .name = "adxl345",
> +       .type = ADXL345
> +};
> +
> +static const struct adxl3x5_chip_info adxl375_spi_info = {
> +       .name = "adxl375",
> +       .type = ADXL375
> +};

Why dup?

-- 
With Best Regards,
Andy Shevchenko




[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux