* Re: [PATCH v2 2/2] ASoC: da7219: Convert driver to use generic device/fwnode functions [not found] ` <eea79e2c26dafa785451931387cfce716bd150d4.1463477116.git.Adam.Thomson.Opensource@diasemi.com> @ 2016-05-19 13:27 ` Andy Shevchenko [not found] ` <2E89032DDAA8B9408CB92943514A0337D463EEB5@SW-EX-MBX01.diasemi.com> 0 siblings, 1 reply; 2+ messages in thread From: Andy Shevchenko @ 2016-05-19 13:27 UTC (permalink / raw) To: Adam Thomson, Mark Brown, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Greg Kroah-Hartman, Robert Moore, Lv Zheng, Rafael J.Wysocki, Len Brown Cc: alsa-devel, linux-acpi, devel, linux-kernel, Support Opensource, Sathyanarayana Nujella, Suthikulpanit, Suravee, Bjorn Helgaas, Hanjun Guo, Mika Westerberg, Andrew Morton, Heikki Krogerus On Tue, 2016-05-17 at 11:28 +0100, Adam Thomson wrote: > This change converts the driver from using the of_* functions to using > the device_* and fwnode_* functions for accssing FW related data. > > Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> > Tested-by: Sathyanarayana Nujella <sathyanarayana.nujella@intel.com> @@ -538,97 +538,96 @@ static enum da7219_aad_adc_1bit_rpt > } > } > > -static struct da7219_aad_pdata *da7219_aad_of_to_pdata(struct > snd_soc_codec *codec) > +static struct da7219_aad_pdata *da7219_aad_fw_to_pdata(struct > snd_soc_codec *codec) > { > - struct device_node *np = codec->dev->of_node; > - struct device_node *aad_np = of_find_node_by_name(np, > "da7219_aad"); > + struct device *dev = codec->dev; > + struct i2c_client *i2c = to_i2c_client(dev); > + struct fwnode_handle *aad_np = > + device_get_named_child_node(dev, "da7219_aad"); I would suggest to do an assignment below... > struct da7219_aad_pdata *aad_pdata; > - const char *of_str; > - u32 of_val32; > + const char *fw_str; > + u32 fw_val32; > ...right here. Same amount of LOC, but less difficult to see from where aad_np comes. > if (!aad_np) > return NULL; > > @@ -769,9 +768,9 @@ int da7219_aad_init(struct snd_soc_codec *codec) > da7219->aad = da7219_aad; > da7219_aad->codec = codec; > > - /* Handle any DT/platform data */ > - if ((codec->dev->of_node) && (da7219->pdata)) > - da7219->pdata->aad_pdata = > da7219_aad_of_to_pdata(codec); > + /* Handle any DT/ACPI/platform data */ > + if ((da7219->pdata) && (!da7219->pdata->aad_pdata)) Redundant parens, twice. -- Andy Shevchenko <andriy.shevchenko@linux.intel.com> Intel Finland Oy ^ permalink raw reply [flat|nested] 2+ messages in thread
[parent not found: <2E89032DDAA8B9408CB92943514A0337D463EEB5@SW-EX-MBX01.diasemi.com>]
* Re: [PATCH v2 2/2] ASoC: da7219: Convert driver to use generic device/fwnode functions [not found] ` <2E89032DDAA8B9408CB92943514A0337D463EEB5@SW-EX-MBX01.diasemi.com> @ 2016-05-24 10:53 ` Andy Shevchenko 0 siblings, 0 replies; 2+ messages in thread From: Andy Shevchenko @ 2016-05-24 10:53 UTC (permalink / raw) To: Opensource [Adam Thomson], Mark Brown, Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Greg Kroah-Hartman, Robert Moore, Lv Zheng, Rafael J.Wysocki, Len Brown Cc: alsa-devel@alsa-project.org, linux-acpi@vger.kernel.org, devel@acpica.org, linux-kernel@vger.kernel.org, Support Opensource, Sathyanarayana Nujella, Suravee, Bjorn Helgaas, Hanjun Guo, Mika Westerberg, Andrew Morton, Heikki Krogerus On Mon, 2016-05-23 at 22:53 +0000, Opensource [Adam Thomson] wrote: > On May 19, 2015 14:28, Andy Shevchenko wrote: > > > > -static struct da7219_aad_pdata *da7219_aad_of_to_pdata(struct > > > snd_soc_codec *codec) > > > +static struct da7219_aad_pdata *da7219_aad_fw_to_pdata(struct > > > snd_soc_codec *codec) > > > { > > > - struct device_node *np = codec->dev->of_node; > > > - struct device_node *aad_np = of_find_node_by_name(np, > > > "da7219_aad"); > > > + struct device *dev = codec->dev; > > > + struct i2c_client *i2c = to_i2c_client(dev); > > > + struct fwnode_handle *aad_np = > > > + device_get_named_child_node(dev, "da7219_aad"); > > > > I would suggest to do an assignment below... > > > > > struct da7219_aad_pdata *aad_pdata; > > > - const char *of_str; > > > - u32 of_val32; > > > + const char *fw_str; > > > + u32 fw_val32; > > > > > > > > > ...right here. > > Same amount of LOC, but less difficult to see from where aad_np > > comes. > > > > > if (!aad_np) > > > return NULL; > > > > > To be fair the allocation of 'aad_np' is only a few lines above so > this really > doesn't seem to make much difference in my opinion. It really > shouldn't be hard > for someone to spot where it's allocated. Better to have it exactly before check. Just a readability and future maintenance. (Someone might insert something in between, and a matter of fact already did) Though I agree this is minor. > > > > @@ -769,9 +768,9 @@ int da7219_aad_init(struct snd_soc_codec > > > *codec) > > > da7219->aad = da7219_aad; > > > da7219_aad->codec = codec; > > > > > > - /* Handle any DT/platform data */ > > > - if ((codec->dev->of_node) && (da7219->pdata)) > > > - da7219->pdata->aad_pdata = > > > da7219_aad_of_to_pdata(codec); > > > + /* Handle any DT/ACPI/platform data */ > > > + if ((da7219->pdata) && (!da7219->pdata->aad_pdata)) > > > > Redundant parens, twice. > > Not essential, but looks cleaner to me. Unless there's a real demand > to change, > I'd like to leave this as is. It's really unusual pattern and doesn't add any value Compare if ((da7219->pdata) && (!da7219->pdata->aad_pdata)) to if (da7219->pdata && !da7219->pdata->aad_pdata) Latter looks cleaner. -- Andy Shevchenko <andriy.shevchenko@linux.intel.com> Intel Finland Oy ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-05-24 10:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <cover.1463477116.git.Adam.Thomson.Opensource@diasemi.com>
[not found] ` <eea79e2c26dafa785451931387cfce716bd150d4.1463477116.git.Adam.Thomson.Opensource@diasemi.com>
2016-05-19 13:27 ` [PATCH v2 2/2] ASoC: da7219: Convert driver to use generic device/fwnode functions Andy Shevchenko
[not found] ` <2E89032DDAA8B9408CB92943514A0337D463EEB5@SW-EX-MBX01.diasemi.com>
2016-05-24 10:53 ` Andy Shevchenko
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox