From: Toshi Kani <toshi.kani@hpe.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: Ingo Molnar <mingo@kernel.org>, Borislav Petkov <bp@suse.de>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Andrew Morton <akpm@linux-foundation.org>,
"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>,
Linux ACPI <linux-acpi@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 4/4] ACPI: Change NFIT driver to insert new resource
Date: Thu, 03 Mar 2016 17:12:03 -0700 [thread overview]
Message-ID: <1457050323.15454.131.camel@hpe.com> (raw)
In-Reply-To: <CAPcyv4ibLoKSe06P4WTHiQ6x=hoTfEmCvVKGv9hJ4Z7++2PN-w@mail.gmail.com>
On Thu, 2016-03-03 at 14:49 -0800, Dan Williams wrote:
> On Wed, Mar 2, 2016 at 2:50 PM, Toshi Kani <toshi.kani@hpe.com> wrote:
:
> > diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c
> > index fb53db1..d97b53f 100644
> > --- a/drivers/acpi/nfit.c
> > +++ b/drivers/acpi/nfit.c
> > @@ -1571,6 +1571,30 @@ static int ars_status_process_records(struct
> > nvdimm_bus *nvdimm_bus,
> > return 0;
> > }
> >
> > +static int acpi_nfit_insert_resource(struct acpi_nfit_desc *acpi_desc,
> > + struct nd_region_desc *ndr_desc)
> > +{
> > + struct resource *res, *nd_res = ndr_desc->res;
> > + size_t size = nd_res->end - nd_res->start + 1;
> > +
> > + /* No operation if the region is already registered as PMEM */
> > + if (region_intersects(nd_res->start, size, IORESOURCE_MEM,
> > + IORES_DESC_PERSISTENT_MEMORY) ==
> > REGION_INTERSECTS)
> > + return 0;
> > +
> > + res = devm_kzalloc(acpi_desc->dev, sizeof(*res), GFP_KERNEL);
>
> How about allocating this resource on the stack and then have
> devm_insert_resource handle the dynamic allocation (memdup) so we have
> one less failure point to handle in the driver.
I like the idea, but existing callers of insert_resource() allocate a
resource either statically or dynamically. It may be contained by other
structure as well. So, I think devm_insert_resource() should be consistent
with insert_resource() on this regard.
Thanks,
-Toshi
--
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-03-03 23:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-02 22:50 [PATCH v2 0/4] Support persistent memory as reserved type in e820/EFI Toshi Kani
2016-03-02 22:50 ` [PATCH v2 1/4] resource: Change __request_region to inherit from immediate parent Toshi Kani
2016-03-02 22:50 ` [PATCH v2 2/4] resource: Add remove_resource interface Toshi Kani
2016-03-02 22:50 ` [PATCH v2 3/4] resource: Add device-managed insert/remove_resource() Toshi Kani
2016-03-03 22:45 ` Dan Williams
2016-03-03 23:48 ` Toshi Kani
2016-03-02 22:50 ` [PATCH v2 4/4] ACPI: Change NFIT driver to insert new resource Toshi Kani
2016-03-03 22:49 ` Dan Williams
2016-03-04 0:12 ` Toshi Kani [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=1457050323.15454.131.camel@hpe.com \
--to=toshi.kani@hpe.com \
--cc=akpm@linux-foundation.org \
--cc=bp@suse.de \
--cc=dan.j.williams@intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvdimm@lists.01.org \
--cc=mingo@kernel.org \
--cc=rjw@rjwysocki.net \
/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).