Re: [PATCH v5 7/9] iio: adc: ad7173: refactor device info structs

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

 



On 6/3/24 11:23 AM, Dumitru Ceclan via B4 Relay wrote:
> From: Dumitru Ceclan <dumitru.ceclan@xxxxxxxxxx>
> 
> Drop array of device info structs and use individual structs for all;
> drop models enum as no longer needed. This improves readability as the
> structs are pointed directly.
> 
> Signed-off-by: Dumitru Ceclan <dumitru.ceclan@xxxxxxxxxx>
> ---

...

>  static const char *const ad7173_ref_sel_str[] = {
> @@ -1191,32 +1185,25 @@ static int ad7173_probe(struct spi_device *spi)
>  }
>  
>  static const struct of_device_id ad7173_of_match[] = {
> -	{ .compatible = "adi,ad7172-2",
> -	  .data = &ad7173_device_info[ID_AD7172_2]},
> -	{ .compatible = "adi,ad7172-4",
> -	  .data = &ad7173_device_info[ID_AD7172_4]},
> -	{ .compatible = "adi,ad7173-8",
> -	  .data = &ad7173_device_info[ID_AD7173_8]},
> -	{ .compatible = "adi,ad7175-2",
> -	  .data = &ad7173_device_info[ID_AD7175_2]},
> -	{ .compatible = "adi,ad7175-8",
> -	  .data = &ad7173_device_info[ID_AD7175_8]},
> -	{ .compatible = "adi,ad7176-2",
> -	  .data = &ad7173_device_info[ID_AD7176_2]},
> -	{ .compatible = "adi,ad7177-2",
> -	  .data = &ad7173_device_info[ID_AD7177_2]},
> +	{ .compatible = "adi,ad7172-2", .data = &ad7172_2_device_info},
> +	{ .compatible = "adi,ad7172-4", .data = &ad7172_4_device_info},
> +	{ .compatible = "adi,ad7173-8", .data = &ad7173_8_device_info},
> +	{ .compatible = "adi,ad7175-2", .data = &ad7175_2_device_info},
> +	{ .compatible = "adi,ad7175-8", .data = &ad7175_8_device_info},
> +	{ .compatible = "adi,ad7176-2", .data = &ad7176_2_device_info},
> +	{ .compatible = "adi,ad7177-2", .data = &ad7177_2_device_info},
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(of, ad7173_of_match);
>  
>  static const struct spi_device_id ad7173_id_table[] = {
> -	{ "ad7172-2", (kernel_ulong_t)&ad7173_device_info[ID_AD7172_2]},
> -	{ "ad7172-4", (kernel_ulong_t)&ad7173_device_info[ID_AD7172_4]},
> -	{ "ad7173-8", (kernel_ulong_t)&ad7173_device_info[ID_AD7173_8]},
> -	{ "ad7175-2", (kernel_ulong_t)&ad7173_device_info[ID_AD7175_2]},
> -	{ "ad7175-8", (kernel_ulong_t)&ad7173_device_info[ID_AD7175_8]},
> -	{ "ad7176-2", (kernel_ulong_t)&ad7173_device_info[ID_AD7176_2]},
> -	{ "ad7177-2", (kernel_ulong_t)&ad7173_device_info[ID_AD7177_2]},
> +	{ "ad7172-2", (kernel_ulong_t)&ad7172_2_device_info},
> +	{ "ad7172-4", (kernel_ulong_t)&ad7172_4_device_info},
> +	{ "ad7173-8", (kernel_ulong_t)&ad7173_8_device_info},
> +	{ "ad7175-2", (kernel_ulong_t)&ad7175_2_device_info},
> +	{ "ad7175-8", (kernel_ulong_t)&ad7175_8_device_info},
> +	{ "ad7176-2", (kernel_ulong_t)&ad7176_2_device_info},
> +	{ "ad7177-2", (kernel_ulong_t)&ad7177_2_device_info},

nit: I would leave a space before the trailing } to match the space
after the leading { here and in the _of_ table.

>  	{ }
>  };
>  MODULE_DEVICE_TABLE(spi, ad7173_id_table);
> 





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux