Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1552940
| From | Andy Shevchenko <andy.shevchenko@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] i2c: core: helper function to detect slave mode |
| Date | 2017-01-06 17:40 +0100 |
| Message-ID | <sWFIB-4w8-7@gated-at.bofh.it> (permalink) |
| References | <sWk1s-63E-27@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, Jan 5, 2017 at 7:24 PM, Luis Oliveira
<Luis.Oliveira@synopsys.com> wrote:
> This function has the purpose of mode detection by checking the
> device nodes for a reg matching with the I2C_OWN_SLAVE_ADDREESS flag.
> Currently only checks using OF functions (ACPI slave not supported yet).
The code looks good, one important comment below, after addressing it:
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
P.S. Btw, we have Suggested-by tag for giving credit for suggestion.
Please use it.
> --- a/drivers/i2c/i2c-core.c
> +++ b/drivers/i2c/i2c-core.c
> @@ -3691,6 +3691,25 @@ int i2c_slave_unregister(struct i2c_client *client)
Please, add kernel doc description here, important thing is to explain
return codes in Return: section of it.
> +int i2c_slave_mode_detect(struct device *dev)
> +{
> + struct device_node *child;
> + u32 reg;
I would consider them as private to the OF branch. But it's really
minor and up to you (I don't remember if we have such style examples
in i2c core code).
> +
> + if (IS_BUILTIN(CONFIG_OF) && dev->of_node) {
> + for_each_child_of_node(dev->of_node, child) {
> + of_property_read_u32(child, "reg", ®);
> + if (reg & I2C_OWN_SLAVE_ADDRESS)
> + return 1;
> + }
> + } else if (IS_BUILTIN(CONFIG_ACPI) && ACPI_HANDLE(dev)) {
> + dev_dbg(dev, "ACPI slave is not supported yet\n");
> + }
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(i2c_slave_mode_detect);
--
With Best Regards,
Andy Shevchenko
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] i2c: core: helper function to detect slave mode Luis Oliveira <Luis.Oliveira@synopsys.com> - 2017-01-05 18:30 +0100
Re: [PATCH] i2c: core: helper function to detect slave mode Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-01-06 17:40 +0100
Re: [PATCH] i2c: core: helper function to detect slave mode Luis Oliveira <Luis.Oliveira@synopsys.com> - 2017-01-06 18:20 +0100
Re: [PATCH] i2c: core: helper function to detect slave mode Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-01-06 18:20 +0100
Re: [PATCH] i2c: core: helper function to detect slave mode Luis Oliveira <Luis.Oliveira@synopsys.com> - 2017-01-06 18:50 +0100
Re: [PATCH] i2c: core: helper function to detect slave mode Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-01-06 22:40 +0100
Re: [PATCH] i2c: core: helper function to detect slave mode Rob Herring <robh+dt@kernel.org> - 2017-01-06 17:40 +0100
Re: [PATCH] i2c: core: helper function to detect slave mode Luis Oliveira <Luis.Oliveira@synopsys.com> - 2017-01-06 18:20 +0100
Re: [PATCH] i2c: core: helper function to detect slave mode Vladimir Zapolskiy <vz@mleia.com> - 2017-01-06 22:50 +0100
Re: [PATCH] i2c: core: helper function to detect slave mode Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-01-06 23:50 +0100
Re: [PATCH] i2c: core: helper function to detect slave mode Vladimir Zapolskiy <vz@mleia.com> - 2017-01-07 00:50 +0100
Re: [PATCH] i2c: core: helper function to detect slave mode Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-01-07 01:30 +0100
Re: [PATCH] i2c: core: helper function to detect slave mode Vladimir Zapolskiy <vz@mleia.com> - 2017-01-07 02:30 +0100
Re: [PATCH] i2c: core: helper function to detect slave mode Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-01-12 18:10 +0100
Re: [PATCH] i2c: core: helper function to detect slave mode Luis Oliveira <Luis.Oliveira@synopsys.com> - 2017-01-16 11:50 +0100
csiph-web