linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND PATCH] ARM: pxa: stargate2: use device properties for at24 eeprom
@ 2018-04-04 11:47 Bartosz Golaszewski
  2018-04-04 12:08 ` Jonathan Cameron
  2018-04-04 19:44 ` Robert Jarzmik
  0 siblings, 2 replies; 5+ messages in thread
From: Bartosz Golaszewski @ 2018-04-04 11:47 UTC (permalink / raw)
  To: Jonathan Cameron, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
	Russell King
  Cc: linux-arm-kernel, linux-kernel, Bartosz Golaszewski

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 <brgl@bgdev.pl>
---
NOTE: resending with correct e-mail address for Jonathan Cameron.

 arch/arm/mach-pxa/stargate2.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-pxa/stargate2.c b/arch/arm/mach-pxa/stargate2.c
index df62bb23dbee..bbea5fa9a140 100644
--- a/arch/arm/mach-pxa/stargate2.c
+++ b/arch/arm/mach-pxa/stargate2.c
@@ -27,11 +27,11 @@
 
 #include <linux/platform_data/i2c-pxa.h>
 #include <linux/platform_data/pcf857x.h>
-#include <linux/platform_data/at24.h>
 #include <linux/smc91x.h>
 #include <linux/gpio/machine.h>
 #include <linux/gpio.h>
 #include <linux/leds.h>
+#include <linux/property.h>
 
 #include <asm/types.h>
 #include <asm/setup.h>
@@ -795,9 +795,9 @@ static struct pcf857x_platform_data platform_data_pcf857x = {
 	.context = NULL,
 };
 
-static struct at24_platform_data pca9500_eeprom_pdata = {
-	.byte_len = 256,
-	.page_size = 4,
+static const struct property_entry pca9500_eeprom_properties[] = {
+	PROPERTY_ENTRY_U32("pagesize", 4),
+	{ }
 };
 
 /**
@@ -935,7 +935,7 @@ static struct i2c_board_info __initdata stargate2_i2c_board_info[] = {
 	}, {
 		.type = "24c02",
 		.addr = 0x57,
-		.platform_data = &pca9500_eeprom_pdata,
+		.properties = pca9500_eeprom_properties,
 	}, {
 		.type = "max1238",
 		.addr = 0x35,
-- 
2.16.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [RESEND PATCH] ARM: pxa: stargate2: use device properties for at24 eeprom
  2018-04-04 11:47 [RESEND PATCH] ARM: pxa: stargate2: use device properties for at24 eeprom Bartosz Golaszewski
@ 2018-04-04 12:08 ` Jonathan Cameron
  2018-04-04 19:44 ` Robert Jarzmik
  1 sibling, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2018-04-04 12:08 UTC (permalink / raw)
  To: Bartosz Golaszewski, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
	Russell King
  Cc: linux-arm-kernel, linux-kernel



On 4 April 2018 12:47:06 BST, Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>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 <brgl@bgdev.pl>
Looks sensible to me.

Acked-by: Jonathan Cameron <jonathan.cameron@huawei.com>

Will be a while before I can test but this looks safe enough..
>---
>NOTE: resending with correct e-mail address for Jonathan Cameron.
>
> arch/arm/mach-pxa/stargate2.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
>diff --git a/arch/arm/mach-pxa/stargate2.c
>b/arch/arm/mach-pxa/stargate2.c
>index df62bb23dbee..bbea5fa9a140 100644
>--- a/arch/arm/mach-pxa/stargate2.c
>+++ b/arch/arm/mach-pxa/stargate2.c
>@@ -27,11 +27,11 @@
> 
> #include <linux/platform_data/i2c-pxa.h>
> #include <linux/platform_data/pcf857x.h>
>-#include <linux/platform_data/at24.h>
> #include <linux/smc91x.h>
> #include <linux/gpio/machine.h>
> #include <linux/gpio.h>
> #include <linux/leds.h>
>+#include <linux/property.h>
> 
> #include <asm/types.h>
> #include <asm/setup.h>
>@@ -795,9 +795,9 @@ static struct pcf857x_platform_data
>platform_data_pcf857x = {
> 	.context = NULL,
> };
> 
>-static struct at24_platform_data pca9500_eeprom_pdata = {
>-	.byte_len = 256,
>-	.page_size = 4,
>+static const struct property_entry pca9500_eeprom_properties[] = {
>+	PROPERTY_ENTRY_U32("pagesize", 4),
>+	{ }
> };
> 
> /**
>@@ -935,7 +935,7 @@ static struct i2c_board_info __initdata
>stargate2_i2c_board_info[] = {
> 	}, {
> 		.type = "24c02",
> 		.addr = 0x57,
>-		.platform_data = &pca9500_eeprom_pdata,
>+		.properties = pca9500_eeprom_properties,
> 	}, {
> 		.type = "max1238",
> 		.addr = 0x35,

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RESEND PATCH] ARM: pxa: stargate2: use device properties for at24 eeprom
  2018-04-04 11:47 [RESEND PATCH] ARM: pxa: stargate2: use device properties for at24 eeprom Bartosz Golaszewski
  2018-04-04 12:08 ` Jonathan Cameron
@ 2018-04-04 19:44 ` Robert Jarzmik
  2018-04-05  8:32   ` Bartosz Golaszewski
  1 sibling, 1 reply; 5+ messages in thread
From: Robert Jarzmik @ 2018-04-04 19:44 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Jonathan Cameron, Daniel Mack, Haojian Zhuang, Russell King,
	linux-arm-kernel, linux-kernel

Bartosz Golaszewski <brgl@bgdev.pl> writes:

> 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.
Hi Bartosz,

I'd like a little explanation for the last sentence. Are you implying that
ac24.c is using the "type" field, and if so could you point me to the correct
line, because I was under the impression a property called "size" is used for
byte_len value ... ?

Cheers.

--
Robert

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RESEND PATCH] ARM: pxa: stargate2: use device properties for at24 eeprom
  2018-04-04 19:44 ` Robert Jarzmik
@ 2018-04-05  8:32   ` Bartosz Golaszewski
  2018-04-08  9:03     ` Robert Jarzmik
  0 siblings, 1 reply; 5+ messages in thread
From: Bartosz Golaszewski @ 2018-04-05  8:32 UTC (permalink / raw)
  To: Robert Jarzmik
  Cc: Jonathan Cameron, Daniel Mack, Haojian Zhuang, Russell King,
	Linux ARM, Linux Kernel Mailing List

2018-04-04 21:44 GMT+02:00 Robert Jarzmik <robert.jarzmik@free.fr>:
> Bartosz Golaszewski <brgl@bgdev.pl> writes:
>
>> 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.
> Hi Bartosz,
>
> I'd like a little explanation for the last sentence. Are you implying that
> ac24.c is using the "type" field, and if so could you point me to the correct
> line, because I was under the impression a property called "size" is used for
> byte_len value ... ?
>

Yes, it does use the type field from i2c_board_info implicitly over
i2c-core. The type field is copied over to client->name and then is
matched against the i2c ID table from which we get the associated chip
data (unless the type is "at24") containing the size and flags.

Hope that helps.

Bartosz

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RESEND PATCH] ARM: pxa: stargate2: use device properties for at24 eeprom
  2018-04-05  8:32   ` Bartosz Golaszewski
@ 2018-04-08  9:03     ` Robert Jarzmik
  0 siblings, 0 replies; 5+ messages in thread
From: Robert Jarzmik @ 2018-04-08  9:03 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Jonathan Cameron, Daniel Mack, Haojian Zhuang, Russell King,
	Linux ARM, Linux Kernel Mailing List

Bartosz Golaszewski <brgl@bgdev.pl> writes:

> 2018-04-04 21:44 GMT+02:00 Robert Jarzmik <robert.jarzmik@free.fr>:
>> Bartosz Golaszewski <brgl@bgdev.pl> writes:
> Yes, it does use the type field from i2c_board_info implicitly over
> i2c-core. The type field is copied over to client->name and then is
> matched against the i2c ID table from which we get the associated chip
> data (unless the type is "at24") containing the size and flags.

Ah yes, the "struct i2c_device_id at24_ids" part, I see.

Applied to pxa/for-next, thanks.

-- 
Robert

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-04-08  9:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-04 11:47 [RESEND PATCH] ARM: pxa: stargate2: use device properties for at24 eeprom Bartosz Golaszewski
2018-04-04 12:08 ` Jonathan Cameron
2018-04-04 19:44 ` Robert Jarzmik
2018-04-05  8:32   ` Bartosz Golaszewski
2018-04-08  9:03     ` Robert Jarzmik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).