* [PATCH] eeprom/at24: use device_property_*() functions instead of of_get_property()
@ 2017-02-08 19:53 Ben Gardner
2017-02-09 0:07 ` Andy Shevchenko
2017-02-09 15:33 ` [PATCH v2] " Ben Gardner
0 siblings, 2 replies; 18+ messages in thread
From: Ben Gardner @ 2017-02-08 19:53 UTC (permalink / raw)
To: Wolfram Sang; +Cc: linux-i2c, linux-kernel, Ben Gardner
Allow the at24 driver to get configuration information from both OF and
ACPI by using the more generic device_property functions.
This change was inspired by the at25.c driver.
I have a custom board with a ST M24C02 EEPROM attached to an I2C bus.
With the following ACPI construct, this patch instantiates a working
instance of the driver.
Device (EEP0) {
Name (_HID, "PRP0001")
Name (_DSD, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package () {"compatible", Package () {"st,24c02"}},
Package () {"size", 256},
Package () {"pagesize", 16},
},
})
Name (_CRS, ResourceTemplate () {
I2cSerialBus (
0x0057, ControllerInitiated, 400000,
AddressingMode7Bit, "\\_SB.PCI0.I2C3", 0x00,
ResourceConsumer,,)
})
}
Note: Matching the driver to the I2C device requires another patch.
http://www.spinics.net/lists/linux-acpi/msg71914.html
Signed-off-by: Ben Gardner <gardner.ben@gmail.com>
---
drivers/misc/eeprom/at24.c | 28 +++++++++-------------------
1 file changed, 9 insertions(+), 19 deletions(-)
diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index 051b147..9cb8904 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -19,7 +19,6 @@
#include <linux/log2.h>
#include <linux/bitops.h>
#include <linux/jiffies.h>
-#include <linux/of.h>
#include <linux/acpi.h>
#include <linux/i2c.h>
#include <linux/nvmem-provider.h>
@@ -562,26 +561,17 @@ static int at24_write(void *priv, unsigned int off, void *val, size_t count)
return 0;
}
-#ifdef CONFIG_OF
-static void at24_get_ofdata(struct i2c_client *client,
+static void at24_fw_to_chip(struct device *dev,
struct at24_platform_data *chip)
{
- const __be32 *val;
- struct device_node *node = client->dev.of_node;
-
- if (node) {
- if (of_get_property(node, "read-only", NULL))
- chip->flags |= AT24_FLAG_READONLY;
- val = of_get_property(node, "pagesize", NULL);
- if (val)
- chip->page_size = be32_to_cpup(val);
- }
+ u32 val;
+
+ if (device_property_present(dev, "read-only"))
+ chip->flags |= AT24_FLAG_READONLY;
+
+ if (device_property_read_u32(dev, "pagesize", &val) == 0)
+ chip->page_size = val;
}
-#else
-static void at24_get_ofdata(struct i2c_client *client,
- struct at24_platform_data *chip)
-{ }
-#endif /* CONFIG_OF */
static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
{
@@ -621,7 +611,7 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
chip.page_size = 1;
/* update chipdata if OF is present */
- at24_get_ofdata(client, &chip);
+ at24_fw_to_chip(&client->dev, &chip);
chip.setup = NULL;
chip.context = NULL;
--
2.7.4
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH] eeprom/at24: use device_property_*() functions instead of of_get_property()
2017-02-08 19:53 [PATCH] eeprom/at24: use device_property_*() functions instead of of_get_property() Ben Gardner
@ 2017-02-09 0:07 ` Andy Shevchenko
2017-02-09 15:27 ` Ben Gardner
2017-02-09 15:33 ` [PATCH v2] " Ben Gardner
1 sibling, 1 reply; 18+ messages in thread
From: Andy Shevchenko @ 2017-02-09 0:07 UTC (permalink / raw)
To: Ben Gardner; +Cc: Wolfram Sang, linux-i2c, linux-kernel
On Wed, Feb 8, 2017 at 9:53 PM, Ben Gardner <gardner.ben@gmail.com> wrote:
> Allow the at24 driver to get configuration information from both OF and
> ACPI by using the more generic device_property functions.
> This change was inspired by the at25.c driver.
>
> I have a custom board with a ST M24C02 EEPROM attached to an I2C bus.
> With the following ACPI construct, this patch instantiates a working
> instance of the driver.
>
> Device (EEP0) {
> Name (_HID, "PRP0001")
> Name (_DSD, Package () {
> ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
> Package () {
> Package () {"compatible", Package () {"st,24c02"}},
> Package () {"size", 256},
> Package () {"pagesize", 16},
> },
> })
> Name (_CRS, ResourceTemplate () {
> I2cSerialBus (
> 0x0057, ControllerInitiated, 400000,
> AddressingMode7Bit, "\\_SB.PCI0.I2C3", 0x00,
> ResourceConsumer,,)
> })
> }
>
> Note: Matching the driver to the I2C device requires another patch.
> http://www.spinics.net/lists/linux-acpi/msg71914.html
Nice!
Few comments, after addressing them
FWIW:
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
>
> Signed-off-by: Ben Gardner <gardner.ben@gmail.com>
> ---
> drivers/misc/eeprom/at24.c | 28 +++++++++-------------------
> 1 file changed, 9 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
> index 051b147..9cb8904 100644
> --- a/drivers/misc/eeprom/at24.c
> +++ b/drivers/misc/eeprom/at24.c
> @@ -19,7 +19,6 @@
> #include <linux/log2.h>
> #include <linux/bitops.h>
> #include <linux/jiffies.h>
> -#include <linux/of.h>
> #include <linux/acpi.h>
> #include <linux/i2c.h>
> #include <linux/nvmem-provider.h>
> @@ -562,26 +561,17 @@ static int at24_write(void *priv, unsigned int off, void *val, size_t count)
> return 0;
> }
>
> -#ifdef CONFIG_OF
> -static void at24_get_ofdata(struct i2c_client *client,
> +static void at24_fw_to_chip(struct device *dev,
> struct at24_platform_data *chip)
"fw" here is ambiguous a bit.
Would at24_get_pdata() work for you?
> {
> - const __be32 *val;
> - struct device_node *node = client->dev.of_node;
> -
> - if (node) {
> - if (of_get_property(node, "read-only", NULL))
> - chip->flags |= AT24_FLAG_READONLY;
> - val = of_get_property(node, "pagesize", NULL);
> - if (val)
> - chip->page_size = be32_to_cpup(val);
> - }
> + u32 val;
> +
> + if (device_property_present(dev, "read-only"))
> + chip->flags |= AT24_FLAG_READONLY;
> +
> + if (device_property_read_u32(dev, "pagesize", &val) == 0)
I would use default from probe here.
int ret;
...
ret = ..._u32(..., &val);
if (ret) {
/* ...long comment from ->probe()... */
chip->page_size = 1;
} else
chip->page_size = val;
> + chip->page_size = val;
> }
> -#else
> -static void at24_get_ofdata(struct i2c_client *client,
> - struct at24_platform_data *chip)
> -{ }
> -#endif /* CONFIG_OF */
>
> static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
> {
> @@ -621,7 +611,7 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
> chip.page_size = 1;
>
> /* update chipdata if OF is present */
This is now redundant.
> - at24_get_ofdata(client, &chip);
> + at24_fw_to_chip(&client->dev, &chip);
>
> chip.setup = NULL;
> chip.context = NULL;
> --
> 2.7.4
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH] eeprom/at24: use device_property_*() functions instead of of_get_property()
2017-02-09 0:07 ` Andy Shevchenko
@ 2017-02-09 15:27 ` Ben Gardner
0 siblings, 0 replies; 18+ messages in thread
From: Ben Gardner @ 2017-02-09 15:27 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: Wolfram Sang, Linux I2C, linux-kernel
Hi Andy,
Thanks for taking the time to look at this.
On Wed, Feb 8, 2017 at 6:07 PM, Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>
> On Wed, Feb 8, 2017 at 9:53 PM, Ben Gardner <gardner.ben@gmail.com> wrote:
> > Allow the at24 driver to get configuration information from both OF and
> > ACPI by using the more generic device_property functions.
> > This change was inspired by the at25.c driver.
> >
(snip)
> Few comments, after addressing them
>
> FWIW:
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
>
(snip)
> >
> > -#ifdef CONFIG_OF
> > -static void at24_get_ofdata(struct i2c_client *client,
> > +static void at24_fw_to_chip(struct device *dev,
> > struct at24_platform_data *chip)
>
> "fw" here is ambiguous a bit.
> Would at24_get_pdata() work for you?
That name also works for me.
> > {
> > - const __be32 *val;
> > - struct device_node *node = client->dev.of_node;
> > -
> > - if (node) {
> > - if (of_get_property(node, "read-only", NULL))
> > - chip->flags |= AT24_FLAG_READONLY;
> > - val = of_get_property(node, "pagesize", NULL);
> > - if (val)
> > - chip->page_size = be32_to_cpup(val);
> > - }
> > + u32 val;
> > +
> > + if (device_property_present(dev, "read-only"))
> > + chip->flags |= AT24_FLAG_READONLY;
> > +
>
> > + if (device_property_read_u32(dev, "pagesize", &val) == 0)
>
> I would use default from probe here.
>
> int ret;
>
> ...
>
> ret = ..._u32(..., &val);
> if (ret) {
> /* ...long comment from ->probe()... */
> chip->page_size = 1;
> } else
> chip->page_size = val;
That sounds reasonable.
> > + chip->page_size = val;
> > }
> > -#else
> > -static void at24_get_ofdata(struct i2c_client *client,
> > - struct at24_platform_data *chip)
> > -{ }
> > -#endif /* CONFIG_OF */
> >
> > static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
> > {
> > @@ -621,7 +611,7 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
> > chip.page_size = 1;
> >
>
> > /* update chipdata if OF is present */
>
> This is now redundant.
Yeah, that comment doesn't seem all that useful.
> > - at24_get_ofdata(client, &chip);
> > + at24_fw_to_chip(&client->dev, &chip);
> >
> > chip.setup = NULL;
> > chip.context = NULL;
> > --
> > 2.7.4
> >
>
>
>
> --
> With Best Regards,
> Andy Shevchenko
I'll send an update.
Thanks,
Ben
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v2] eeprom/at24: use device_property_*() functions instead of of_get_property()
2017-02-08 19:53 [PATCH] eeprom/at24: use device_property_*() functions instead of of_get_property() Ben Gardner
2017-02-09 0:07 ` Andy Shevchenko
@ 2017-02-09 15:33 ` Ben Gardner
2017-02-09 16:20 ` Andy Shevchenko
` (2 more replies)
1 sibling, 3 replies; 18+ messages in thread
From: Ben Gardner @ 2017-02-09 15:33 UTC (permalink / raw)
To: Wolfram Sang; +Cc: linux-i2c, linux-kernel, Andy Shevchenko, Ben Gardner
Allow the at24 driver to get configuration information from both OF and
ACPI by using the more generic device_property functions.
This change was inspired by the at25.c driver.
I have a custom board with a ST M24C02 EEPROM attached to an I2C bus.
With the following ACPI construct, this patch instantiates a working
instance of the driver.
Device (EEP0) {
Name (_HID, "PRP0001")
Name (_DSD, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package () {"compatible", Package () {"st,24c02"}},
Package () {"size", 256},
Package () {"pagesize", 16},
},
})
Name (_CRS, ResourceTemplate () {
I2cSerialBus (
0x0057, ControllerInitiated, 400000,
AddressingMode7Bit, "\\_SB.PCI0.I2C3", 0x00,
ResourceConsumer,,)
})
}
Note: Matching the driver to the I2C device requires another patch.
http://www.spinics.net/lists/linux-acpi/msg71914.html
Signed-off-by: Ben Gardner <gardner.ben@gmail.com>
---
drivers/misc/eeprom/at24.c | 43 +++++++++++++++++--------------------------
1 file changed, 17 insertions(+), 26 deletions(-)
diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index 051b147..81099f3 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -19,7 +19,6 @@
#include <linux/log2.h>
#include <linux/bitops.h>
#include <linux/jiffies.h>
-#include <linux/of.h>
#include <linux/acpi.h>
#include <linux/i2c.h>
#include <linux/nvmem-provider.h>
@@ -562,26 +561,25 @@ static int at24_write(void *priv, unsigned int off, void *val, size_t count)
return 0;
}
-#ifdef CONFIG_OF
-static void at24_get_ofdata(struct i2c_client *client,
- struct at24_platform_data *chip)
+static void at24_get_pdata(struct device *dev,
+ struct at24_platform_data *chip)
{
- const __be32 *val;
- struct device_node *node = client->dev.of_node;
-
- if (node) {
- if (of_get_property(node, "read-only", NULL))
- chip->flags |= AT24_FLAG_READONLY;
- val = of_get_property(node, "pagesize", NULL);
- if (val)
- chip->page_size = be32_to_cpup(val);
+ u32 val;
+
+ if (device_property_present(dev, "read-only"))
+ chip->flags |= AT24_FLAG_READONLY;
+
+ if (device_property_read_u32(dev, "pagesize", &val) == 0) {
+ chip->page_size = val;
+ } else {
+ /*
+ * This is slow, but we can't know all eeproms, so we better
+ * play safe. Specifying custom eeprom-types via platform_data
+ * is recommended anyhow.
+ */
+ chip.page_size = 1;
}
}
-#else
-static void at24_get_ofdata(struct i2c_client *client,
- struct at24_platform_data *chip)
-{ }
-#endif /* CONFIG_OF */
static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
{
@@ -613,15 +611,8 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
chip.byte_len = BIT(magic & AT24_BITMASK(AT24_SIZE_BYTELEN));
magic >>= AT24_SIZE_BYTELEN;
chip.flags = magic & AT24_BITMASK(AT24_SIZE_FLAGS);
- /*
- * This is slow, but we can't know all eeproms, so we better
- * play safe. Specifying custom eeprom-types via platform_data
- * is recommended anyhow.
- */
- chip.page_size = 1;
- /* update chipdata if OF is present */
- at24_get_ofdata(client, &chip);
+ at24_get_pdata(&client->dev, &chip);
chip.setup = NULL;
chip.context = NULL;
--
2.7.4
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH v2] eeprom/at24: use device_property_*() functions instead of of_get_property()
2017-02-09 15:33 ` [PATCH v2] " Ben Gardner
@ 2017-02-09 16:20 ` Andy Shevchenko
2017-02-09 17:03 ` Ben Gardner
2017-02-09 20:35 ` kbuild test robot
2017-02-09 23:52 ` kbuild test robot
2 siblings, 1 reply; 18+ messages in thread
From: Andy Shevchenko @ 2017-02-09 16:20 UTC (permalink / raw)
To: Ben Gardner; +Cc: Wolfram Sang, linux-i2c, linux-kernel
On Thu, Feb 9, 2017 at 5:33 PM, Ben Gardner <gardner.ben@gmail.com> wrote:
> Allow the at24 driver to get configuration information from both OF and
> ACPI by using the more generic device_property functions.
> This change was inspired by the at25.c driver.
>
> I have a custom board with a ST M24C02 EEPROM attached to an I2C bus.
> With the following ACPI construct, this patch instantiates a working
> instance of the driver.
>
> Device (EEP0) {
> Name (_HID, "PRP0001")
> Name (_DSD, Package () {
> ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
> Package () {
> Package () {"compatible", Package () {"st,24c02"}},
> Package () {"size", 256},
> Package () {"pagesize", 16},
> },
> })
> Name (_CRS, ResourceTemplate () {
> I2cSerialBus (
> 0x0057, ControllerInitiated, 400000,
> AddressingMode7Bit, "\\_SB.PCI0.I2C3", 0x00,
> ResourceConsumer,,)
> })
> }
>
> Note: Matching the driver to the I2C device requires another patch.
> http://www.spinics.net/lists/linux-acpi/msg71914.html
>
Still couple of comments.
> @@ -19,7 +19,6 @@
> #include <linux/log2.h>
> #include <linux/bitops.h>
> #include <linux/jiffies.h>
> -#include <linux/of.h>
I suppose
+ #include <linux/property.h>
?
> +static void at24_get_pdata(struct device *dev,
> + struct at24_platform_data *chip)
Now it fits one line.
> + u32 val;
> +
> + if (device_property_present(dev, "read-only"))
> + chip->flags |= AT24_FLAG_READONLY;
> +
> + if (device_property_read_u32(dev, "pagesize", &val) == 0) {
' == 0' looks awkward.
And I think
ret = x();
if (ret)
...
else
...
pattern would look slightly better.
> + chip->page_size = val;
> + } else {
> + /*
> + * This is slow, but we can't know all eeproms, so we better
> + * play safe. Specifying custom eeprom-types via platform_data
> + * is recommended anyhow.
> + */
> + chip.page_size = 1;
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v2] eeprom/at24: use device_property_*() functions instead of of_get_property()
2017-02-09 16:20 ` Andy Shevchenko
@ 2017-02-09 17:03 ` Ben Gardner
2017-02-09 17:09 ` [PATCH v3] " Ben Gardner
0 siblings, 1 reply; 18+ messages in thread
From: Ben Gardner @ 2017-02-09 17:03 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: Wolfram Sang, Linux I2C, linux-kernel
> Still couple of comments.
>
>> @@ -19,7 +19,6 @@
>> #include <linux/log2.h>
>> #include <linux/bitops.h>
>> #include <linux/jiffies.h>
>
>> -#include <linux/of.h>
>
> I suppose
> + #include <linux/property.h>
> ?
It looks like <linux/property.h> is included via <linux/acpi.h>
outside of any "#ifdef CONFIG_ACPI" check.
But Documentation/process/submit-checklist.rst indicates:
1) If you use a facility then #include the file that defines/declares
that facility. Don't depend on other header files pulling in ones
that you use.
So, I'll add it.
As an aside, a quick scan of the drivers/ folder shows that fewer than
half of the files that use functions from that header actually include
it.
>> +static void at24_get_pdata(struct device *dev,
>> + struct at24_platform_data *chip)
>
> Now it fits one line.
Sure does. Exactly 80 columns.
>> + u32 val;
>> +
>> + if (device_property_present(dev, "read-only"))
>> + chip->flags |= AT24_FLAG_READONLY;
>> +
>> + if (device_property_read_u32(dev, "pagesize", &val) == 0) {
>
> ' == 0' looks awkward.
>
> And I think
>
> ret = x();
> if (ret)
> ...
> else
> ...
>
> pattern would look slightly better.
There are 51 C files that use a temporary variable as you suggest with
"device_property_read" functions.
There are 7 C files that use the "if (!device_property_read" style.
It looks like at25.c was the only one that uses the '== 0' construct.
Guess I picked the wrong one to copy.
So, sure, I'll change that.
>> + chip->page_size = val;
>> + } else {
>> + /*
>> + * This is slow, but we can't know all eeproms, so we better
>> + * play safe. Specifying custom eeprom-types via platform_data
>> + * is recommended anyhow.
>> + */
>> + chip.page_size = 1;
>
> --
> With Best Regards,
> Andy Shevchenko
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v3] eeprom/at24: use device_property_*() functions instead of of_get_property()
2017-02-09 17:03 ` Ben Gardner
@ 2017-02-09 17:09 ` Ben Gardner
2017-02-09 17:18 ` Ben Gardner
0 siblings, 1 reply; 18+ messages in thread
From: Ben Gardner @ 2017-02-09 17:09 UTC (permalink / raw)
To: Wolfram Sang; +Cc: linux-i2c, linux-kernel, Andy Shevchenko, Ben Gardner
Allow the at24 driver to get configuration information from both OF and
ACPI by using the more generic device_property functions.
This change was inspired by the at25.c driver.
I have a custom board with a ST M24C02 EEPROM attached to an I2C bus.
With the following ACPI construct, this patch instantiates a working
instance of the driver.
Device (EEP0) {
Name (_HID, "PRP0001")
Name (_DSD, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package () {"compatible", Package () {"st,24c02"}},
Package () {"pagesize", 16},
},
})
Name (_CRS, ResourceTemplate () {
I2cSerialBus (
0x0057, ControllerInitiated, 400000,
AddressingMode7Bit, "\\_SB.PCI0.I2C3", 0x00,
ResourceConsumer,,)
})
}
Note: Matching the driver to the I2C device requires another patch.
http://www.spinics.net/lists/linux-acpi/msg71914.html
Signed-off-by: Ben Gardner <gardner.ben@gmail.com>
---
drivers/misc/eeprom/at24.c | 45 +++++++++++++++++++--------------------------
1 file changed, 19 insertions(+), 26 deletions(-)
diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index 051b147..c2d9969 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -19,7 +19,7 @@
#include <linux/log2.h>
#include <linux/bitops.h>
#include <linux/jiffies.h>
-#include <linux/of.h>
+#include <linux/property.h>
#include <linux/acpi.h>
#include <linux/i2c.h>
#include <linux/nvmem-provider.h>
@@ -562,26 +562,26 @@ static int at24_write(void *priv, unsigned int off, void *val, size_t count)
return 0;
}
-#ifdef CONFIG_OF
-static void at24_get_ofdata(struct i2c_client *client,
- struct at24_platform_data *chip)
+static void at24_get_pdata(struct device *dev, struct at24_platform_data *chip)
{
- const __be32 *val;
- struct device_node *node = client->dev.of_node;
-
- if (node) {
- if (of_get_property(node, "read-only", NULL))
- chip->flags |= AT24_FLAG_READONLY;
- val = of_get_property(node, "pagesize", NULL);
- if (val)
- chip->page_size = be32_to_cpup(val);
+ int err;
+ u32 val;
+
+ if (device_property_present(dev, "read-only"))
+ chip->flags |= AT24_FLAG_READONLY;
+
+ err = device_property_read_u32(dev, "pagesize", &val);
+ if (!err) {
+ chip->page_size = val;
+ } else {
+ /*
+ * This is slow, but we can't know all eeproms, so we better
+ * play safe. Specifying custom eeprom-types via platform_data
+ * is recommended anyhow.
+ */
+ chip.page_size = 1;
}
}
-#else
-static void at24_get_ofdata(struct i2c_client *client,
- struct at24_platform_data *chip)
-{ }
-#endif /* CONFIG_OF */
static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
{
@@ -613,15 +613,8 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
chip.byte_len = BIT(magic & AT24_BITMASK(AT24_SIZE_BYTELEN));
magic >>= AT24_SIZE_BYTELEN;
chip.flags = magic & AT24_BITMASK(AT24_SIZE_FLAGS);
- /*
- * This is slow, but we can't know all eeproms, so we better
- * play safe. Specifying custom eeprom-types via platform_data
- * is recommended anyhow.
- */
- chip.page_size = 1;
- /* update chipdata if OF is present */
- at24_get_ofdata(client, &chip);
+ at24_get_pdata(&client->dev, &chip);
chip.setup = NULL;
chip.context = NULL;
--
2.7.4
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH v3] eeprom/at24: use device_property_*() functions instead of of_get_property()
2017-02-09 17:09 ` [PATCH v3] " Ben Gardner
@ 2017-02-09 17:18 ` Ben Gardner
2017-02-09 17:36 ` [PATCH v4] " Ben Gardner
0 siblings, 1 reply; 18+ messages in thread
From: Ben Gardner @ 2017-02-09 17:18 UTC (permalink / raw)
To: Wolfram Sang; +Cc: Linux I2C, linux-kernel, Andy Shevchenko, Ben Gardner
Ignore this last patch. I should remember to test even the simplest of
cut-and-paste ops.
On Thu, Feb 9, 2017 at 11:09 AM, Ben Gardner <gardner.ben@gmail.com> wrote:
> Allow the at24 driver to get configuration information from both OF and
> ACPI by using the more generic device_property functions.
> This change was inspired by the at25.c driver.
>
> I have a custom board with a ST M24C02 EEPROM attached to an I2C bus.
> With the following ACPI construct, this patch instantiates a working
> instance of the driver.
>
> Device (EEP0) {
> Name (_HID, "PRP0001")
> Name (_DSD, Package () {
> ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
> Package () {
> Package () {"compatible", Package () {"st,24c02"}},
> Package () {"pagesize", 16},
> },
> })
> Name (_CRS, ResourceTemplate () {
> I2cSerialBus (
> 0x0057, ControllerInitiated, 400000,
> AddressingMode7Bit, "\\_SB.PCI0.I2C3", 0x00,
> ResourceConsumer,,)
> })
> }
>
> Note: Matching the driver to the I2C device requires another patch.
> http://www.spinics.net/lists/linux-acpi/msg71914.html
>
> Signed-off-by: Ben Gardner <gardner.ben@gmail.com>
> ---
> drivers/misc/eeprom/at24.c | 45 +++++++++++++++++++--------------------------
> 1 file changed, 19 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
> index 051b147..c2d9969 100644
> --- a/drivers/misc/eeprom/at24.c
> +++ b/drivers/misc/eeprom/at24.c
> @@ -19,7 +19,7 @@
> #include <linux/log2.h>
> #include <linux/bitops.h>
> #include <linux/jiffies.h>
> -#include <linux/of.h>
> +#include <linux/property.h>
> #include <linux/acpi.h>
> #include <linux/i2c.h>
> #include <linux/nvmem-provider.h>
> @@ -562,26 +562,26 @@ static int at24_write(void *priv, unsigned int off, void *val, size_t count)
> return 0;
> }
>
> -#ifdef CONFIG_OF
> -static void at24_get_ofdata(struct i2c_client *client,
> - struct at24_platform_data *chip)
> +static void at24_get_pdata(struct device *dev, struct at24_platform_data *chip)
> {
> - const __be32 *val;
> - struct device_node *node = client->dev.of_node;
> -
> - if (node) {
> - if (of_get_property(node, "read-only", NULL))
> - chip->flags |= AT24_FLAG_READONLY;
> - val = of_get_property(node, "pagesize", NULL);
> - if (val)
> - chip->page_size = be32_to_cpup(val);
> + int err;
> + u32 val;
> +
> + if (device_property_present(dev, "read-only"))
> + chip->flags |= AT24_FLAG_READONLY;
> +
> + err = device_property_read_u32(dev, "pagesize", &val);
> + if (!err) {
> + chip->page_size = val;
> + } else {
> + /*
> + * This is slow, but we can't know all eeproms, so we better
> + * play safe. Specifying custom eeprom-types via platform_data
> + * is recommended anyhow.
> + */
> + chip.page_size = 1;
> }
> }
> -#else
> -static void at24_get_ofdata(struct i2c_client *client,
> - struct at24_platform_data *chip)
> -{ }
> -#endif /* CONFIG_OF */
>
> static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
> {
> @@ -613,15 +613,8 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
> chip.byte_len = BIT(magic & AT24_BITMASK(AT24_SIZE_BYTELEN));
> magic >>= AT24_SIZE_BYTELEN;
> chip.flags = magic & AT24_BITMASK(AT24_SIZE_FLAGS);
> - /*
> - * This is slow, but we can't know all eeproms, so we better
> - * play safe. Specifying custom eeprom-types via platform_data
> - * is recommended anyhow.
> - */
> - chip.page_size = 1;
>
> - /* update chipdata if OF is present */
> - at24_get_ofdata(client, &chip);
> + at24_get_pdata(&client->dev, &chip);
>
> chip.setup = NULL;
> chip.context = NULL;
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v4] eeprom/at24: use device_property_*() functions instead of of_get_property()
2017-02-09 17:18 ` Ben Gardner
@ 2017-02-09 17:36 ` Ben Gardner
2017-02-09 17:43 ` Andy Shevchenko
` (2 more replies)
0 siblings, 3 replies; 18+ messages in thread
From: Ben Gardner @ 2017-02-09 17:36 UTC (permalink / raw)
To: Wolfram Sang; +Cc: linux-i2c, linux-kernel, Andy Shevchenko, Ben Gardner
Allow the at24 driver to get configuration information from both OF and
ACPI by using the more generic device_property functions.
This change was inspired by the at25.c driver.
I have a custom board with a ST M24C02 EEPROM attached to an I2C bus.
With the following ACPI construct, this patch instantiates a working
instance of the driver.
Device (EEP0) {
Name (_HID, "PRP0001")
Name (_DSD, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package () {"compatible", Package () {"st,24c02"}},
Package () {"pagesize", 16},
},
})
Name (_CRS, ResourceTemplate () {
I2cSerialBus (
0x0057, ControllerInitiated, 400000,
AddressingMode7Bit, "\\_SB.PCI0.I2C3", 0x00,
ResourceConsumer,,)
})
}
Note: Matching the driver to the I2C device requires another patch.
http://www.spinics.net/lists/linux-acpi/msg71914.html
Signed-off-by: Ben Gardner <gardner.ben@gmail.com>
---
drivers/misc/eeprom/at24.c | 45 +++++++++++++++++++--------------------------
1 file changed, 19 insertions(+), 26 deletions(-)
diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index 051b147..764ff5df 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -19,7 +19,7 @@
#include <linux/log2.h>
#include <linux/bitops.h>
#include <linux/jiffies.h>
-#include <linux/of.h>
+#include <linux/property.h>
#include <linux/acpi.h>
#include <linux/i2c.h>
#include <linux/nvmem-provider.h>
@@ -562,26 +562,26 @@ static int at24_write(void *priv, unsigned int off, void *val, size_t count)
return 0;
}
-#ifdef CONFIG_OF
-static void at24_get_ofdata(struct i2c_client *client,
- struct at24_platform_data *chip)
+static void at24_get_pdata(struct device *dev, struct at24_platform_data *chip)
{
- const __be32 *val;
- struct device_node *node = client->dev.of_node;
-
- if (node) {
- if (of_get_property(node, "read-only", NULL))
- chip->flags |= AT24_FLAG_READONLY;
- val = of_get_property(node, "pagesize", NULL);
- if (val)
- chip->page_size = be32_to_cpup(val);
+ int err;
+ u32 val;
+
+ if (device_property_present(dev, "read-only"))
+ chip->flags |= AT24_FLAG_READONLY;
+
+ err = device_property_read_u32(dev, "pagesize", &val);
+ if (!err) {
+ chip->page_size = val;
+ } else {
+ /*
+ * This is slow, but we can't know all eeproms, so we better
+ * play safe. Specifying custom eeprom-types via platform_data
+ * is recommended anyhow.
+ */
+ chip->page_size = 1;
}
}
-#else
-static void at24_get_ofdata(struct i2c_client *client,
- struct at24_platform_data *chip)
-{ }
-#endif /* CONFIG_OF */
static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
{
@@ -613,15 +613,8 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
chip.byte_len = BIT(magic & AT24_BITMASK(AT24_SIZE_BYTELEN));
magic >>= AT24_SIZE_BYTELEN;
chip.flags = magic & AT24_BITMASK(AT24_SIZE_FLAGS);
- /*
- * This is slow, but we can't know all eeproms, so we better
- * play safe. Specifying custom eeprom-types via platform_data
- * is recommended anyhow.
- */
- chip.page_size = 1;
- /* update chipdata if OF is present */
- at24_get_ofdata(client, &chip);
+ at24_get_pdata(&client->dev, &chip);
chip.setup = NULL;
chip.context = NULL;
--
2.7.4
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH v4] eeprom/at24: use device_property_*() functions instead of of_get_property()
2017-02-09 17:36 ` [PATCH v4] " Ben Gardner
@ 2017-02-09 17:43 ` Andy Shevchenko
2017-02-09 19:58 ` Wolfram Sang
2017-02-10 15:34 ` Wolfram Sang
2 siblings, 0 replies; 18+ messages in thread
From: Andy Shevchenko @ 2017-02-09 17:43 UTC (permalink / raw)
To: Ben Gardner; +Cc: Wolfram Sang, linux-i2c, linux-kernel
On Thu, Feb 9, 2017 at 7:36 PM, Ben Gardner <gardner.ben@gmail.com> wrote:
> Allow the at24 driver to get configuration information from both OF and
> ACPI by using the more generic device_property functions.
> This change was inspired by the at25.c driver.
>
> I have a custom board with a ST M24C02 EEPROM attached to an I2C bus.
> With the following ACPI construct, this patch instantiates a working
> instance of the driver.
>
> Device (EEP0) {
> Name (_HID, "PRP0001")
> Name (_DSD, Package () {
> ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
> Package () {
> Package () {"compatible", Package () {"st,24c02"}},
> Package () {"pagesize", 16},
> },
> })
> Name (_CRS, ResourceTemplate () {
> I2cSerialBus (
> 0x0057, ControllerInitiated, 400000,
> AddressingMode7Bit, "\\_SB.PCI0.I2C3", 0x00,
> ResourceConsumer,,)
> })
> }
>
> Note: Matching the driver to the I2C device requires another patch.
> http://www.spinics.net/lists/linux-acpi/msg71914.html
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> Signed-off-by: Ben Gardner <gardner.ben@gmail.com>
> ---
> drivers/misc/eeprom/at24.c | 45 +++++++++++++++++++--------------------------
> 1 file changed, 19 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
> index 051b147..764ff5df 100644
> --- a/drivers/misc/eeprom/at24.c
> +++ b/drivers/misc/eeprom/at24.c
> @@ -19,7 +19,7 @@
> #include <linux/log2.h>
> #include <linux/bitops.h>
> #include <linux/jiffies.h>
> -#include <linux/of.h>
> +#include <linux/property.h>
> #include <linux/acpi.h>
> #include <linux/i2c.h>
> #include <linux/nvmem-provider.h>
> @@ -562,26 +562,26 @@ static int at24_write(void *priv, unsigned int off, void *val, size_t count)
> return 0;
> }
>
> -#ifdef CONFIG_OF
> -static void at24_get_ofdata(struct i2c_client *client,
> - struct at24_platform_data *chip)
> +static void at24_get_pdata(struct device *dev, struct at24_platform_data *chip)
> {
> - const __be32 *val;
> - struct device_node *node = client->dev.of_node;
> -
> - if (node) {
> - if (of_get_property(node, "read-only", NULL))
> - chip->flags |= AT24_FLAG_READONLY;
> - val = of_get_property(node, "pagesize", NULL);
> - if (val)
> - chip->page_size = be32_to_cpup(val);
> + int err;
> + u32 val;
> +
> + if (device_property_present(dev, "read-only"))
> + chip->flags |= AT24_FLAG_READONLY;
> +
> + err = device_property_read_u32(dev, "pagesize", &val);
> + if (!err) {
> + chip->page_size = val;
> + } else {
> + /*
> + * This is slow, but we can't know all eeproms, so we better
> + * play safe. Specifying custom eeprom-types via platform_data
> + * is recommended anyhow.
> + */
> + chip->page_size = 1;
> }
> }
> -#else
> -static void at24_get_ofdata(struct i2c_client *client,
> - struct at24_platform_data *chip)
> -{ }
> -#endif /* CONFIG_OF */
>
> static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
> {
> @@ -613,15 +613,8 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
> chip.byte_len = BIT(magic & AT24_BITMASK(AT24_SIZE_BYTELEN));
> magic >>= AT24_SIZE_BYTELEN;
> chip.flags = magic & AT24_BITMASK(AT24_SIZE_FLAGS);
> - /*
> - * This is slow, but we can't know all eeproms, so we better
> - * play safe. Specifying custom eeprom-types via platform_data
> - * is recommended anyhow.
> - */
> - chip.page_size = 1;
>
> - /* update chipdata if OF is present */
> - at24_get_ofdata(client, &chip);
> + at24_get_pdata(&client->dev, &chip);
>
> chip.setup = NULL;
> chip.context = NULL;
> --
> 2.7.4
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v4] eeprom/at24: use device_property_*() functions instead of of_get_property()
2017-02-09 17:36 ` [PATCH v4] " Ben Gardner
2017-02-09 17:43 ` Andy Shevchenko
@ 2017-02-09 19:58 ` Wolfram Sang
2017-02-09 20:31 ` Ben Gardner
2017-02-10 15:34 ` Wolfram Sang
2 siblings, 1 reply; 18+ messages in thread
From: Wolfram Sang @ 2017-02-09 19:58 UTC (permalink / raw)
To: Ben Gardner; +Cc: linux-i2c, linux-kernel, Andy Shevchenko
[-- Attachment #1: Type: text/plain, Size: 308 bytes --]
> Note: Matching the driver to the I2C device requires another patch.
> http://www.spinics.net/lists/linux-acpi/msg71914.html
Do I get it right? With the patch applied we won't have a regression but
the new feature will only be available when the above series is
upstream? So, it is a "weak" dependency?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v4] eeprom/at24: use device_property_*() functions instead of of_get_property()
2017-02-09 19:58 ` Wolfram Sang
@ 2017-02-09 20:31 ` Ben Gardner
0 siblings, 0 replies; 18+ messages in thread
From: Ben Gardner @ 2017-02-09 20:31 UTC (permalink / raw)
To: Wolfram Sang; +Cc: Linux I2C, linux-kernel, Andy Shevchenko
On Thu, Feb 9, 2017 at 1:58 PM, Wolfram Sang <wsa@the-dreams.de> wrote:
>
>> Note: Matching the driver to the I2C device requires another patch.
>> http://www.spinics.net/lists/linux-acpi/msg71914.html
>
> Do I get it right? With the patch applied we won't have a regression but
> the new feature will only be available when the above series is
> upstream? So, it is a "weak" dependency?
That is correct.
This patch shouldn't cause any regressions, but isn't useful without
the other patch series.
The other patch series was picked up today by Rafael J. Wysocki.
http://marc.info/?l=linux-acpi&m=148664872023023&w=2
Ben
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v2] eeprom/at24: use device_property_*() functions instead of of_get_property()
2017-02-09 15:33 ` [PATCH v2] " Ben Gardner
@ 2017-02-09 20:35 ` kbuild test robot
2017-02-09 20:35 ` kbuild test robot
2017-02-09 23:52 ` kbuild test robot
2 siblings, 0 replies; 18+ messages in thread
From: kbuild test robot @ 2017-02-09 20:35 UTC (permalink / raw)
To: Ben Gardner
Cc: kbuild-all, Wolfram Sang, linux-i2c, linux-kernel,
Andy Shevchenko, Ben Gardner
[-- Attachment #1: Type: text/plain, Size: 1262 bytes --]
Hi Ben,
[auto build test ERROR on char-misc/char-misc-testing]
[also build test ERROR on v4.10-rc7 next-20170209]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Ben-Gardner/eeprom-at24-use-device_property_-functions-instead-of-of_get_property/20170210-025938
config: x86_64-rhel (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All errors (new ones prefixed by >>):
drivers/misc/eeprom/at24.c: In function 'at24_get_pdata':
>> drivers/misc/eeprom/at24.c:580:7: error: 'chip' is a pointer; did you mean to use '->'?
chip.page_size = 1;
^
->
vim +580 drivers/misc/eeprom/at24.c
574 } else {
575 /*
576 * This is slow, but we can't know all eeproms, so we better
577 * play safe. Specifying custom eeprom-types via platform_data
578 * is recommended anyhow.
579 */
> 580 chip.page_size = 1;
581 }
582 }
583
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 38283 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v2] eeprom/at24: use device_property_*() functions instead of of_get_property()
@ 2017-02-09 20:35 ` kbuild test robot
0 siblings, 0 replies; 18+ messages in thread
From: kbuild test robot @ 2017-02-09 20:35 UTC (permalink / raw)
Cc: kbuild-all, Wolfram Sang, linux-i2c, linux-kernel,
Andy Shevchenko, Ben Gardner
[-- Attachment #1: Type: text/plain, Size: 1262 bytes --]
Hi Ben,
[auto build test ERROR on char-misc/char-misc-testing]
[also build test ERROR on v4.10-rc7 next-20170209]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Ben-Gardner/eeprom-at24-use-device_property_-functions-instead-of-of_get_property/20170210-025938
config: x86_64-rhel (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All errors (new ones prefixed by >>):
drivers/misc/eeprom/at24.c: In function 'at24_get_pdata':
>> drivers/misc/eeprom/at24.c:580:7: error: 'chip' is a pointer; did you mean to use '->'?
chip.page_size = 1;
^
->
vim +580 drivers/misc/eeprom/at24.c
574 } else {
575 /*
576 * This is slow, but we can't know all eeproms, so we better
577 * play safe. Specifying custom eeprom-types via platform_data
578 * is recommended anyhow.
579 */
> 580 chip.page_size = 1;
581 }
582 }
583
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 38283 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v2] eeprom/at24: use device_property_*() functions instead of of_get_property()
2017-02-09 20:35 ` kbuild test robot
(?)
@ 2017-02-09 21:30 ` Andy Shevchenko
-1 siblings, 0 replies; 18+ messages in thread
From: Andy Shevchenko @ 2017-02-09 21:30 UTC (permalink / raw)
To: kbuild test robot
Cc: Ben Gardner, kbuild-all, Wolfram Sang, linux-i2c, linux-kernel
On Thu, Feb 9, 2017 at 10:35 PM, kbuild test robot <lkp@intel.com> wrote:
> Hi Ben,
>
> [auto build test ERROR on char-misc/char-misc-testing]
> [also build test ERROR on v4.10-rc7 next-20170209]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
Optimistic way of thinking: kbuild bot was fast enough.
Pessimistic: it wasn't too slow enough.
P.S. I think it against older version of the patch, thus, we may
safely ignore this.
>
> url: https://github.com/0day-ci/linux/commits/Ben-Gardner/eeprom-at24-use-device_property_-functions-instead-of-of_get_property/20170210-025938
> config: x86_64-rhel (attached as .config)
> compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
> reproduce:
> # save the attached .config to linux build tree
> make ARCH=x86_64
>
> All errors (new ones prefixed by >>):
>
> drivers/misc/eeprom/at24.c: In function 'at24_get_pdata':
>>> drivers/misc/eeprom/at24.c:580:7: error: 'chip' is a pointer; did you mean to use '->'?
> chip.page_size = 1;
> ^
> ->
>
> vim +580 drivers/misc/eeprom/at24.c
>
> 574 } else {
> 575 /*
> 576 * This is slow, but we can't know all eeproms, so we better
> 577 * play safe. Specifying custom eeprom-types via platform_data
> 578 * is recommended anyhow.
> 579 */
> > 580 chip.page_size = 1;
> 581 }
> 582 }
> 583
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v2] eeprom/at24: use device_property_*() functions instead of of_get_property()
2017-02-09 15:33 ` [PATCH v2] " Ben Gardner
@ 2017-02-09 23:52 ` kbuild test robot
2017-02-09 20:35 ` kbuild test robot
2017-02-09 23:52 ` kbuild test robot
2 siblings, 0 replies; 18+ messages in thread
From: kbuild test robot @ 2017-02-09 23:52 UTC (permalink / raw)
To: Ben Gardner
Cc: kbuild-all, Wolfram Sang, linux-i2c, linux-kernel,
Andy Shevchenko, Ben Gardner
[-- Attachment #1: Type: text/plain, Size: 1281 bytes --]
Hi Ben,
[auto build test ERROR on char-misc/char-misc-testing]
[also build test ERROR on v4.10-rc7]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Ben-Gardner/eeprom-at24-use-device_property_-functions-instead-of-of_get_property/20170210-025938
config: x86_64-randconfig-it0-02100353 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All errors (new ones prefixed by >>):
drivers/misc/eeprom/at24.c: In function 'at24_get_pdata':
>> drivers/misc/eeprom/at24.c:580:7: error: request for member 'page_size' in something not a structure or union
chip.page_size = 1;
^
vim +/page_size +580 drivers/misc/eeprom/at24.c
574 } else {
575 /*
576 * This is slow, but we can't know all eeproms, so we better
577 * play safe. Specifying custom eeprom-types via platform_data
578 * is recommended anyhow.
579 */
> 580 chip.page_size = 1;
581 }
582 }
583
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 22328 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v2] eeprom/at24: use device_property_*() functions instead of of_get_property()
@ 2017-02-09 23:52 ` kbuild test robot
0 siblings, 0 replies; 18+ messages in thread
From: kbuild test robot @ 2017-02-09 23:52 UTC (permalink / raw)
Cc: kbuild-all, Wolfram Sang, linux-i2c, linux-kernel,
Andy Shevchenko, Ben Gardner
[-- Attachment #1: Type: text/plain, Size: 1281 bytes --]
Hi Ben,
[auto build test ERROR on char-misc/char-misc-testing]
[also build test ERROR on v4.10-rc7]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Ben-Gardner/eeprom-at24-use-device_property_-functions-instead-of-of_get_property/20170210-025938
config: x86_64-randconfig-it0-02100353 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All errors (new ones prefixed by >>):
drivers/misc/eeprom/at24.c: In function 'at24_get_pdata':
>> drivers/misc/eeprom/at24.c:580:7: error: request for member 'page_size' in something not a structure or union
chip.page_size = 1;
^
vim +/page_size +580 drivers/misc/eeprom/at24.c
574 } else {
575 /*
576 * This is slow, but we can't know all eeproms, so we better
577 * play safe. Specifying custom eeprom-types via platform_data
578 * is recommended anyhow.
579 */
> 580 chip.page_size = 1;
581 }
582 }
583
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 22328 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v4] eeprom/at24: use device_property_*() functions instead of of_get_property()
2017-02-09 17:36 ` [PATCH v4] " Ben Gardner
2017-02-09 17:43 ` Andy Shevchenko
2017-02-09 19:58 ` Wolfram Sang
@ 2017-02-10 15:34 ` Wolfram Sang
2 siblings, 0 replies; 18+ messages in thread
From: Wolfram Sang @ 2017-02-10 15:34 UTC (permalink / raw)
To: Ben Gardner; +Cc: linux-i2c, linux-kernel, Andy Shevchenko
[-- Attachment #1: Type: text/plain, Size: 1320 bytes --]
On Thu, Feb 09, 2017 at 11:36:08AM -0600, Ben Gardner wrote:
> Allow the at24 driver to get configuration information from both OF and
> ACPI by using the more generic device_property functions.
> This change was inspired by the at25.c driver.
>
> I have a custom board with a ST M24C02 EEPROM attached to an I2C bus.
> With the following ACPI construct, this patch instantiates a working
> instance of the driver.
>
> Device (EEP0) {
> Name (_HID, "PRP0001")
> Name (_DSD, Package () {
> ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
> Package () {
> Package () {"compatible", Package () {"st,24c02"}},
> Package () {"pagesize", 16},
> },
> })
> Name (_CRS, ResourceTemplate () {
> I2cSerialBus (
> 0x0057, ControllerInitiated, 400000,
> AddressingMode7Bit, "\\_SB.PCI0.I2C3", 0x00,
> ResourceConsumer,,)
> })
> }
>
> Note: Matching the driver to the I2C device requires another patch.
> http://www.spinics.net/lists/linux-acpi/msg71914.html
This should have been below the "---" because dependencies are not
relevant in the git history.
>
> Signed-off-by: Ben Gardner <gardner.ben@gmail.com>
Please send new patches not in-reply-to old patches, seperate threads
are easier to find IMHO.
Other than that:
Applied to for-next, thanks!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2017-02-10 15:35 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-08 19:53 [PATCH] eeprom/at24: use device_property_*() functions instead of of_get_property() Ben Gardner
2017-02-09 0:07 ` Andy Shevchenko
2017-02-09 15:27 ` Ben Gardner
2017-02-09 15:33 ` [PATCH v2] " Ben Gardner
2017-02-09 16:20 ` Andy Shevchenko
2017-02-09 17:03 ` Ben Gardner
2017-02-09 17:09 ` [PATCH v3] " Ben Gardner
2017-02-09 17:18 ` Ben Gardner
2017-02-09 17:36 ` [PATCH v4] " Ben Gardner
2017-02-09 17:43 ` Andy Shevchenko
2017-02-09 19:58 ` Wolfram Sang
2017-02-09 20:31 ` Ben Gardner
2017-02-10 15:34 ` Wolfram Sang
2017-02-09 20:35 ` [PATCH v2] " kbuild test robot
2017-02-09 20:35 ` kbuild test robot
2017-02-09 21:30 ` Andy Shevchenko
2017-02-09 23:52 ` kbuild test robot
2017-02-09 23:52 ` kbuild test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.