mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: kuldip dwivedi <kuldip.dwivedi@puresoftware.com>
Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org,
	Qiang Zhao <qiang.zhao@nxp.com>,
	Pankaj Bansal <pankaj.bansal@nxp.com>,
	Varun Sethi <V.Sethi@nxp.com>,
	tanveer <tanveer.alam@puresoftware.com>
Subject: Re: [PATCH] spi: spi-fsl-dspi: Add ACPI support
Date: Fri, 21 Aug 2020 15:07:19 +0100	[thread overview]
Message-ID: <20200821140718.GH4870@sirena.org.uk> (raw)
In-Reply-To: <20200821131029.11440-1-kuldip.dwivedi@puresoftware.com>

[-- Attachment #1: Type: text/plain, Size: 1639 bytes --]

On Fri, Aug 21, 2020 at 06:40:29PM +0530, kuldip dwivedi wrote:

> +static const struct acpi_device_id fsl_dspi_acpi_ids[] = {
> +	{ "NXP0005", .driver_data = (kernel_ulong_t)&devtype_data[LS2085A], },
> +	{},
> +};
> +MODULE_DEVICE_TABLE(acpi, fsl_dspi_acpi_ids);

Does NXP know about this ID assignment from their namespace?  ACPI IDs
should be namespaced by whoever's assigning the ID to avoid collisions.

> -		ret = of_property_read_u32(np, "spi-num-chipselects", &cs_num);
> +		if (is_acpi_node(pdev->dev.fwnode))
> +			ret = device_property_read_u32(&pdev->dev,
> +					"spi-num-chipselects", &cs_num);
> +		else
> +			ret = of_property_read_u32(np,
> +					"spi-num-chipselects", &cs_num);

The whole point with the device property API is that it works with both
DT and ACPI without needing separate parsing, though in this case I'm
wondering why we'd need to specify this in an ACPI system at all?

> -		of_property_read_u32(np, "bus-num", &bus_num);
> +		if (is_acpi_node(pdev->dev.fwnode)) {
> +			ret = device_property_read_u32(&pdev->dev,
> +							"bus-num", &bus_num);

This is a bad idea for DT and I can't understand why you'd carry it over
for ACPI - why would an ACPI system ever care about this?  It's Linux
internal at the best of times.

It looks like you've done this by simply adding these device property
alternatives for every DT property.  This isn't how that API is intended
to be used and suggests that this isn't a thought through, idiomatic
ACPI binding.  I'd suggest looking at the Synquacer driver for an
example of how this would normally be done, I'd expect your ACPI code to
look very much like theirs.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2020-08-21 14:07 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-21 13:10 kuldip dwivedi
2020-08-21 14:07 ` Mark Brown [this message]
2020-08-22 14:07   ` Kuldip Dwivedi
2020-08-22 15:21     ` Vladimir Oltean
2020-08-24 11:25       ` Mark Brown
2020-08-26  8:19         ` Qiang Zhao
2020-08-26 10:19           ` Mark Brown
2020-08-26 11:10       ` Qiang Zhao
2020-08-26 11:47         ` Vladimir Oltean
2020-08-26 14:23           ` Mark Brown
2020-08-26 14:47             ` Vladimir Oltean
2020-08-26 15:13               ` Kuldip Dwivedi
2020-08-26 16:09                 ` Vladimir Oltean
2020-08-26 17:02                   ` Mark Brown
2020-08-26 18:30                     ` Vladimir Oltean
2020-08-26 18:36                       ` Mark Brown
2020-08-26 16:55               ` Mark Brown
2020-08-26 18:33                 ` Vladimir Oltean
2020-08-26 18:42                   ` Mark Brown
2020-08-21 16:49 ` kernel test robot
2020-08-22 18:33 ` Vladimir Oltean
2020-08-26 19:34   ` Andy Shevchenko
2020-08-26 19:36     ` Andy Shevchenko
2020-08-26 19:56       ` Vladimir Oltean
2020-08-26 20:41         ` Mark Brown
2020-08-26 20:41     ` Vladimir Oltean
2020-08-26 20:45       ` Mark Brown
2020-08-26 21:06         ` Vladimir Oltean
2020-08-27 11:32           ` 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=20200821140718.GH4870@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=V.Sethi@nxp.com \
    --cc=kuldip.dwivedi@puresoftware.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=pankaj.bansal@nxp.com \
    --cc=qiang.zhao@nxp.com \
    --cc=tanveer.alam@puresoftware.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

all inboxes | Powered by JetHome®