Re: [PATCH v3 11/24] iio: accel: kxcjk-1013: Start using chip_info variables instead of enum

Jonathan Cameron
2024-10-26T11:26:48Z

On Thu, 24 Oct 2024 22:05:00 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> Instead of having a enum and keeping IDs as driver data pointers,
> just have a chip_info struct per supported device.
I'm not keen longer term on acpi_type, as the various bits dependent on that
should probably be done via optional callbacks in the kx_chipset_info
structure, but this is a sensible intermediate step.

I see the chipset one goes away later hence no comment on that.

I did a bit of white space massaging whilst applying this.
Hopefully that won't make me mess up applying the following patches.

> enum kxcjk1013_mode {
> @@ -425,27 +472,28 @@ static int kiox010a_dsm(struct device *dev, int fn_index)
> }
>
> static const struct acpi_device_id kx_acpi_match[] = {
> - {"KXCJ1013", KXCJK1013},
> - {"KXCJ1008", KXCJ91008},
> - {"KXCJ9000", KXCJ91008},
> - {"KIOX0008", KXCJ91008},
> - {"KIOX0009", KXTJ21009},
> - {"KIOX000A", KXCJ91008},
> - {"KIOX010A", KXCJ91008}, /* KXCJ91008 in the display of a yoga 2-in-1 */
> - {"KIOX020A", KXCJ91008}, /* KXCJ91008 in the base of a yoga 2-in-1 */
> - {"KXTJ1009", KXTJ21009},
> - {"KXJ2109", KXTJ21009},
> - {"SMO8500", KXCJ91008},
> + {"KIOX0008", (kernel_ulong_t)&kxcj91008_info },
> + {"KIOX0009", (kernel_ulong_t)&kxtj21009_info },
> + {"KIOX000A", (kernel_ulong_t)&kxcj91008_info },
> + /* KXCJ91008 in the display of a yoga 2-in-1 */
> + {"KIOX010A", (kernel_ulong_t)&kxcj91008_kiox010a_info },
> + /* KXCJ91008 in the base of a yoga 2-in-1 */
> + {"KIOX020A", (kernel_ulong_t)&kxcj91008_kiox020a_info },
> + {"KXCJ1008", (kernel_ulong_t)&kxcj91008_info },
> + {"KXCJ1013", (kernel_ulong_t)&kxcjk1013_info },
> + {"KXCJ9000", (kernel_ulong_t)&kxcj91008_info },
> + {"KXJ2109", (kernel_ulong_t)&kxtj21009_info },
> + {"KXTJ1009", (kernel_ulong_t)&kxtj21009_info },
> + {"SMO8500", (kernel_ulong_t)&kxcj91008_smo8500_info },
I'll tweak the spacing on this as well whilst here.
You did one end effectively, might as well do the other.

> { }
> };
> MODULE_DEVICE_TABLE(acpi, kx_acpi_match);

> @@ -1711,22 +1739,21 @@ static const struct dev_pm_ops kxcjk1013_pm_ops = {
> };
>
> static const struct i2c_device_id kxcjk1013_id[] = {
> - {"kxcjk1013", KXCJK1013},
> - {"kxcj91008", KXCJ91008},
> - {"kxtj21009", KXTJ21009},
> - {"kxtf9", KXTF9},
> - {"kx023-1025", KX0231025},
> + {"kxcjk1013", (kernel_ulong_t)&kxcjk1013_info },
> + {"kxcj91008", (kernel_ulong_t)&kxcj91008_info },
> + {"kxtj21009", (kernel_ulong_t)&kxtj21009_info },
> + {"kxtf9", (kernel_ulong_t)&kxtf9_info },
> + {"kx023-1025", (kernel_ulong_t)&kx0231025_info },
> {}
I'm going to tweak the spacing of that whilst we are touching it.