Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1390422 > unrolled thread

Re: [RFC PATCH v2 06/10] spi: add support for ACPI reconfigure notifications

Started byMark Brown <broonie@kernel.org>
First post2016-04-28 19:50 +0200
Last post2016-05-04 17:10 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [RFC PATCH v2 06/10] spi: add support for ACPI reconfigure  notifications Mark Brown <broonie@kernel.org> - 2016-04-28 19:50 +0200
    Re: [RFC PATCH v2 06/10] spi: add support for ACPI reconfigure notifications Octavian Purdila <octavian.purdila@intel.com> - 2016-04-28 21:40 +0200
      Re: [RFC PATCH v2 06/10] spi: add support for ACPI reconfigure  notifications Mark Brown <broonie@kernel.org> - 2016-05-03 14:30 +0200
        Re: [RFC PATCH v2 06/10] spi: add support for ACPI reconfigure notifications Octavian Purdila <octavian.purdila@intel.com> - 2016-05-04 17:10 +0200

#1390422 — Re: [RFC PATCH v2 06/10] spi: add support for ACPI reconfigure notifications

FromMark Brown <broonie@kernel.org>
Date2016-04-28 19:50 +0200
SubjectRe: [RFC PATCH v2 06/10] spi: add support for ACPI reconfigure notifications
Message-ID<rsYeC-7Pw-13@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

On Wed, Apr 20, 2016 at 01:39:04AM +0300, Octavian Purdila wrote:

> +	switch (value) {
> +	case ACPI_RECONFIG_DEVICE_ADD:
> +		master = acpi_spi_find_master_by_adev(adev->parent);
> +		if (!master)
> +			break;
> +
> +		acpi_register_spi_device(master, adev);
> +		put_device(&master->dev);
> +		break;
> +	case ACPI_RECONFIG_DEVICE_REMOVE:
> +		spi = acpi_spi_find_device_by_adev(adev);
> +		if (!spi)
> +			break;

There's more code here now than I remember but this all looks *really*
close to the DT code except for the OF_POPULATED flag that we set when
things are instantiated in DT.  The duplication seems bad but the fact
that we're missing the flag worries me...  do we have guarantees that
ACPI won't double register?

[toc] | [next] | [standalone]


#1390481 — Re: [RFC PATCH v2 06/10] spi: add support for ACPI reconfigure notifications

FromOctavian Purdila <octavian.purdila@intel.com>
Date2016-04-28 21:40 +0200
SubjectRe: [RFC PATCH v2 06/10] spi: add support for ACPI reconfigure notifications
Message-ID<rsZX5-15D-23@gated-at.bofh.it>
In reply to#1390422
On Thu, Apr 28, 2016 at 8:42 PM, Mark Brown <broonie@kernel.org> wrote:
> On Wed, Apr 20, 2016 at 01:39:04AM +0300, Octavian Purdila wrote:
>
>> +     switch (value) {
>> +     case ACPI_RECONFIG_DEVICE_ADD:
>> +             master = acpi_spi_find_master_by_adev(adev->parent);
>> +             if (!master)
>> +                     break;
>> +
>> +             acpi_register_spi_device(master, adev);
>> +             put_device(&master->dev);
>> +             break;
>> +     case ACPI_RECONFIG_DEVICE_REMOVE:
>> +             spi = acpi_spi_find_device_by_adev(adev);
>> +             if (!spi)
>> +                     break;
>
> There's more code here now than I remember but this all looks *really*
> close to the DT code except for the OF_POPULATED flag that we set when
> things are instantiated in DT.  The duplication seems bad but the fact
> that we're missing the flag worries me...  do we have guarantees that
> ACPI won't double register?

We use the adev->flags.visited to check when a device has been already
enumerated, and we skip registering a new SPI slave in that case.

[toc] | [prev] | [next] | [standalone]


#1393382

FromMark Brown <broonie@kernel.org>
Date2016-05-03 14:30 +0200
Message-ID<ruHCF-86V-11@gated-at.bofh.it>
In reply to#1390481

[Multipart message — attachments visible in raw view] — view raw

On Thu, Apr 28, 2016 at 10:37:57PM +0300, Octavian Purdila wrote:
> On Thu, Apr 28, 2016 at 8:42 PM, Mark Brown <broonie@kernel.org> wrote:

> > There's more code here now than I remember but this all looks *really*
> > close to the DT code except for the OF_POPULATED flag that we set when
> > things are instantiated in DT.  The duplication seems bad but the fact
> > that we're missing the flag worries me...  do we have guarantees that
> > ACPI won't double register?

> We use the adev->flags.visited to check when a device has been already
> enumerated, and we skip registering a new SPI slave in that case.

OK, but the fact that I need to know that isn't exactly thrilling -
that's really the issue with the not quite duplication here.  It's not
just if the code works but also the maintainability.

[toc] | [prev] | [next] | [standalone]


#1394426 — Re: [RFC PATCH v2 06/10] spi: add support for ACPI reconfigure notifications

FromOctavian Purdila <octavian.purdila@intel.com>
Date2016-05-04 17:10 +0200
SubjectRe: [RFC PATCH v2 06/10] spi: add support for ACPI reconfigure notifications
Message-ID<rv6B3-6n8-13@gated-at.bofh.it>
In reply to#1393382
On Tue, May 3, 2016 at 3:19 PM, Mark Brown <broonie@kernel.org> wrote:
> On Thu, Apr 28, 2016 at 10:37:57PM +0300, Octavian Purdila wrote:
>> On Thu, Apr 28, 2016 at 8:42 PM, Mark Brown <broonie@kernel.org> wrote:
>
>> > There's more code here now than I remember but this all looks *really*
>> > close to the DT code except for the OF_POPULATED flag that we set when
>> > things are instantiated in DT.  The duplication seems bad but the fact
>> > that we're missing the flag worries me...  do we have guarantees that
>> > ACPI won't double register?
>
>> We use the adev->flags.visited to check when a device has been already
>> enumerated, and we skip registering a new SPI slave in that case.
>
> OK, but the fact that I need to know that isn't exactly thrilling -
> that's really the issue with the not quite duplication here.  It's not
> just if the code works but also the maintainability.

I agree that this is unfortunate. I could not find a common path for
both device tree and ACPI. Perhaps when we remove of_node from struct
device and move to fwnode we could remove some duplication.

I can add a couple of comments around  acpi_device_enumerated() and
adev->flags.visited = true; to make it clear that we won't double
enumerate. Will that help?

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web