public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] acpi: nfit: add declaration in a local header
@ 2023-05-16 20:14 Arnd Bergmann
  2023-05-16 20:14 ` [PATCH 2/3] testing: nvdimm: add missing prototypes for wrapped functions Arnd Bergmann
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Arnd Bergmann @ 2023-05-16 20:14 UTC (permalink / raw)
  To: Dan Williams, Vishal Verma, Dave Jiang, Ira Weiny,
	Rafael J. Wysocki
  Cc: Arnd Bergmann, Len Brown, nvdimm, linux-acpi, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

The nfit_intel_shutdown_status() function has a __weak defintion
in nfit.c and an override in acpi_nfit_test.c for testing
purposes. This works without an extern declaration, but causes
a W=1 build warning:

drivers/acpi/nfit/core.c:1717:13: error: no previous prototype for 'nfit_intel_shutdown_status' [-Werror=missing-prototypes]

Add a declaration in a header that gets included from both
sides to shut up the warning and ensure that the prototypes
actually match.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/acpi/nfit/nfit.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/acpi/nfit/nfit.h b/drivers/acpi/nfit/nfit.h
index 6023ad61831a..573bc0de2990 100644
--- a/drivers/acpi/nfit/nfit.h
+++ b/drivers/acpi/nfit/nfit.h
@@ -347,4 +347,6 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm,
 void acpi_nfit_desc_init(struct acpi_nfit_desc *acpi_desc, struct device *dev);
 bool intel_fwa_supported(struct nvdimm_bus *nvdimm_bus);
 extern struct device_attribute dev_attr_firmware_activate_noidle;
+void nfit_intel_shutdown_status(struct nfit_mem *nfit_mem);
+
 #endif /* __NFIT_H__ */
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] testing: nvdimm: add missing prototypes for wrapped functions
  2023-05-16 20:14 [PATCH 1/3] acpi: nfit: add declaration in a local header Arnd Bergmann
@ 2023-05-16 20:14 ` Arnd Bergmann
  2023-05-22 15:22   ` Dave Jiang
  2023-05-16 20:14 ` [PATCH 3/3] libnvdimm: mark 'security_show' static again Arnd Bergmann
  2023-05-22 15:22 ` [PATCH 1/3] acpi: nfit: add declaration in a local header Dave Jiang
  2 siblings, 1 reply; 7+ messages in thread
From: Arnd Bergmann @ 2023-05-16 20:14 UTC (permalink / raw)
  To: Dan Williams, Vishal Verma, Dave Jiang, Ira Weiny
  Cc: Arnd Bergmann, nvdimm, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

The nvdimm test wraps a number of API functions, but these functions
don't have a prototype in a header because they are all called
by a different name:

drivers/nvdimm/../../tools/testing/nvdimm/test/iomap.c:74:15: error: no previous prototype for '__wrap_devm_ioremap' [-Werror=missing-prototypes]
   74 | void __iomem *__wrap_devm_ioremap(struct device *dev,
      |               ^~~~~~~~~~~~~~~~~~~
drivers/nvdimm/../../tools/testing/nvdimm/test/iomap.c:86:7: error: no previous prototype for '__wrap_devm_memremap' [-Werror=missing-prototypes]
   86 | void *__wrap_devm_memremap(struct device *dev, resource_size_t offset,
      |       ^~~~~~~~~~~~~~~~~~~~
...

Add prototypes to avoid the warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 tools/testing/nvdimm/test/nfit_test.h | 29 +++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/tools/testing/nvdimm/test/nfit_test.h b/tools/testing/nvdimm/test/nfit_test.h
index b5f7a996c4d0..b00583d1eace 100644
--- a/tools/testing/nvdimm/test/nfit_test.h
+++ b/tools/testing/nvdimm/test/nfit_test.h
@@ -207,7 +207,36 @@ typedef struct nfit_test_resource *(*nfit_test_lookup_fn)(resource_size_t);
 typedef union acpi_object *(*nfit_test_evaluate_dsm_fn)(acpi_handle handle,
 		 const guid_t *guid, u64 rev, u64 func,
 		 union acpi_object *argv4);
+void __iomem *__wrap_devm_ioremap(struct device *dev,
+		resource_size_t offset, unsigned long size);
+void *__wrap_devm_memremap(struct device *dev, resource_size_t offset,
+		size_t size, unsigned long flags);
+void *__wrap_devm_memremap_pages(struct device *dev, struct dev_pagemap *pgmap);
+pfn_t __wrap_phys_to_pfn_t(phys_addr_t addr, unsigned long flags);
+void *__wrap_memremap(resource_size_t offset, size_t size,
+		unsigned long flags);
+void __wrap_devm_memunmap(struct device *dev, void *addr);
+void __iomem *__wrap_ioremap(resource_size_t offset, unsigned long size);
+void __iomem *__wrap_ioremap_wc(resource_size_t offset, unsigned long size);
 void __wrap_iounmap(volatile void __iomem *addr);
+void __wrap_memunmap(void *addr);
+struct resource *__wrap___request_region(struct resource *parent,
+		resource_size_t start, resource_size_t n, const char *name,
+		int flags);
+int __wrap_insert_resource(struct resource *parent, struct resource *res);
+int __wrap_remove_resource(struct resource *res);
+struct resource *__wrap___devm_request_region(struct device *dev,
+		struct resource *parent, resource_size_t start,
+		resource_size_t n, const char *name);
+void __wrap___release_region(struct resource *parent, resource_size_t start,
+		resource_size_t n);
+void __wrap___devm_release_region(struct device *dev, struct resource *parent,
+		resource_size_t start, resource_size_t n);
+acpi_status __wrap_acpi_evaluate_object(acpi_handle handle, acpi_string path,
+		struct acpi_object_list *p, struct acpi_buffer *buf);
+union acpi_object * __wrap_acpi_evaluate_dsm(acpi_handle handle, const guid_t *guid,
+		u64 rev, u64 func, union acpi_object *argv4);
+
 void nfit_test_setup(nfit_test_lookup_fn lookup,
 		nfit_test_evaluate_dsm_fn evaluate);
 void nfit_test_teardown(void);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] libnvdimm: mark 'security_show' static again
  2023-05-16 20:14 [PATCH 1/3] acpi: nfit: add declaration in a local header Arnd Bergmann
  2023-05-16 20:14 ` [PATCH 2/3] testing: nvdimm: add missing prototypes for wrapped functions Arnd Bergmann
@ 2023-05-16 20:14 ` Arnd Bergmann
  2023-05-22 15:22   ` Dave Jiang
  2023-05-22 15:22 ` [PATCH 1/3] acpi: nfit: add declaration in a local header Dave Jiang
  2 siblings, 1 reply; 7+ messages in thread
From: Arnd Bergmann @ 2023-05-16 20:14 UTC (permalink / raw)
  To: Dan Williams, Vishal Verma, Dave Jiang, Ira Weiny,
	Jonathan Cameron
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Hans de Goede, nvdimm,
	linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

The security_show() function was made global and __weak at some
point to allow overriding it. The override was removed later, but
it remains global, which causes a warning about the missing
declaration:

drivers/nvdimm/dimm_devs.c:352:9: error: no previous prototype for 'security_show'

This is also not an appropriate name for a global symbol in the
kernel, so just make it static again.

Fixes: 15a8348707ff ("libnvdimm: Introduce CONFIG_NVDIMM_SECURITY_TEST flag")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/nvdimm/dimm_devs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvdimm/dimm_devs.c b/drivers/nvdimm/dimm_devs.c
index 957f7c3d17ba..10c3cb6a574a 100644
--- a/drivers/nvdimm/dimm_devs.c
+++ b/drivers/nvdimm/dimm_devs.c
@@ -349,7 +349,7 @@ static ssize_t available_slots_show(struct device *dev,
 }
 static DEVICE_ATTR_RO(available_slots);
 
-ssize_t security_show(struct device *dev,
+static ssize_t security_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
 	struct nvdimm *nvdimm = to_nvdimm(dev);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] acpi: nfit: add declaration in a local header
  2023-05-16 20:14 [PATCH 1/3] acpi: nfit: add declaration in a local header Arnd Bergmann
  2023-05-16 20:14 ` [PATCH 2/3] testing: nvdimm: add missing prototypes for wrapped functions Arnd Bergmann
  2023-05-16 20:14 ` [PATCH 3/3] libnvdimm: mark 'security_show' static again Arnd Bergmann
@ 2023-05-22 15:22 ` Dave Jiang
  2023-06-05 17:07   ` Rafael J. Wysocki
  2 siblings, 1 reply; 7+ messages in thread
From: Dave Jiang @ 2023-05-22 15:22 UTC (permalink / raw)
  To: Arnd Bergmann, Dan Williams, Vishal Verma, Ira Weiny,
	Rafael J. Wysocki
  Cc: Arnd Bergmann, Len Brown, nvdimm, linux-acpi, linux-kernel



On 5/16/23 1:14 PM, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The nfit_intel_shutdown_status() function has a __weak defintion
> in nfit.c and an override in acpi_nfit_test.c for testing
> purposes. This works without an extern declaration, but causes
> a W=1 build warning:
> 
> drivers/acpi/nfit/core.c:1717:13: error: no previous prototype for 'nfit_intel_shutdown_status' [-Werror=missing-prototypes]
> 
> Add a declaration in a header that gets included from both
> sides to shut up the warning and ensure that the prototypes
> actually match.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Dave Jiang <dave.jiang@intel.com>

> ---
>   drivers/acpi/nfit/nfit.h | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/acpi/nfit/nfit.h b/drivers/acpi/nfit/nfit.h
> index 6023ad61831a..573bc0de2990 100644
> --- a/drivers/acpi/nfit/nfit.h
> +++ b/drivers/acpi/nfit/nfit.h
> @@ -347,4 +347,6 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm,
>   void acpi_nfit_desc_init(struct acpi_nfit_desc *acpi_desc, struct device *dev);
>   bool intel_fwa_supported(struct nvdimm_bus *nvdimm_bus);
>   extern struct device_attribute dev_attr_firmware_activate_noidle;
> +void nfit_intel_shutdown_status(struct nfit_mem *nfit_mem);
> +
>   #endif /* __NFIT_H__ */

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] testing: nvdimm: add missing prototypes for wrapped functions
  2023-05-16 20:14 ` [PATCH 2/3] testing: nvdimm: add missing prototypes for wrapped functions Arnd Bergmann
@ 2023-05-22 15:22   ` Dave Jiang
  0 siblings, 0 replies; 7+ messages in thread
From: Dave Jiang @ 2023-05-22 15:22 UTC (permalink / raw)
  To: Arnd Bergmann, Dan Williams, Vishal Verma, Ira Weiny
  Cc: Arnd Bergmann, nvdimm, linux-kernel



On 5/16/23 1:14 PM, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The nvdimm test wraps a number of API functions, but these functions
> don't have a prototype in a header because they are all called
> by a different name:
> 
> drivers/nvdimm/../../tools/testing/nvdimm/test/iomap.c:74:15: error: no previous prototype for '__wrap_devm_ioremap' [-Werror=missing-prototypes]
>     74 | void __iomem *__wrap_devm_ioremap(struct device *dev,
>        |               ^~~~~~~~~~~~~~~~~~~
> drivers/nvdimm/../../tools/testing/nvdimm/test/iomap.c:86:7: error: no previous prototype for '__wrap_devm_memremap' [-Werror=missing-prototypes]
>     86 | void *__wrap_devm_memremap(struct device *dev, resource_size_t offset,
>        |       ^~~~~~~~~~~~~~~~~~~~
> ...
> 
> Add prototypes to avoid the warning.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>

> ---
>   tools/testing/nvdimm/test/nfit_test.h | 29 +++++++++++++++++++++++++++
>   1 file changed, 29 insertions(+)
> 
> diff --git a/tools/testing/nvdimm/test/nfit_test.h b/tools/testing/nvdimm/test/nfit_test.h
> index b5f7a996c4d0..b00583d1eace 100644
> --- a/tools/testing/nvdimm/test/nfit_test.h
> +++ b/tools/testing/nvdimm/test/nfit_test.h
> @@ -207,7 +207,36 @@ typedef struct nfit_test_resource *(*nfit_test_lookup_fn)(resource_size_t);
>   typedef union acpi_object *(*nfit_test_evaluate_dsm_fn)(acpi_handle handle,
>   		 const guid_t *guid, u64 rev, u64 func,
>   		 union acpi_object *argv4);
> +void __iomem *__wrap_devm_ioremap(struct device *dev,
> +		resource_size_t offset, unsigned long size);
> +void *__wrap_devm_memremap(struct device *dev, resource_size_t offset,
> +		size_t size, unsigned long flags);
> +void *__wrap_devm_memremap_pages(struct device *dev, struct dev_pagemap *pgmap);
> +pfn_t __wrap_phys_to_pfn_t(phys_addr_t addr, unsigned long flags);
> +void *__wrap_memremap(resource_size_t offset, size_t size,
> +		unsigned long flags);
> +void __wrap_devm_memunmap(struct device *dev, void *addr);
> +void __iomem *__wrap_ioremap(resource_size_t offset, unsigned long size);
> +void __iomem *__wrap_ioremap_wc(resource_size_t offset, unsigned long size);
>   void __wrap_iounmap(volatile void __iomem *addr);
> +void __wrap_memunmap(void *addr);
> +struct resource *__wrap___request_region(struct resource *parent,
> +		resource_size_t start, resource_size_t n, const char *name,
> +		int flags);
> +int __wrap_insert_resource(struct resource *parent, struct resource *res);
> +int __wrap_remove_resource(struct resource *res);
> +struct resource *__wrap___devm_request_region(struct device *dev,
> +		struct resource *parent, resource_size_t start,
> +		resource_size_t n, const char *name);
> +void __wrap___release_region(struct resource *parent, resource_size_t start,
> +		resource_size_t n);
> +void __wrap___devm_release_region(struct device *dev, struct resource *parent,
> +		resource_size_t start, resource_size_t n);
> +acpi_status __wrap_acpi_evaluate_object(acpi_handle handle, acpi_string path,
> +		struct acpi_object_list *p, struct acpi_buffer *buf);
> +union acpi_object * __wrap_acpi_evaluate_dsm(acpi_handle handle, const guid_t *guid,
> +		u64 rev, u64 func, union acpi_object *argv4);
> +
>   void nfit_test_setup(nfit_test_lookup_fn lookup,
>   		nfit_test_evaluate_dsm_fn evaluate);
>   void nfit_test_teardown(void);

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/3] libnvdimm: mark 'security_show' static again
  2023-05-16 20:14 ` [PATCH 3/3] libnvdimm: mark 'security_show' static again Arnd Bergmann
@ 2023-05-22 15:22   ` Dave Jiang
  0 siblings, 0 replies; 7+ messages in thread
From: Dave Jiang @ 2023-05-22 15:22 UTC (permalink / raw)
  To: Arnd Bergmann, Dan Williams, Vishal Verma, Ira Weiny,
	Jonathan Cameron
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Hans de Goede, nvdimm,
	linux-kernel



On 5/16/23 1:14 PM, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The security_show() function was made global and __weak at some
> point to allow overriding it. The override was removed later, but
> it remains global, which causes a warning about the missing
> declaration:
> 
> drivers/nvdimm/dimm_devs.c:352:9: error: no previous prototype for 'security_show'
> 
> This is also not an appropriate name for a global symbol in the
> kernel, so just make it static again.
> 
> Fixes: 15a8348707ff ("libnvdimm: Introduce CONFIG_NVDIMM_SECURITY_TEST flag")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> ---
>   drivers/nvdimm/dimm_devs.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/nvdimm/dimm_devs.c b/drivers/nvdimm/dimm_devs.c
> index 957f7c3d17ba..10c3cb6a574a 100644
> --- a/drivers/nvdimm/dimm_devs.c
> +++ b/drivers/nvdimm/dimm_devs.c
> @@ -349,7 +349,7 @@ static ssize_t available_slots_show(struct device *dev,
>   }
>   static DEVICE_ATTR_RO(available_slots);
>   
> -ssize_t security_show(struct device *dev,
> +static ssize_t security_show(struct device *dev,
>   		struct device_attribute *attr, char *buf)
>   {
>   	struct nvdimm *nvdimm = to_nvdimm(dev);

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] acpi: nfit: add declaration in a local header
  2023-05-22 15:22 ` [PATCH 1/3] acpi: nfit: add declaration in a local header Dave Jiang
@ 2023-06-05 17:07   ` Rafael J. Wysocki
  0 siblings, 0 replies; 7+ messages in thread
From: Rafael J. Wysocki @ 2023-06-05 17:07 UTC (permalink / raw)
  To: Dave Jiang, Arnd Bergmann
  Cc: Dan Williams, Vishal Verma, Ira Weiny, Rafael J. Wysocki,
	Arnd Bergmann, Len Brown, nvdimm, linux-acpi, linux-kernel

On Mon, May 22, 2023 at 5:22 PM Dave Jiang <dave.jiang@intel.com> wrote:
>
>
>
> On 5/16/23 1:14 PM, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > The nfit_intel_shutdown_status() function has a __weak defintion
> > in nfit.c and an override in acpi_nfit_test.c for testing
> > purposes. This works without an extern declaration, but causes
> > a W=1 build warning:
> >
> > drivers/acpi/nfit/core.c:1717:13: error: no previous prototype for 'nfit_intel_shutdown_status' [-Werror=missing-prototypes]
> >
> > Add a declaration in a header that gets included from both
> > sides to shut up the warning and ensure that the prototypes
> > actually match.
> >
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> Reviewed-by: Dave Jiang <dave.jiang@intel.com>

Applied as 6.5 material, thanks!

> > ---
> >   drivers/acpi/nfit/nfit.h | 2 ++
> >   1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/acpi/nfit/nfit.h b/drivers/acpi/nfit/nfit.h
> > index 6023ad61831a..573bc0de2990 100644
> > --- a/drivers/acpi/nfit/nfit.h
> > +++ b/drivers/acpi/nfit/nfit.h
> > @@ -347,4 +347,6 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm,
> >   void acpi_nfit_desc_init(struct acpi_nfit_desc *acpi_desc, struct device *dev);
> >   bool intel_fwa_supported(struct nvdimm_bus *nvdimm_bus);
> >   extern struct device_attribute dev_attr_firmware_activate_noidle;
> > +void nfit_intel_shutdown_status(struct nfit_mem *nfit_mem);
> > +
> >   #endif /* __NFIT_H__ */

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-06-05 17:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-16 20:14 [PATCH 1/3] acpi: nfit: add declaration in a local header Arnd Bergmann
2023-05-16 20:14 ` [PATCH 2/3] testing: nvdimm: add missing prototypes for wrapped functions Arnd Bergmann
2023-05-22 15:22   ` Dave Jiang
2023-05-16 20:14 ` [PATCH 3/3] libnvdimm: mark 'security_show' static again Arnd Bergmann
2023-05-22 15:22   ` Dave Jiang
2023-05-22 15:22 ` [PATCH 1/3] acpi: nfit: add declaration in a local header Dave Jiang
2023-06-05 17:07   ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox