* [PATCH] i2c: muxes: pca9541: use BIT() macro
@ 2019-09-05 13:13 Saiyam Doshi
2019-09-05 13:21 ` Guenter Roeck
0 siblings, 1 reply; 4+ messages in thread
From: Saiyam Doshi @ 2019-09-05 13:13 UTC (permalink / raw)
To: linux, peda; +Cc: linux-i2c, linux-kernel
Use bit mask macro BIT() for definition where appropriate.
Signed-off-by: Saiyam Doshi <saiyamdoshi.in@gmail.com>
---
drivers/i2c/muxes/i2c-mux-pca9541.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/drivers/i2c/muxes/i2c-mux-pca9541.c b/drivers/i2c/muxes/i2c-mux-pca9541.c
index 9e75d6b9140b..bd4cf8341a06 100644
--- a/drivers/i2c/muxes/i2c-mux-pca9541.c
+++ b/drivers/i2c/muxes/i2c-mux-pca9541.c
@@ -43,20 +43,20 @@
#define PCA9541_CONTROL 0x01
#define PCA9541_ISTAT 0x02
-#define PCA9541_CTL_MYBUS (1 << 0)
-#define PCA9541_CTL_NMYBUS (1 << 1)
-#define PCA9541_CTL_BUSON (1 << 2)
-#define PCA9541_CTL_NBUSON (1 << 3)
-#define PCA9541_CTL_BUSINIT (1 << 4)
-#define PCA9541_CTL_TESTON (1 << 6)
-#define PCA9541_CTL_NTESTON (1 << 7)
-
-#define PCA9541_ISTAT_INTIN (1 << 0)
-#define PCA9541_ISTAT_BUSINIT (1 << 1)
-#define PCA9541_ISTAT_BUSOK (1 << 2)
-#define PCA9541_ISTAT_BUSLOST (1 << 3)
-#define PCA9541_ISTAT_MYTEST (1 << 6)
-#define PCA9541_ISTAT_NMYTEST (1 << 7)
+#define PCA9541_CTL_MYBUS BIT(0)
+#define PCA9541_CTL_NMYBUS BIT(1)
+#define PCA9541_CTL_BUSON BIT(2)
+#define PCA9541_CTL_NBUSON BIT(3)
+#define PCA9541_CTL_BUSINIT BIT(4)
+#define PCA9541_CTL_TESTON BIT(6)
+#define PCA9541_CTL_NTESTON BIT(7)
+
+#define PCA9541_ISTAT_INTIN BIT(0)
+#define PCA9541_ISTAT_BUSINIT BIT(1)
+#define PCA9541_ISTAT_BUSOK BIT(2)
+#define PCA9541_ISTAT_BUSLOST BIT(3)
+#define PCA9541_ISTAT_MYTEST BIT(6)
+#define PCA9541_ISTAT_NMYTEST BIT(7)
#define BUSON (PCA9541_CTL_BUSON | PCA9541_CTL_NBUSON)
#define MYBUS (PCA9541_CTL_MYBUS | PCA9541_CTL_NMYBUS)
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] i2c: muxes: pca9541: use BIT() macro
2019-09-05 13:13 [PATCH] i2c: muxes: pca9541: use BIT() macro Saiyam Doshi
@ 2019-09-05 13:21 ` Guenter Roeck
2019-09-05 15:45 ` Saiyam Doshi
0 siblings, 1 reply; 4+ messages in thread
From: Guenter Roeck @ 2019-09-05 13:21 UTC (permalink / raw)
To: Saiyam Doshi, peda; +Cc: linux-i2c, linux-kernel
On 9/5/19 6:13 AM, Saiyam Doshi wrote:
> Use bit mask macro BIT() for definition where appropriate.
>
> Signed-off-by: Saiyam Doshi <saiyamdoshi.in@gmail.com>
linux/bitops.h should be included when using BIT().
Guenter
> ---
> drivers/i2c/muxes/i2c-mux-pca9541.c | 28 ++++++++++++++--------------
> 1 file changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/i2c/muxes/i2c-mux-pca9541.c b/drivers/i2c/muxes/i2c-mux-pca9541.c
> index 9e75d6b9140b..bd4cf8341a06 100644
> --- a/drivers/i2c/muxes/i2c-mux-pca9541.c
> +++ b/drivers/i2c/muxes/i2c-mux-pca9541.c
> @@ -43,20 +43,20 @@
> #define PCA9541_CONTROL 0x01
> #define PCA9541_ISTAT 0x02
>
> -#define PCA9541_CTL_MYBUS (1 << 0)
> -#define PCA9541_CTL_NMYBUS (1 << 1)
> -#define PCA9541_CTL_BUSON (1 << 2)
> -#define PCA9541_CTL_NBUSON (1 << 3)
> -#define PCA9541_CTL_BUSINIT (1 << 4)
> -#define PCA9541_CTL_TESTON (1 << 6)
> -#define PCA9541_CTL_NTESTON (1 << 7)
> -
> -#define PCA9541_ISTAT_INTIN (1 << 0)
> -#define PCA9541_ISTAT_BUSINIT (1 << 1)
> -#define PCA9541_ISTAT_BUSOK (1 << 2)
> -#define PCA9541_ISTAT_BUSLOST (1 << 3)
> -#define PCA9541_ISTAT_MYTEST (1 << 6)
> -#define PCA9541_ISTAT_NMYTEST (1 << 7)
> +#define PCA9541_CTL_MYBUS BIT(0)
> +#define PCA9541_CTL_NMYBUS BIT(1)
> +#define PCA9541_CTL_BUSON BIT(2)
> +#define PCA9541_CTL_NBUSON BIT(3)
> +#define PCA9541_CTL_BUSINIT BIT(4)
> +#define PCA9541_CTL_TESTON BIT(6)
> +#define PCA9541_CTL_NTESTON BIT(7)
> +
> +#define PCA9541_ISTAT_INTIN BIT(0)
> +#define PCA9541_ISTAT_BUSINIT BIT(1)
> +#define PCA9541_ISTAT_BUSOK BIT(2)
> +#define PCA9541_ISTAT_BUSLOST BIT(3)
> +#define PCA9541_ISTAT_MYTEST BIT(6)
> +#define PCA9541_ISTAT_NMYTEST BIT(7)
>
> #define BUSON (PCA9541_CTL_BUSON | PCA9541_CTL_NBUSON)
> #define MYBUS (PCA9541_CTL_MYBUS | PCA9541_CTL_NMYBUS)
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] i2c: muxes: pca9541: use BIT() macro
2019-09-05 13:21 ` Guenter Roeck
@ 2019-09-05 15:45 ` Saiyam Doshi
2019-09-05 16:53 ` Guenter Roeck
0 siblings, 1 reply; 4+ messages in thread
From: Saiyam Doshi @ 2019-09-05 15:45 UTC (permalink / raw)
To: Guenter Roeck; +Cc: peda, linux-i2c, linux-kernel
On Thu, Sep 05, 2019 at 06:21:06AM -0700, Guenter Roeck wrote:
> linux/bitops.h should be included when using BIT().
It's included from linux/i2c-mux.h and it compiled successfully.
But if it's needed I'll update the patch and resend.
Just a question - What is the best practice in such case? Should the
header included explicitly?
-Saiyam
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] i2c: muxes: pca9541: use BIT() macro
2019-09-05 15:45 ` Saiyam Doshi
@ 2019-09-05 16:53 ` Guenter Roeck
0 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2019-09-05 16:53 UTC (permalink / raw)
To: Saiyam Doshi; +Cc: peda, linux-i2c, linux-kernel
On Thu, Sep 05, 2019 at 09:15:36PM +0530, Saiyam Doshi wrote:
> On Thu, Sep 05, 2019 at 06:21:06AM -0700, Guenter Roeck wrote:
> > linux/bitops.h should be included when using BIT().
>
> It's included from linux/i2c-mux.h and it compiled successfully.
> But if it's needed I'll update the patch and resend.
>
> Just a question - What is the best practice in such case? Should the
> header included explicitly?
>
process/submit-checklist.rst says, as very first point:
1) If you use a facility then #include the file that defines/declares
that facility. Don't depend on other header files pulling in ones
that you use.
Guenter
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-09-05 16:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-05 13:13 [PATCH] i2c: muxes: pca9541: use BIT() macro Saiyam Doshi
2019-09-05 13:21 ` Guenter Roeck
2019-09-05 15:45 ` Saiyam Doshi
2019-09-05 16:53 ` Guenter Roeck
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).