From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Mark Brown <broonie@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org,
linux-kernel@vger.kernel.org, Daniel Mack <daniel@zonque.org>,
Haojian Zhuang <haojian.zhuang@gmail.com>,
Robert Jarzmik <robert.jarzmik@free.fr>
Subject: Re: [PATCH v4 1/5] spi: pxa2xx: Respect Intel SSP type given by a property
Date: Fri, 21 Oct 2022 15:26:23 +0300 [thread overview]
Message-ID: <Y1KP7xYRAmDppvZG@smile.fi.intel.com> (raw)
In-Reply-To: <Y1KNgS6xQ1VhMjo1@sirena.org.uk>
On Fri, Oct 21, 2022 at 01:16:01PM +0100, Mark Brown wrote:
> On Thu, Oct 20, 2022 at 10:44:56PM +0300, Andy Shevchenko wrote:
>
> > Allow to set the Intel SSP type by reading the property.
> > Only apply this to the known MFD enumerated devices.
>
> > + /* For MFD enumerated devices always ask for a property */
> > + mfd_enumerated = platform_get_resource_byname(pdev, IORESOURCE_MEM, "lpss_priv");
> > + if (mfd_enumerated) {
> > + status = device_property_read_u32(dev, "intel,spi-pxa2xx-type", &value);
> > + if (status)
> > + return ERR_PTR(status);
> > + }
> > +
> > if (pcidev)
> > pcidev_id = pci_match_id(pxa2xx_spi_pci_compound_match, pcidev);
> >
> > match = device_get_match_data(&pdev->dev);
> > if (match)
> > type = (enum pxa_ssp_type)match;
> > + else if (value > SSP_UNDEFINED && value < SSP_MAX)
> > + type = (enum pxa_ssp_type)value;
>
> This is quite hard to follow, partly because value isn't exactly a clear
> variable name and partly because the initialisation to SSP_UNDEFINED,
> the attempt to read via device property and this if/else chain are split
> up and not clearly joined up with each other. This is partly an issue
> with the existing code but the extra layer of spreading things
> throughout the function being added amplifies things a bit.
The next patch removes the PCI part in this equation, at the end there is
no "new" complexity on top of the existing one. But I'm all ears on how
to simplify the existing code.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2022-10-21 12:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-20 19:44 [PATCH v4 0/5] spi: pxa2xx: Pass the SSP type via device property Andy Shevchenko
2022-10-20 19:44 ` [PATCH v4 1/5] spi: pxa2xx: Respect Intel SSP type given by a property Andy Shevchenko
2022-10-21 12:16 ` Mark Brown
2022-10-21 12:26 ` Andy Shevchenko [this message]
2022-10-20 19:44 ` [PATCH v4 2/5] spi: pxa2xx: Remove no more needed PCI ID table Andy Shevchenko
2022-10-20 19:44 ` [PATCH v4 3/5] spi: pxa2xx: Move OF and ACPI ID tables closer to their user Andy Shevchenko
2022-10-20 19:44 ` [PATCH v4 4/5] spi: pxa2xx: Consistently use dev variable in pxa2xx_spi_init_pdata() Andy Shevchenko
2022-10-20 19:45 ` [PATCH v4 5/5] spi: pxa2xx: Switch from PM ifdeffery to pm_ptr() Andy Shevchenko
2022-10-21 15:31 ` (subset) [PATCH v4 0/5] spi: pxa2xx: Pass the SSP type via device property Mark Brown
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=Y1KP7xYRAmDppvZG@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=broonie@kernel.org \
--cc=daniel@zonque.org \
--cc=haojian.zhuang@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=robert.jarzmik@free.fr \
/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