Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1741409ybn; Thu, 26 Sep 2019 01:16:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqwCDdbG3NZkff8bjg0J2nmaX8wriPfupLzUcfNRm1nC11NJ7ndBMM3RmRwZxDfMjx+p8P25 X-Received: by 2002:a05:6402:13c2:: with SMTP id a2mr2165319edx.21.1569485819429; Thu, 26 Sep 2019 01:16:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569485819; cv=none; d=google.com; s=arc-20160816; b=wN+IPpCxGWDvPqmh+soRfYSgylPoUCYXX0/tmn6wgl9WDAGLo+o4AZ88WkZdNjIFhl h775ep+tP/cNBHhLUSO1BonUnkR4objZI+jPVDy+YTVPb07qrmAoYwj9VypQ3cZjChm6 u3JlaO2Kc2Biy5W/9MiHu00F2IMkyS9SkA0deZqUXPh8nzTHhQrc+FyNjksAK0DvnMlb sLi7LjWKttlMYUs7ci+ztV9Y4RcJm/MLjyCHM1vBNXf+Nqga9Dve8WplLXV76gA3ygnv f+2162klpkmc/hFUDOPM+xRBBNrhBxa+V5mu5l3BADekM7qWaz1I/GQWvpvWGTYgHayw DQrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=/pTPMHL330moRNE+KboT/lMHdfShkyIDpbqUy7tyrZE=; b=k2+4qgREVyIKpL0sO9Ko/fQ59hz1UFTiuJ6o1cD+++xeBzMdR+j1WTNh5S4zxDjXuU fXrYyG8ct7jEzL9O3jBUDBGOjmGbuo0+wI0B0xQhzwlNUfd4OPBYN5VFn+4NE8UiVPIs NvgKDRh/JnLPgf658dWJGIHtUv5BFd50UhtcMc0wgPirqHHa11Cv3mnwWcvF6qDYxqRx nXR2RHRh5+Q20i6EnGa0U1A9gpuD39nr2D3QQLjlYEAZlFVIa+Dpla7j5x+0/GrZOOL+ fVRh6AlE7lvfJ5iCGRcjOynobn72YN74WblZrGVHDruqMRYGJnp7q3D42Ox2JpuYeVZw oXxg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b20si837692edc.359.2019.09.26.01.16.36; Thu, 26 Sep 2019 01:16:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388672AbfIXPLv (ORCPT + 99 others); Tue, 24 Sep 2019 11:11:51 -0400 Received: from mga05.intel.com ([192.55.52.43]:10456 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388243AbfIXPLv (ORCPT ); Tue, 24 Sep 2019 11:11:51 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Sep 2019 08:11:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,544,1559545200"; d="scan'208";a="213717849" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by fmsmga004.fm.intel.com with ESMTP; 24 Sep 2019 08:11:47 -0700 Received: from andy by smile with local (Exim 4.92.1) (envelope-from ) id 1iCmTi-0004kt-8w; Tue, 24 Sep 2019 18:11:46 +0300 Date: Tue, 24 Sep 2019 18:11:46 +0300 From: Andy Shevchenko To: Nikolaus Voss Cc: "Schmauss, Erik" , "Rafael J. Wysocki" , "Moore, Robert" , Len Brown , Jacek Anaszewski , Pavel Machek , Dan Murphy , linux-acpi@vger.kernel.org, devel@acpica.org, linux-kernel@vger.kernel.org, nv@vosn.de Subject: Re: [PATCH] ACPICA: Introduce acpi_load_table_with_index() Message-ID: <20190924151146.GW2680@smile.fi.intel.com> References: <6851700.HULMXZj6Ep@kreacher> <20190923094701.24950-1-nikolaus.voss@loewensteinmedical.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190923094701.24950-1-nikolaus.voss@loewensteinmedical.de> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 23, 2019 at 11:47:01AM +0200, Nikolaus Voss wrote: > For unloading an ACPI table, it is necessary to provide the > index of the table. The method intended for dynamically > loading or hotplug addition of tables, acpi_load_table(), > does not provide this information, so a new function > acpi_load_table_with_index() with the same functionality, > but an optional pointer to the loaded table index is introduced. > > The new function is used in the acpi_configfs driver to save the > index of the newly loaded table in order to unload it later. > Tested-by: Andy Shevchenko But consider addressing my comments in one of previous mails. > Reported-by: Andy Shevchenko > Fixes: d06c47e3dd07f ("ACPI: configfs: Resolve objects on host-directed table loads") > Signed-off-by: Nikolaus Voss > --- > drivers/acpi/acpi_configfs.c | 2 +- > drivers/acpi/acpica/tbxfload.c | 43 ++++++++++++++++++++++++++++++++++ > include/acpi/acpixf.h | 6 +++++ > 3 files changed, 50 insertions(+), 1 deletion(-) > > diff --git a/drivers/acpi/acpi_configfs.c b/drivers/acpi/acpi_configfs.c > index 57d9d574d4dd..9e77d5a266c0 100644 > --- a/drivers/acpi/acpi_configfs.c > +++ b/drivers/acpi/acpi_configfs.c > @@ -53,7 +53,7 @@ static ssize_t acpi_table_aml_write(struct config_item *cfg, > if (!table->header) > return -ENOMEM; > > - ret = acpi_load_table(table->header); > + ret = acpi_load_table_with_index(table->header, &table->index); > if (ret) { > kfree(table->header); > table->header = NULL; > diff --git a/drivers/acpi/acpica/tbxfload.c b/drivers/acpi/acpica/tbxfload.c > index 86f1693f6d29..7ea4fc879cb6 100644 > --- a/drivers/acpi/acpica/tbxfload.c > +++ b/drivers/acpi/acpica/tbxfload.c > @@ -309,6 +309,49 @@ acpi_status acpi_load_table(struct acpi_table_header *table) > > ACPI_EXPORT_SYMBOL(acpi_load_table) > > +/******************************************************************************* > + * > + * FUNCTION: acpi_load_table_with_index > + * > + * PARAMETERS: table - Pointer to a buffer containing the ACPI > + * table to be loaded. > + * table_idx - Pointer to a u32 for storing the table > + * index, might be NULL > + * RETURN: Status > + * > + * DESCRIPTION: see acpi_load_table() above. Additionally returns the index > + * of the newly created table in table_idx. > + * > + ******************************************************************************/ > +acpi_status acpi_load_table_with_index(struct acpi_table_header *table, > + u32 *table_idx) > +{ > + acpi_status status; > + u32 table_index; > + > + ACPI_FUNCTION_TRACE(acpi_load_table_with_index); > + > + /* Parameter validation */ > + if (!table) > + return_ACPI_STATUS(AE_BAD_PARAMETER); > + > + /* Install the table and load it into the namespace */ > + ACPI_INFO(("Host-directed Dynamic ACPI Table Load:")); > + status = acpi_tb_install_and_load_table( > + ACPI_PTR_TO_PHYSADDR(table), ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL, > + FALSE, &table_index); > + if (table_idx) > + *table_idx = table_index; > + > + if (ACPI_SUCCESS(status)) { > + /* Complete the initialization/resolution of new objects */ > + acpi_ns_initialize_objects(); > + } > + > + return_ACPI_STATUS(status); > +} > +ACPI_EXPORT_SYMBOL(acpi_load_table_with_index) > + > /******************************************************************************* > * > * FUNCTION: acpi_unload_parent_table > diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h > index e5e041413581..af375ab318de 100644 > --- a/include/acpi/acpixf.h > +++ b/include/acpi/acpixf.h > @@ -460,6 +460,12 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_INIT_FUNCTION > ACPI_EXTERNAL_RETURN_STATUS(acpi_status > acpi_load_table(struct acpi_table_header *table)) > > + > +ACPI_EXTERNAL_RETURN_STATUS(acpi_status > + acpi_load_table_with_index( > + struct acpi_table_header *table, > + u32 *table_idx)) > + > ACPI_EXTERNAL_RETURN_STATUS(acpi_status > acpi_unload_parent_table(acpi_handle object)) > > -- > 2.17.1 > -- With Best Regards, Andy Shevchenko