Re: [PATCH] iio: accel: mma8452: Convert enum->pointer for data in the ID table

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

 



On Sat, Aug 12, 2023 at 03:31:00PM +0100, Biju Das wrote:
> Convert enum->pointer for data in the ID table, so that
> device_get_match_data() can do match against OF/ACPI/I2C tables, once i2c
> bus type match support added to it.
> 
> Replace enum->struct *mma_chip_info for data in the ID table and simplify
> mma8452_probe() by replacing device_get_match_data() with
> i2c_get_match_data().

...

>  static const struct i2c_device_id mma8452_id[] = {
> -	{ "mma8451", mma8451 },
> -	{ "mma8452", mma8452 },
> -	{ "mma8453", mma8453 },
> -	{ "mma8652", mma8652 },
> -	{ "mma8653", mma8653 },
> -	{ "fxls8471", fxls8471 },
> +	{ "mma8451", (kernel_ulong_t)&mma_chip_info_table[mma8451] },
> +	{ "mma8452", (kernel_ulong_t)&mma_chip_info_table[mma8452] },
> +	{ "mma8453", (kernel_ulong_t)&mma_chip_info_table[mma8453] },
> +	{ "mma8652", (kernel_ulong_t)&mma_chip_info_table[mma8652] },
> +	{ "mma8653", (kernel_ulong_t)&mma_chip_info_table[mma8653] },
> +	{ "fxls8471", (kernel_ulong_t)&mma_chip_info_table[fxls8471] },

You can also keep it sorted by name.

>  	{ }
>  };

-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux