Re: [PATCH] iio: magnetometer: ak8975: Convert enum->pointer for data in the match tables

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

 



On Wed, Aug 16, 2023 at 07:40:15PM +0100, Biju Das wrote:
> Convert enum->pointer for data in the match tables to simplify the probe()
> by replacing device_get_match_data() and i2c_client_get_device_id by
> i2c_get_match_data() as we have similar I2C, ACPI and DT matching table.

...

>  static const struct acpi_device_id ak_acpi_match[] = {
> +	{"AK8975", (kernel_ulong_t)&ak_def_array[AK8975] },
> +	{"AK8963", (kernel_ulong_t)&ak_def_array[AK8963] },
> +	{"INVN6500", (kernel_ulong_t)&ak_def_array[AK8963] },
> +	{"AK009911", (kernel_ulong_t)&ak_def_array[AK09911] },
> +	{"AK09911", (kernel_ulong_t)&ak_def_array[AK09911] },
> +	{"AKM9911", (kernel_ulong_t)&ak_def_array[AK09911] },
> +	{"AK09912", (kernel_ulong_t)&ak_def_array[AK09912] },

Please, sort them by HID. ACPI has no issues (as I learnt about OF) with
the ordering of IDs.

>  	{ }
>  };

...

> -	{"AK8963", AK8963},

> +	{"AK8963", (kernel_ulong_t)&ak_def_array[AK8963] },

Seems the wrong ID to begin with.

I would suggest to drop it in a separate patch.

...

>  static const struct of_device_id ak8975_of_match[] = {
> +	{ .compatible = "asahi-kasei,ak8975", .data = &ak_def_array[AK8975] },
> +	{ .compatible = "ak8975", .data = &ak_def_array[AK8975] },
> +	{ .compatible = "asahi-kasei,ak8963", .data = &ak_def_array[AK8963] },
> +	{ .compatible = "ak8963", .data = &ak_def_array[AK8963] },
> +	{ .compatible = "asahi-kasei,ak09911", .data = &ak_def_array[AK09911] },
> +	{ .compatible = "ak09911", .data = &ak_def_array[AK09911] },
> +	{ .compatible = "asahi-kasei,ak09912", .data = &ak_def_array[AK09912] },
> +	{ .compatible = "ak09912", .data = &ak_def_array[AK09912] },
> +	{ .compatible = "asahi-kasei,ak09916", .data = &ak_def_array[AK09916] },
> +	{ .compatible = "ak09916", .data = &ak_def_array[AK09916] },

Maybe the asashi being grouped it won't regress...

	{ .compatible = "asahi-kasei,ak8975", .data = &ak_def_array[AK8975] },
	{ .compatible = "asahi-kasei,ak8963", .data = &ak_def_array[AK8963] },
	{ .compatible = "asahi-kasei,ak09911", .data = &ak_def_array[AK09911] },
	{ .compatible = "asahi-kasei,ak09912", .data = &ak_def_array[AK09912] },
	{ .compatible = "asahi-kasei,ak09916", .data = &ak_def_array[AK09916] },
	{ .compatible = "ak8975", .data = &ak_def_array[AK8975] },
	{ .compatible = "ak8963", .data = &ak_def_array[AK8963] },
	{ .compatible = "ak09911", .data = &ak_def_array[AK09911] },
	{ .compatible = "ak09912", .data = &ak_def_array[AK09912] },
	{ .compatible = "ak09916", .data = &ak_def_array[AK09916] },

>  	{}
>  };

-- 
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