linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] i2c: mlxbf: Fix unused-variable warning
@ 2022-10-09 13:38 Ren Zhijie
  2022-10-10 12:00 ` Asmaa Mnebhi
  0 siblings, 1 reply; 4+ messages in thread
From: Ren Zhijie @ 2022-10-09 13:38 UTC (permalink / raw)
  To: kblaiech, asmaa, vadimp, wsa; +Cc: linux-i2c, linux-kernel, Ren Zhijie

If CONFIG_ACPI is not set,
gcc warns about unused variable:

drivers/i2c/busses/i2c-mlxbf.c:2206:35: error: ‘mlxbf_i2c_chip’ defined but not used [-Werror=unused-variable]
 static struct mlxbf_i2c_chip_info mlxbf_i2c_chip[] = {
                                   ^~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Mark these variables as __maybe_unused  to fix this.

Fixes: b5b5b32081cd ("i2c: mlxbf: I2C SMBus driver for Mellanox BlueField SoC")
Signed-off-by: Ren Zhijie <renzhijie2@huawei.com>
---
 drivers/i2c/busses/i2c-mlxbf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-mlxbf.c b/drivers/i2c/busses/i2c-mlxbf.c
index e68e775f187e..087df1a53797 100644
--- a/drivers/i2c/busses/i2c-mlxbf.c
+++ b/drivers/i2c/busses/i2c-mlxbf.c
@@ -2203,7 +2203,7 @@ static u32 mlxbf_i2c_functionality(struct i2c_adapter *adap)
 	return MLXBF_I2C_FUNC_ALL;
 }
 
-static struct mlxbf_i2c_chip_info mlxbf_i2c_chip[] = {
+static struct mlxbf_i2c_chip_info __maybe_unused mlxbf_i2c_chip[] = {
 	[MLXBF_I2C_CHIP_TYPE_1] = {
 		.type = MLXBF_I2C_CHIP_TYPE_1,
 		.shared_res = {
-- 
2.17.1


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

* RE: [PATCH -next] i2c: mlxbf: Fix unused-variable warning
  2022-10-09 13:38 [PATCH -next] i2c: mlxbf: Fix unused-variable warning Ren Zhijie
@ 2022-10-10 12:00 ` Asmaa Mnebhi
  2022-10-19 19:44   ` wsa
  0 siblings, 1 reply; 4+ messages in thread
From: Asmaa Mnebhi @ 2022-10-10 12:00 UTC (permalink / raw)
  To: Ren Zhijie, Khalil Blaiech, Vadim Pasternak, wsa; +Cc: linux-i2c, linux-kernel

Acked-by: Asmaa Mnebhi

-----Original Message-----
From: Ren Zhijie <renzhijie2@huawei.com> 
Sent: Sunday, October 9, 2022 9:38 AM
To: Khalil Blaiech <kblaiech@nvidia.com>; Asmaa Mnebhi <asmaa@nvidia.com>; Vadim Pasternak <vadimp@nvidia.com>; wsa@kernel.org
Cc: linux-i2c@vger.kernel.org; linux-kernel@vger.kernel.org; Ren Zhijie <renzhijie2@huawei.com>
Subject: [PATCH -next] i2c: mlxbf: Fix unused-variable warning

If CONFIG_ACPI is not set,
gcc warns about unused variable:

drivers/i2c/busses/i2c-mlxbf.c:2206:35: error: ‘mlxbf_i2c_chip’ defined but not used [-Werror=unused-variable]  static struct mlxbf_i2c_chip_info mlxbf_i2c_chip[] = {
                                   ^~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Mark these variables as __maybe_unused  to fix this.

Fixes: b5b5b32081cd ("i2c: mlxbf: I2C SMBus driver for Mellanox BlueField SoC")
Signed-off-by: Ren Zhijie <renzhijie2@huawei.com>
---
 drivers/i2c/busses/i2c-mlxbf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-mlxbf.c b/drivers/i2c/busses/i2c-mlxbf.c index e68e775f187e..087df1a53797 100644
--- a/drivers/i2c/busses/i2c-mlxbf.c
+++ b/drivers/i2c/busses/i2c-mlxbf.c
@@ -2203,7 +2203,7 @@ static u32 mlxbf_i2c_functionality(struct i2c_adapter *adap)
 	return MLXBF_I2C_FUNC_ALL;
 }
 
-static struct mlxbf_i2c_chip_info mlxbf_i2c_chip[] = {
+static struct mlxbf_i2c_chip_info __maybe_unused mlxbf_i2c_chip[] = {
 	[MLXBF_I2C_CHIP_TYPE_1] = {
 		.type = MLXBF_I2C_CHIP_TYPE_1,
 		.shared_res = {
--
2.17.1


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

* Re: [PATCH -next] i2c: mlxbf: Fix unused-variable warning
  2022-10-10 12:00 ` Asmaa Mnebhi
@ 2022-10-19 19:44   ` wsa
  2022-10-21  6:46     ` wsa
  0 siblings, 1 reply; 4+ messages in thread
From: wsa @ 2022-10-19 19:44 UTC (permalink / raw)
  To: Asmaa Mnebhi
  Cc: Ren Zhijie, Khalil Blaiech, Vadim Pasternak, linux-i2c, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 299 bytes --]

On Mon, Oct 10, 2022 at 12:00:09PM +0000, Asmaa Mnebhi wrote:
> Acked-by: Asmaa Mnebhi

You need to add your email address as well.

> If CONFIG_ACPI is not set,

Since DT support is gone now, shouldn't the driver actually depend on
ACPI now? Then, we could get rid of all the #ifdefs in the code?


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH -next] i2c: mlxbf: Fix unused-variable warning
  2022-10-19 19:44   ` wsa
@ 2022-10-21  6:46     ` wsa
  0 siblings, 0 replies; 4+ messages in thread
From: wsa @ 2022-10-21  6:46 UTC (permalink / raw)
  To: Asmaa Mnebhi, Ren Zhijie, Khalil Blaiech, Vadim Pasternak,
	linux-i2c, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 551 bytes --]

On Wed, Oct 19, 2022 at 09:44:21PM +0200, wsa@kernel.org wrote:
> On Mon, Oct 10, 2022 at 12:00:09PM +0000, Asmaa Mnebhi wrote:
> > Acked-by: Asmaa Mnebhi
> 
> You need to add your email address as well.
> 
> > If CONFIG_ACPI is not set,
> 
> Since DT support is gone now, shouldn't the driver actually depend on
> ACPI now? Then, we could get rid of all the #ifdefs in the code?

This has been submitted and accepted meanwhile:

http://patchwork.ozlabs.org/project/linux-i2c/patch/S229897AbiJTWqk/20221020224640Z+957@vger.kernel.org/


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2022-10-21  6:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-09 13:38 [PATCH -next] i2c: mlxbf: Fix unused-variable warning Ren Zhijie
2022-10-10 12:00 ` Asmaa Mnebhi
2022-10-19 19:44   ` wsa
2022-10-21  6:46     ` wsa

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).