From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Opensource [Adam Thomson]" <Adam.Thomson.Opensource@diasemi.com>,
Mark Brown <broonie@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Robert Moore <robert.moore@intel.com>,
Lv Zheng <lv.zheng@intel.com>,
"Rafael J.Wysocki" <rafael.j.wysocki@intel.com>,
Len Brown <lenb@kernel.org>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
"devel@acpica.org" <devel@acpica.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Support Opensource <Support.Opensource@diasemi.com>,
Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>,
Suravee <Suravee.Suthikulpanit@amd.com>,
Bjorn Helgaas <bhelgaas@google.com>,
Hanjun Guo <hanjun.guo@linaro.org>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
Heikki Krogerus <heikki.krogerus@linux.intel.com>
Subject: Re: [PATCH v2 2/2] ASoC: da7219: Convert driver to use generic device/fwnode functions
Date: Tue, 24 May 2016 13:53:02 +0300 [thread overview]
Message-ID: <1464087182.31269.44.camel@linux.intel.com> (raw)
In-Reply-To: <2E89032DDAA8B9408CB92943514A0337D463EEB5@SW-EX-MBX01.diasemi.com>
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
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2016-05-24 10:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-17 10:28 [PATCH 0/2] ASoC: da7219: Convert driver to use generic FW functions Adam Thomson
2016-05-17 10:28 ` [PATCH 1/2] device property: Add function to search for named child of device Adam Thomson
2016-05-17 10:28 ` [PATCH v2 2/2] ASoC: da7219: Convert driver to use generic device/fwnode functions Adam Thomson
2016-05-19 13:27 ` Andy Shevchenko
2016-05-23 22:53 ` Opensource [Adam Thomson]
2016-05-24 10:53 ` Andy Shevchenko [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1464087182.31269.44.camel@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=Adam.Thomson.Opensource@diasemi.com \
--cc=Support.Opensource@diasemi.com \
--cc=Suravee.Suthikulpanit@amd.com \
--cc=akpm@linux-foundation.org \
--cc=alsa-devel@alsa-project.org \
--cc=bhelgaas@google.com \
--cc=broonie@kernel.org \
--cc=devel@acpica.org \
--cc=gregkh@linuxfoundation.org \
--cc=hanjun.guo@linaro.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=lenb@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lv.zheng@intel.com \
--cc=mika.westerberg@linux.intel.com \
--cc=perex@perex.cz \
--cc=rafael.j.wysocki@intel.com \
--cc=robert.moore@intel.com \
--cc=sathyanarayana.nujella@intel.com \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).