[PATCH v3 11/14] serial: sc16is7xx: use KBUILD_MODNAME

Hugo Villeneuve posted 14 patches 1 month, 2 weeks ago
[PATCH v3 11/14] serial: sc16is7xx: use KBUILD_MODNAME
Posted by Hugo Villeneuve 1 month, 2 weeks ago
From: Hugo Villeneuve <hvilleneuve@dimonoff.com>

There is no need to redefine the driver name. Use KBUILD_MODNAME and get
rid of DRV_NAME altogether.

Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
---
 drivers/tty/serial/sc16is7xx.c     | 4 ++--
 drivers/tty/serial/sc16is7xx.h     | 1 -
 drivers/tty/serial/sc16is7xx_i2c.c | 4 ++--
 drivers/tty/serial/sc16is7xx_spi.c | 4 ++--
 4 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index c6d4ad8d84d16..644f4e9233dbc 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -361,7 +361,7 @@ static DEFINE_IDA(sc16is7xx_lines);
 
 static struct uart_driver sc16is7xx_uart = {
 	.owner		= THIS_MODULE,
-	.driver_name    = SC16IS7XX_NAME,
+	.driver_name    = KBUILD_MODNAME,
 	.dev_name	= "ttySC",
 	.nr		= SC16IS7XX_MAX_DEVS,
 };
@@ -1808,4 +1808,4 @@ module_exit(sc16is7xx_exit);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Jon Ringle <jringle@gridpoint.com>");
-MODULE_DESCRIPTION("SC16IS7xx tty serial core driver");
+MODULE_DESCRIPTION(KBUILD_MODNAME " tty serial core driver");
diff --git a/drivers/tty/serial/sc16is7xx.h b/drivers/tty/serial/sc16is7xx.h
index afb784eaee45b..9c584d6d35932 100644
--- a/drivers/tty/serial/sc16is7xx.h
+++ b/drivers/tty/serial/sc16is7xx.h
@@ -8,7 +8,6 @@
 #include <linux/regmap.h>
 #include <linux/types.h>
 
-#define SC16IS7XX_NAME		"sc16is7xx"
 #define SC16IS7XX_MAX_PORTS	2 /* Maximum number of UART ports per IC. */
 
 struct device;
diff --git a/drivers/tty/serial/sc16is7xx_i2c.c b/drivers/tty/serial/sc16is7xx_i2c.c
index cd7de9e057b85..699376c3b3a54 100644
--- a/drivers/tty/serial/sc16is7xx_i2c.c
+++ b/drivers/tty/serial/sc16is7xx_i2c.c
@@ -52,7 +52,7 @@ MODULE_DEVICE_TABLE(i2c, sc16is7xx_i2c_id_table);
 
 static struct i2c_driver sc16is7xx_i2c_driver = {
 	.driver = {
-		.name		= SC16IS7XX_NAME,
+		.name		= KBUILD_MODNAME,
 		.of_match_table	= sc16is7xx_dt_ids,
 	},
 	.probe		= sc16is7xx_i2c_probe,
@@ -63,5 +63,5 @@ static struct i2c_driver sc16is7xx_i2c_driver = {
 module_i2c_driver(sc16is7xx_i2c_driver);
 
 MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("SC16IS7xx I2C interface driver");
+MODULE_DESCRIPTION(KBUILD_MODNAME " interface driver");
 MODULE_IMPORT_NS("SERIAL_NXP_SC16IS7XX");
diff --git a/drivers/tty/serial/sc16is7xx_spi.c b/drivers/tty/serial/sc16is7xx_spi.c
index 20d736b657b17..7e76d0e38da7d 100644
--- a/drivers/tty/serial/sc16is7xx_spi.c
+++ b/drivers/tty/serial/sc16is7xx_spi.c
@@ -75,7 +75,7 @@ MODULE_DEVICE_TABLE(spi, sc16is7xx_spi_id_table);
 
 static struct spi_driver sc16is7xx_spi_driver = {
 	.driver = {
-		.name		= SC16IS7XX_NAME,
+		.name		= KBUILD_MODNAME,
 		.of_match_table	= sc16is7xx_dt_ids,
 	},
 	.probe		= sc16is7xx_spi_probe,
@@ -86,5 +86,5 @@ static struct spi_driver sc16is7xx_spi_driver = {
 module_spi_driver(sc16is7xx_spi_driver);
 
 MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("SC16IS7xx SPI interface driver");
+MODULE_DESCRIPTION(KBUILD_MODNAME " interface driver");
 MODULE_IMPORT_NS("SERIAL_NXP_SC16IS7XX");
-- 
2.39.5
Re: [PATCH v3 11/14] serial: sc16is7xx: use KBUILD_MODNAME
Posted by Andy Shevchenko 1 month, 2 weeks ago
On Mon, Oct 27, 2025 at 10:29:53AM -0400, Hugo Villeneuve wrote:
> 
> There is no need to redefine the driver name. Use KBUILD_MODNAME and get
> rid of DRV_NAME altogether.

Actually I am slightly against this change. The modname (and hence modalias)
are parts of an ABI (visible via sysfs). Changing the module name (file name
in this case) may inadvertently break this. Yes, it most likely not critical
in this case, but should be taken into account.

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH v3 11/14] serial: sc16is7xx: use KBUILD_MODNAME
Posted by Hugo Villeneuve 1 month, 2 weeks ago
On Thu, 30 Oct 2025 11:35:00 +0100
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:

> On Mon, Oct 27, 2025 at 10:29:53AM -0400, Hugo Villeneuve wrote:
> > 
> > There is no need to redefine the driver name. Use KBUILD_MODNAME and get
> > rid of DRV_NAME altogether.
> 
> Actually I am slightly against this change. The modname (and hence modalias)
> are parts of an ABI (visible via sysfs). Changing the module name (file name
> in this case) may inadvertently break this. Yes, it most likely not critical
> in this case, but should be taken into account.

Hi Andy,
thank you for pointing that out. It didn't occur to me that this could
impact the sysfs ABI.

Hugo.
Re: [PATCH v3 11/14] serial: sc16is7xx: use KBUILD_MODNAME
Posted by Greg KH 1 month, 2 weeks ago
On Thu, Oct 30, 2025 at 04:01:42PM -0400, Hugo Villeneuve wrote:
> On Thu, 30 Oct 2025 11:35:00 +0100
> Andy Shevchenko <andriy.shevchenko@intel.com> wrote:
> 
> > On Mon, Oct 27, 2025 at 10:29:53AM -0400, Hugo Villeneuve wrote:
> > > 
> > > There is no need to redefine the driver name. Use KBUILD_MODNAME and get
> > > rid of DRV_NAME altogether.
> > 
> > Actually I am slightly against this change. The modname (and hence modalias)
> > are parts of an ABI (visible via sysfs). Changing the module name (file name
> > in this case) may inadvertently break this. Yes, it most likely not critical
> > in this case, but should be taken into account.
> 
> Hi Andy,
> thank you for pointing that out. It didn't occur to me that this could
> impact the sysfs ABI.

This should not be an issue, the device name will not have changed, and
that's the normal sysfs path for things.  The module/driver name can
always change, this isn't a real problem.

thanks,

greg k-h