[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260113115753.63291-1-bartosz.golaszewski@oss.qualcomm.com>
Date: Tue, 13 Jan 2026 12:57:53 +0100
From: Bartosz Golaszewski <bartosz.golaszewski@....qualcomm.com>
To: Mauro Carvalho Chehab <mchehab@...nel.org>
Cc: linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@....qualcomm.com>,
Wolfram Sang <wsa+renesas@...g-engineering.com>
Subject: [PATCH] media: saa7134: rename i2c_dbg() to i2c_debug()
Ahead of introducing I2C-adapter-specific printk() helpers, preemptively
avoid a conflict with the upcoming i2c_dbg() and rename the local macro
in the saa7134 driver to i2c_debug().
Suggested-by: Wolfram Sang <wsa+renesas@...g-engineering.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@....qualcomm.com>
---
We've started working on changes to i2c core that should allow us to
eventually address the object-lifetime issues[1] in the subsystem. One of
the prerequisite steps is to hide all dereferences of struct device
embedded in struct i2c_adapter with dedicated wrappers. To that end, we
want to introduce a set of i2c_adapter-specific printk() helpers[2]. The
name i2c_dbg() conflicted with the macro defined in this driver[3].
Wolfram suggested[4] that since the i2c changes will not make v7.0, it's
worth renaming the macro here to free up the shorter name for a use-case
where there'll be a lot more users. It would be great if this could make
the v7.0 merge window.
[1] https://lore.kernel.org/all/aWYYZEPX-_1GfQtL@ninjato/
[2] https://lore.kernel.org/all/20251223-i2c-printk-helpers-v1-0-46a08306afdb@oss.qualcomm.com/
[3] https://lore.kernel.org/all/202512260206.C1TExj8d-lkp@intel.com/
[4] https://lore.kernel.org/all/aWYiJbtueA8g3srn@ninjato/
drivers/media/pci/saa7134/saa7134-i2c.c | 26 ++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/media/pci/saa7134/saa7134-i2c.c b/drivers/media/pci/saa7134/saa7134-i2c.c
index 04e85765373e..af83081b5437 100644
--- a/drivers/media/pci/saa7134/saa7134-i2c.c
+++ b/drivers/media/pci/saa7134/saa7134-i2c.c
@@ -28,7 +28,7 @@ static unsigned int i2c_scan;
module_param(i2c_scan, int, 0444);
MODULE_PARM_DESC(i2c_scan,"scan i2c bus at insmod time");
-#define i2c_dbg(level, fmt, arg...) do { \
+#define i2c_debug(level, fmt, arg...) do { \
if (i2c_debug == level) \
printk(KERN_DEBUG pr_fmt("i2c: " fmt), ## arg); \
} while (0)
@@ -84,20 +84,20 @@ static inline enum i2c_status i2c_get_status(struct saa7134_dev *dev)
enum i2c_status status;
status = saa_readb(SAA7134_I2C_ATTR_STATUS) & 0x0f;
- i2c_dbg(2, "i2c stat <= %s\n", str_i2c_status[status]);
+ i2c_debug(2, "i2c stat <= %s\n", str_i2c_status[status]);
return status;
}
static inline void i2c_set_status(struct saa7134_dev *dev,
enum i2c_status status)
{
- i2c_dbg(2, "i2c stat => %s\n", str_i2c_status[status]);
+ i2c_debug(2, "i2c stat => %s\n", str_i2c_status[status]);
saa_andorb(SAA7134_I2C_ATTR_STATUS,0x0f,status);
}
static inline void i2c_set_attr(struct saa7134_dev *dev, enum i2c_attr attr)
{
- i2c_dbg(2, "i2c attr => %s\n", str_i2c_attr[attr]);
+ i2c_debug(2, "i2c attr => %s\n", str_i2c_attr[attr]);
saa_andorb(SAA7134_I2C_ATTR_STATUS,0xc0,attr << 6);
}
@@ -160,7 +160,7 @@ static int i2c_reset(struct saa7134_dev *dev)
enum i2c_status status;
int count;
- i2c_dbg(2, "i2c reset\n");
+ i2c_debug(2, "i2c reset\n");
status = i2c_get_status(dev);
if (!i2c_is_error(status))
return true;
@@ -198,7 +198,7 @@ static inline int i2c_send_byte(struct saa7134_dev *dev,
// dword |= 0x40 << 16; /* 400 kHz */
dword |= 0xf0 << 24;
saa_writel(SAA7134_I2C_ATTR_STATUS >> 2, dword);
- i2c_dbg(2, "i2c data => 0x%x\n", data);
+ i2c_debug(2, "i2c data => 0x%x\n", data);
if (!i2c_is_busy_wait(dev))
return -EIO;
@@ -220,7 +220,7 @@ static inline int i2c_recv_byte(struct saa7134_dev *dev)
if (i2c_is_error(status))
return -EIO;
data = saa_readb(SAA7134_I2C_DATA);
- i2c_dbg(2, "i2c data <= 0x%x\n", data);
+ i2c_debug(2, "i2c data <= 0x%x\n", data);
return data;
}
@@ -237,12 +237,12 @@ static int saa7134_i2c_xfer(struct i2c_adapter *i2c_adap,
if (!i2c_reset(dev))
return -EIO;
- i2c_dbg(2, "start xfer\n");
- i2c_dbg(1, "i2c xfer:");
+ i2c_debug(2, "start xfer\n");
+ i2c_debug(1, "i2c xfer:");
for (i = 0; i < num; i++) {
if (!(msgs[i].flags & I2C_M_NOSTART) || 0 == i) {
/* send address */
- i2c_dbg(2, "send address\n");
+ i2c_debug(2, "send address\n");
addr = msgs[i].addr << 1;
if (msgs[i].flags & I2C_M_RD)
addr |= 1;
@@ -265,7 +265,7 @@ static int saa7134_i2c_xfer(struct i2c_adapter *i2c_adap,
}
if (msgs[i].flags & I2C_M_RD) {
/* read bytes */
- i2c_dbg(2, "read bytes\n");
+ i2c_debug(2, "read bytes\n");
for (byte = 0; byte < msgs[i].len; byte++) {
i2c_cont(1, " =");
rc = i2c_recv_byte(dev);
@@ -286,7 +286,7 @@ static int saa7134_i2c_xfer(struct i2c_adapter *i2c_adap,
}
} else {
/* write bytes */
- i2c_dbg(2, "write bytes\n");
+ i2c_debug(2, "write bytes\n");
for (byte = 0; byte < msgs[i].len; byte++) {
data = msgs[i].buf[byte];
i2c_cont(1, " %02x", data);
@@ -296,7 +296,7 @@ static int saa7134_i2c_xfer(struct i2c_adapter *i2c_adap,
}
}
}
- i2c_dbg(2, "xfer done\n");
+ i2c_debug(2, "xfer done\n");
i2c_cont(1, " >");
i2c_set_attr(dev,STOP);
rc = -EIO;
--
2.47.3
Powered by blists - more mailing lists