diff mbox series

i2c-amd756: share definition of amd756_smbus

Message ID 20191220105954.382490-1-ben.dooks@codethink.co.uk
State New
Headers show
Series i2c-amd756: share definition of amd756_smbus | expand

Commit Message

Ben Dooks Dec. 20, 2019, 10:59 a.m. UTC
Add a shared header to declare amd756_smbus that is used
by two files, to remove the following sparse warning:

drivers/i2c/busses/i2c-amd756.c:286:20: warning: symbol 'amd756_smbus' was not declared. Should it be static?

Signed-off-by: Ben Dooks (Codethink) <ben.dooks@codethink.co.uk>
---

Cc: Jean Delvare <jdelvare@suse.com>
Cc: linux-i2c@vger.kernel.org
---
 drivers/i2c/busses/i2c-amd756-s4882.c | 2 +-
 drivers/i2c/busses/i2c-amd756.c       | 2 ++
 drivers/i2c/busses/i2c-amd756.h       | 4 ++++
 3 files changed, 7 insertions(+), 1 deletion(-)
 create mode 100644 drivers/i2c/busses/i2c-amd756.h

Comments

Jean Delvare April 15, 2020, 10:58 a.m. UTC | #1
Hi Ben,

On Fri, 20 Dec 2019 10:59:54 +0000, Ben Dooks (Codethink) wrote:
> Add a shared header to declare amd756_smbus that is used
> by two files, to remove the following sparse warning:
> 
> drivers/i2c/busses/i2c-amd756.c:286:20: warning: symbol 'amd756_smbus' was not declared. Should it be static?

I can't see this warning, not even with W=1. What did you do to see it?

> 
> Signed-off-by: Ben Dooks (Codethink) <ben.dooks@codethink.co.uk>
> ---
> 
> Cc: Jean Delvare <jdelvare@suse.com>
> Cc: linux-i2c@vger.kernel.org
> ---
>  drivers/i2c/busses/i2c-amd756-s4882.c | 2 +-
>  drivers/i2c/busses/i2c-amd756.c       | 2 ++
>  drivers/i2c/busses/i2c-amd756.h       | 4 ++++
>  3 files changed, 7 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/i2c/busses/i2c-amd756.h
> 
> diff --git a/drivers/i2c/busses/i2c-amd756-s4882.c b/drivers/i2c/busses/i2c-amd756-s4882.c
> index 063274388a75..741b9309d8b6 100644
> --- a/drivers/i2c/busses/i2c-amd756-s4882.c
> +++ b/drivers/i2c/busses/i2c-amd756-s4882.c
> @@ -27,7 +27,7 @@
>  #include <linux/i2c.h>
>  #include <linux/mutex.h>
>  
> -extern struct i2c_adapter amd756_smbus;
> +#include "i2c-amd756.h"
>  
>  static struct i2c_adapter *s4882_adapter;
>  static struct i2c_algorithm *s4882_algo;
> diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c
> index ef1307a258e9..86ee8d102d69 100644
> --- a/drivers/i2c/busses/i2c-amd756.c
> +++ b/drivers/i2c/busses/i2c-amd756.c
> @@ -32,6 +32,8 @@
>  #include <linux/acpi.h>
>  #include <linux/io.h>
>  
> +#include "i2c-amd756.h"
> +
>  /* AMD756 SMBus address offsets */
>  #define SMB_ADDR_OFFSET		0xE0
>  #define SMB_IOSIZE		16
> diff --git a/drivers/i2c/busses/i2c-amd756.h b/drivers/i2c/busses/i2c-amd756.h
> new file mode 100644
> index 000000000000..f3db35939b5c
> --- /dev/null
> +++ b/drivers/i2c/busses/i2c-amd756.h
> @@ -0,0 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/* Copyright (c) 2019 Ben Dooks <ben.dooks@codetrhink.co.uk> */
> +
> +extern struct i2c_adapter amd756_smbus;

Please add this new file to MAINTAINERS in section "I2C/SMBUS
CONTROLLER DRIVERS FOR PC".

If this driver needs this then i2c-nforce2 needs the same as it exposes
nforce2_smbus to i2c-nforce2-s4985 in the very same way.

Ideally both drivers would be reworked to use the standard I2C
multiplexing framework, then we could get rid of the extra
pseudo-drivers.
Ben Dooks April 20, 2020, 4:26 p.m. UTC | #2
On 15/04/2020 11:58, Jean Delvare wrote:
> Hi Ben,
> 
> On Fri, 20 Dec 2019 10:59:54 +0000, Ben Dooks (Codethink) wrote:
>> Add a shared header to declare amd756_smbus that is used
>> by two files, to remove the following sparse warning:
>>
>> drivers/i2c/busses/i2c-amd756.c:286:20: warning: symbol 'amd756_smbus' was not declared. Should it be static?
> 
> I can't see this warning, not even with W=1. What did you do to see it?

Was running C=1, looks like output from sparse.
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-amd756-s4882.c b/drivers/i2c/busses/i2c-amd756-s4882.c
index 063274388a75..741b9309d8b6 100644
--- a/drivers/i2c/busses/i2c-amd756-s4882.c
+++ b/drivers/i2c/busses/i2c-amd756-s4882.c
@@ -27,7 +27,7 @@ 
 #include <linux/i2c.h>
 #include <linux/mutex.h>
 
-extern struct i2c_adapter amd756_smbus;
+#include "i2c-amd756.h"
 
 static struct i2c_adapter *s4882_adapter;
 static struct i2c_algorithm *s4882_algo;
diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c
index ef1307a258e9..86ee8d102d69 100644
--- a/drivers/i2c/busses/i2c-amd756.c
+++ b/drivers/i2c/busses/i2c-amd756.c
@@ -32,6 +32,8 @@ 
 #include <linux/acpi.h>
 #include <linux/io.h>
 
+#include "i2c-amd756.h"
+
 /* AMD756 SMBus address offsets */
 #define SMB_ADDR_OFFSET		0xE0
 #define SMB_IOSIZE		16
diff --git a/drivers/i2c/busses/i2c-amd756.h b/drivers/i2c/busses/i2c-amd756.h
new file mode 100644
index 000000000000..f3db35939b5c
--- /dev/null
+++ b/drivers/i2c/busses/i2c-amd756.h
@@ -0,0 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0-or-later
+/* Copyright (c) 2019 Ben Dooks <ben.dooks@codetrhink.co.uk> */
+
+extern struct i2c_adapter amd756_smbus;