From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Will Deacon <will.deacon@arm.com>,
Robert Moore <robert.moore@intel.com>,
Robin Murphy <robin.murphy@arm.com>,
Hanjun Guo <hanjun.guo@linaro.org>, Feng Kan <fkan@apm.com>,
Jon Masters <jcm@redhat.com>, Zhang Rui <rui.zhang@intel.com>,
Nate Watterson <nwatters@codeaurora.org>
Subject: Re: [PATCH 2/4] ACPI: Make acpi_dev_get_resources() method agnostic
Date: Wed, 26 Jul 2017 02:23:10 +0200 [thread overview]
Message-ID: <3012251.02VKL2APyL@aspire.rjw.lan> (raw)
In-Reply-To: <20170725091538.GB17133@red-moon>
On Tuesday, July 25, 2017 10:15:38 AM Lorenzo Pieralisi wrote:
> On Sat, Jul 22, 2017 at 12:05:39AM +0200, Rafael J. Wysocki wrote:
> > On Thursday, July 20, 2017 03:45:14 PM Lorenzo Pieralisi wrote:
> > > The function acpi_dev_get_resources() is completely generic and
> > > can be used to parse resource objects that are not necessarily
> > > coming from the _CRS method but also from other objects eg _DMA
> > > that have the same _CRS resource format.
> > >
> > > Create an acpi_dev_get_resources() helper, internal to the ACPI
> > > resources parsing compilation unit, acpi_dev_get_resources_method(),
> > > that takes a char* parameter to detect which ACPI method should be
> > > called to retrieve the resources list and make acpi_dev_get_resources()
> > > call it with a method name _CRS leaving the API behaviour unchanged.
> > >
> > > Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> > > Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> > > ---
> > > drivers/acpi/resource.c | 54 +++++++++++++++++++++++++++++--------------------
> > > 1 file changed, 32 insertions(+), 22 deletions(-)
> > >
> > > diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
> > > index cd4c427..2b20a09 100644
> > > --- a/drivers/acpi/resource.c
> > > +++ b/drivers/acpi/resource.c
> > > @@ -573,6 +573,36 @@ static acpi_status acpi_dev_process_resource(struct acpi_resource *ares,
> > > return AE_OK;
> > > }
> > >
> > > +static
> > > +int acpi_dev_get_resources_method(struct acpi_device *adev,
> >
> > Do not break lines like this, please.
> >
> > It should be
> >
> > static int acpi_dev_get...
> >
> > Also I would call it differently, maybe simply __acpi_dev_get_resources()?
> >
> > > + struct list_head *list,
> > > + int (*preproc)(struct acpi_resource *, void *),
> > > + void *preproc_data, char *method)
> >
> > const char *method ?
>
> drivers/acpi/resource.c: In function '__acpi_dev_get_resources':
> drivers/acpi/resource.c:587:37: warning: passing argument 2 of
> 'acpi_has_method' discards 'const' qualifier from pointer target type
> [-Wdiscarded-qualifiers]
> if (!acpi_has_method(adev->handle, method))
> ^~~~~~
> In file included from ./include/linux/acpi.h:44:0,
> from drivers/acpi/resource.c:21:
> ./include/acpi/acpi_bus.h:55:6: note: expected 'char *'
> but argument is of type 'const char *'
> bool acpi_has_method(acpi_handle handle, char *name);
>
> Same problem with acpi_walk_resources().
>
> So either I fiddle (eg cast the const away) with the method string
> in __acpi_dev_get_resources() or I can add an int/bool to detect
> which method to use ( _CRS or _DMA) instead of passing a const char *.
No, that'd be overkill. Let's keep the (char *) in there.
Thanks,
Rafael
next prev parent reply other threads:[~2017-07-26 0:31 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-20 14:45 [PATCH 0/4] ACPI: DMA ranges management Lorenzo Pieralisi
2017-07-20 14:45 ` [PATCH 1/4] ACPI: Allow _DMA method in walk resources Lorenzo Pieralisi
2017-07-20 15:48 ` Moore, Robert
2017-07-20 15:50 ` Moore, Robert
2017-07-21 10:20 ` Lorenzo Pieralisi
2017-07-20 14:45 ` [PATCH 2/4] ACPI: Make acpi_dev_get_resources() method agnostic Lorenzo Pieralisi
2017-07-21 22:05 ` Rafael J. Wysocki
2017-07-24 9:22 ` Lorenzo Pieralisi
2017-07-25 9:15 ` Lorenzo Pieralisi
2017-07-26 0:23 ` Rafael J. Wysocki [this message]
2017-07-20 14:45 ` [PATCH 3/4] ACPI: Introduce DMA ranges parsing Lorenzo Pieralisi
2017-07-21 22:15 ` Rafael J. Wysocki
2017-07-24 10:40 ` Lorenzo Pieralisi
2017-07-24 18:42 ` Rafael J. Wysocki
2017-07-25 9:06 ` Lorenzo Pieralisi
2017-07-26 0:27 ` Rafael J. Wysocki
2017-07-20 14:45 ` [PATCH 4/4] ACPI: Make acpi_dma_configure() DMA regions aware Lorenzo Pieralisi
2017-07-26 14:46 ` [PATCH 0/4] ACPI: DMA ranges management Nate Watterson
2017-07-26 15:05 ` Robin Murphy
2017-07-26 15:35 ` Lorenzo Pieralisi
2017-07-26 16:39 ` Nate Watterson
2017-07-28 13:08 ` Robin Murphy
2017-07-28 14:09 ` Lorenzo Pieralisi
2017-07-28 15:55 ` Robin Murphy
2017-07-31 8:56 ` Lorenzo Pieralisi
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=3012251.02VKL2APyL@aspire.rjw.lan \
--to=rjw@rjwysocki.net \
--cc=fkan@apm.com \
--cc=hanjun.guo@linaro.org \
--cc=jcm@redhat.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=nwatters@codeaurora.org \
--cc=robert.moore@intel.com \
--cc=robin.murphy@arm.com \
--cc=rui.zhang@intel.com \
--cc=will.deacon@arm.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®