diff mbox series

[24/28] ARM: davinci: sffsdr: use device properties for at24 eeprom

Message ID 20180808153150.23444-25-brgl@bgdev.pl (mailing list archive)
State New, archived
Headers show
Series at24: remove at24_platform_data | expand

Commit Message

Bartosz Golaszewski Aug. 8, 2018, 3:31 p.m. UTC
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

We want to work towards phasing out the at24_platform_data structure.
There are few users and its contents can be represented using generic
device properties. Using device properties only will allow us to
significantly simplify the at24 configuration code.

Remove the at24_platform_data structure and replace it with an array
of property entries. Drop the byte_len/size property, as the model name
already implies the EEPROM's size.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 arch/arm/mach-davinci/board-sffsdr.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Comments

Andy Shevchenko Aug. 8, 2018, 5:57 p.m. UTC | #1
On Wed, Aug 8, 2018 at 6:31 PM, Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>
> We want to work towards phasing out the at24_platform_data structure.
> There are few users and its contents can be represented using generic
> device properties. Using device properties only will allow us to
> significantly simplify the at24 configuration code.
>
> Remove the at24_platform_data structure and replace it with an array
> of property entries. Drop the byte_len/size property, as the model name
> already implies the EEPROM's size.
>

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---
>  arch/arm/mach-davinci/board-sffsdr.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/arch/arm/mach-davinci/board-sffsdr.c b/arch/arm/mach-davinci/board-sffsdr.c
> index f6a4d094cbc3..680e5d7628a8 100644
> --- a/arch/arm/mach-davinci/board-sffsdr.c
> +++ b/arch/arm/mach-davinci/board-sffsdr.c
> @@ -26,7 +26,7 @@
>  #include <linux/init.h>
>  #include <linux/platform_device.h>
>  #include <linux/i2c.h>
> -#include <linux/platform_data/at24.h>
> +#include <linux/property.h>
>  #include <linux/mtd/mtd.h>
>  #include <linux/mtd/rawnand.h>
>  #include <linux/mtd/partitions.h>
> @@ -92,16 +92,15 @@ static struct platform_device davinci_sffsdr_nandflash_device = {
>         .resource       = davinci_sffsdr_nandflash_resource,
>  };
>
> -static struct at24_platform_data eeprom_info = {
> -       .byte_len       = (64*1024) / 8,
> -       .page_size      = 32,
> -       .flags          = AT24_FLAG_ADDR16,
> +static const struct property_entry eeprom_properties[] = {
> +       PROPERTY_ENTRY_U32("pagesize", 32),
> +       { },
>  };
>
>  static struct i2c_board_info __initdata i2c_info[] =  {
>         {
>                 I2C_BOARD_INFO("24c64", 0x50),
> -               .platform_data  = &eeprom_info,
> +               .properties = eeprom_properties,
>         },
>         /* Other I2C devices:
>          * MSP430,  addr 0x23 (not used)
> --
> 2.18.0
>
Andy Shevchenko Aug. 8, 2018, 6 p.m. UTC | #2
On Wed, Aug 8, 2018 at 8:57 PM, Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Wed, Aug 8, 2018 at 6:31 PM, Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>>
>> We want to work towards phasing out the at24_platform_data structure.
>> There are few users and its contents can be represented using generic
>> device properties. Using device properties only will allow us to
>> significantly simplify the at24 configuration code.
>>
>> Remove the at24_platform_data structure and replace it with an array
>> of property entries. Drop the byte_len/size property, as the model name
>> already implies the EEPROM's size.
>>
>
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
>
>> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>> ---
>>  arch/arm/mach-davinci/board-sffsdr.c | 11 +++++------
>>  1 file changed, 5 insertions(+), 6 deletions(-)
>>
>> diff --git a/arch/arm/mach-davinci/board-sffsdr.c b/arch/arm/mach-davinci/board-sffsdr.c
>> index f6a4d094cbc3..680e5d7628a8 100644
>> --- a/arch/arm/mach-davinci/board-sffsdr.c
>> +++ b/arch/arm/mach-davinci/board-sffsdr.c
>> @@ -26,7 +26,7 @@
>>  #include <linux/init.h>
>>  #include <linux/platform_device.h>
>>  #include <linux/i2c.h>
>> -#include <linux/platform_data/at24.h>
>> +#include <linux/property.h>
>>  #include <linux/mtd/mtd.h>
>>  #include <linux/mtd/rawnand.h>
>>  #include <linux/mtd/partitions.h>
>> @@ -92,16 +92,15 @@ static struct platform_device davinci_sffsdr_nandflash_device = {
>>         .resource       = davinci_sffsdr_nandflash_resource,
>>  };
>>
>> -static struct at24_platform_data eeprom_info = {
>> -       .byte_len       = (64*1024) / 8,
>> -       .page_size      = 32,
>> -       .flags          = AT24_FLAG_ADDR16,
>> +static const struct property_entry eeprom_properties[] = {
>> +       PROPERTY_ENTRY_U32("pagesize", 32),
>> +       { },

No comma needed

>>  };
>>
>>  static struct i2c_board_info __initdata i2c_info[] =  {
>>         {
>>                 I2C_BOARD_INFO("24c64", 0x50),
>> -               .platform_data  = &eeprom_info,
>> +               .properties = eeprom_properties,
>>         },
>>         /* Other I2C devices:
>>          * MSP430,  addr 0x23 (not used)
>> --
>> 2.18.0
>>
>
>
>
> --
> With Best Regards,
> Andy Shevchenko
diff mbox series

Patch

diff --git a/arch/arm/mach-davinci/board-sffsdr.c b/arch/arm/mach-davinci/board-sffsdr.c
index f6a4d094cbc3..680e5d7628a8 100644
--- a/arch/arm/mach-davinci/board-sffsdr.c
+++ b/arch/arm/mach-davinci/board-sffsdr.c
@@ -26,7 +26,7 @@ 
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/i2c.h>
-#include <linux/platform_data/at24.h>
+#include <linux/property.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/rawnand.h>
 #include <linux/mtd/partitions.h>
@@ -92,16 +92,15 @@  static struct platform_device davinci_sffsdr_nandflash_device = {
 	.resource	= davinci_sffsdr_nandflash_resource,
 };
 
-static struct at24_platform_data eeprom_info = {
-	.byte_len	= (64*1024) / 8,
-	.page_size	= 32,
-	.flags		= AT24_FLAG_ADDR16,
+static const struct property_entry eeprom_properties[] = {
+	PROPERTY_ENTRY_U32("pagesize", 32),
+	{ },
 };
 
 static struct i2c_board_info __initdata i2c_info[] =  {
 	{
 		I2C_BOARD_INFO("24c64", 0x50),
-		.platform_data	= &eeprom_info,
+		.properties = eeprom_properties,
 	},
 	/* Other I2C devices:
 	 * MSP430,  addr 0x23 (not used)