public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers: s390: hmcdrv_dev: remove commented out code
@ 2026-03-08 10:32 Jori Koolstra
  2026-03-08 11:04 ` Greg KH
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jori Koolstra @ 2026-03-08 10:32 UTC (permalink / raw)
  To: gregkh, Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle
  Cc: Jori Koolstra, Thomas Richter, Thorsten Blum,
	open list:S390 ARCHITECTURE, open list

The create_class() api is retiring in favor of class_register() (see:
https://lore.kernel.org/all/2023040244-duffel-pushpin-f738@gregkh/).
The HMCDRV_DEV_CLASS define is hiding a use of create_class(), but it is
permanently disabled as it is commented out. To avoid supporting code
that is disabled, the suggestion is to remove all code hiding be behind
any #ifdef HMCDRV_DEV_CLASS.

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
---
 drivers/s390/char/hmcdrv_dev.c | 114 +--------------------------------
 1 file changed, 1 insertion(+), 113 deletions(-)

diff --git a/drivers/s390/char/hmcdrv_dev.c b/drivers/s390/char/hmcdrv_dev.c
index 04b938c5357f..0d9c636df2c6 100644
--- a/drivers/s390/char/hmcdrv_dev.c
+++ b/drivers/s390/char/hmcdrv_dev.c
@@ -30,26 +30,12 @@
 #include "hmcdrv_dev.h"
 #include "hmcdrv_ftp.h"
 
-/* If the following macro is defined, then the HMC device creates it's own
- * separated device class (and dynamically assigns a major number). If not
- * defined then the HMC device is assigned to the "misc" class devices.
- *
-#define HMCDRV_DEV_CLASS "hmcftp"
- */
-
 #define HMCDRV_DEV_NAME  "hmcdrv"
 #define HMCDRV_DEV_BUSY_DELAY	 500 /* delay between -EBUSY trials in ms */
 #define HMCDRV_DEV_BUSY_RETRIES  3   /* number of retries on -EBUSY */
 
 struct hmcdrv_dev_node {
-
-#ifdef HMCDRV_DEV_CLASS
-	struct cdev dev; /* character device structure */
-	umode_t mode;	 /* mode of device node (unused, zero) */
-#else
 	struct miscdevice dev; /* "misc" device structure */
-#endif
-
 };
 
 static int hmcdrv_dev_open(struct inode *inode, struct file *fp);
@@ -75,38 +61,6 @@ static const struct file_operations hmcdrv_dev_fops = {
 
 static struct hmcdrv_dev_node hmcdrv_dev; /* HMC device struct (static) */
 
-#ifdef HMCDRV_DEV_CLASS
-
-static struct class *hmcdrv_dev_class; /* device class pointer */
-static dev_t hmcdrv_dev_no; /* device number (major/minor) */
-
-/**
- * hmcdrv_dev_name() - provides a naming hint for a device node in /dev
- * @dev: device for which the naming/mode hint is
- * @mode: file mode for device node created in /dev
- *
- * See: devtmpfs.c, function devtmpfs_create_node()
- *
- * Return: recommended device file name in /dev
- */
-static char *hmcdrv_dev_name(const struct device *dev, umode_t *mode)
-{
-	char *nodename = NULL;
-	const char *devname = dev_name(dev); /* kernel device name */
-
-	if (devname)
-		nodename = kasprintf(GFP_KERNEL, "%s", devname);
-
-	/* on device destroy (rmmod) the mode pointer may be NULL
-	 */
-	if (mode)
-		*mode = hmcdrv_dev.mode;
-
-	return nodename;
-}
-
-#endif	/* HMCDRV_DEV_CLASS */
-
 /*
  * open()
  */
@@ -276,67 +230,11 @@ static ssize_t hmcdrv_dev_write(struct file *fp, const char __user *ubuf,
  */
 int hmcdrv_dev_init(void)
 {
-	int rc;
-
-#ifdef HMCDRV_DEV_CLASS
-	struct device *dev;
-
-	rc = alloc_chrdev_region(&hmcdrv_dev_no, 0, 1, HMCDRV_DEV_NAME);
-
-	if (rc)
-		goto out_err;
-
-	cdev_init(&hmcdrv_dev.dev, &hmcdrv_dev_fops);
-	hmcdrv_dev.dev.owner = THIS_MODULE;
-	rc = cdev_add(&hmcdrv_dev.dev, hmcdrv_dev_no, 1);
-
-	if (rc)
-		goto out_unreg;
-
-	/* At this point the character device exists in the kernel (see
-	 * /proc/devices), but not under /dev nor /sys/devices/virtual. So
-	 * we have to create an associated class (see /sys/class).
-	 */
-	hmcdrv_dev_class = class_create(HMCDRV_DEV_CLASS);
-
-	if (IS_ERR(hmcdrv_dev_class)) {
-		rc = PTR_ERR(hmcdrv_dev_class);
-		goto out_devdel;
-	}
-
-	/* Finally a device node in /dev has to be established (as 'mkdev'
-	 * does from the command line). Notice that assignment of a device
-	 * node name/mode function is optional (only for mode != 0600).
-	 */
-	hmcdrv_dev.mode = 0; /* "unset" */
-	hmcdrv_dev_class->devnode = hmcdrv_dev_name;
-
-	dev = device_create(hmcdrv_dev_class, NULL, hmcdrv_dev_no, NULL,
-			    "%s", HMCDRV_DEV_NAME);
-	if (!IS_ERR(dev))
-		return 0;
-
-	rc = PTR_ERR(dev);
-	class_destroy(hmcdrv_dev_class);
-	hmcdrv_dev_class = NULL;
-
-out_devdel:
-	cdev_del(&hmcdrv_dev.dev);
-
-out_unreg:
-	unregister_chrdev_region(hmcdrv_dev_no, 1);
-
-out_err:
-
-#else  /* !HMCDRV_DEV_CLASS */
 	hmcdrv_dev.dev.minor = MISC_DYNAMIC_MINOR;
 	hmcdrv_dev.dev.name = HMCDRV_DEV_NAME;
 	hmcdrv_dev.dev.fops = &hmcdrv_dev_fops;
 	hmcdrv_dev.dev.mode = 0; /* finally produces 0600 */
-	rc = misc_register(&hmcdrv_dev.dev);
-#endif	/* HMCDRV_DEV_CLASS */
-
-	return rc;
+	return misc_register(&hmcdrv_dev.dev);
 }
 
 /**
@@ -344,15 +242,5 @@ int hmcdrv_dev_init(void)
  */
 void hmcdrv_dev_exit(void)
 {
-#ifdef HMCDRV_DEV_CLASS
-	if (!IS_ERR_OR_NULL(hmcdrv_dev_class)) {
-		device_destroy(hmcdrv_dev_class, hmcdrv_dev_no);
-		class_destroy(hmcdrv_dev_class);
-	}
-
-	cdev_del(&hmcdrv_dev.dev);
-	unregister_chrdev_region(hmcdrv_dev_no, 1);
-#else  /* !HMCDRV_DEV_CLASS */
 	misc_deregister(&hmcdrv_dev.dev);
-#endif	/* HMCDRV_DEV_CLASS */
 }

base-commit: d466c332e106fe666d1e2f5a24d08e308bebbfa1
-- 
2.53.0


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

* Re: [PATCH] drivers: s390: hmcdrv_dev: remove commented out code
  2026-03-08 10:32 [PATCH] drivers: s390: hmcdrv_dev: remove commented out code Jori Koolstra
@ 2026-03-08 11:04 ` Greg KH
  2026-03-16 13:20 ` Heiko Carstens
  2026-03-16 15:55 ` Vasily Gorbik
  2 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2026-03-08 11:04 UTC (permalink / raw)
  To: Jori Koolstra
  Cc: Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Thomas Richter,
	Thorsten Blum, open list:S390 ARCHITECTURE, open list

On Sun, Mar 08, 2026 at 11:32:51AM +0100, Jori Koolstra wrote:
> The create_class() api is retiring in favor of class_register() (see:
> https://lore.kernel.org/all/2023040244-duffel-pushpin-f738@gregkh/).
> The HMCDRV_DEV_CLASS define is hiding a use of create_class(), but it is
> permanently disabled as it is commented out. To avoid supporting code
> that is disabled, the suggestion is to remove all code hiding be behind
> any #ifdef HMCDRV_DEV_CLASS.
> 
> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
> ---
>  drivers/s390/char/hmcdrv_dev.c | 114 +--------------------------------
>  1 file changed, 1 insertion(+), 113 deletions(-)

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

* Re: [PATCH] drivers: s390: hmcdrv_dev: remove commented out code
  2026-03-08 10:32 [PATCH] drivers: s390: hmcdrv_dev: remove commented out code Jori Koolstra
  2026-03-08 11:04 ` Greg KH
@ 2026-03-16 13:20 ` Heiko Carstens
  2026-03-16 15:55 ` Vasily Gorbik
  2 siblings, 0 replies; 4+ messages in thread
From: Heiko Carstens @ 2026-03-16 13:20 UTC (permalink / raw)
  To: Jori Koolstra, Vasily Gorbik
  Cc: gregkh, Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
	Thomas Richter, Thorsten Blum, open list:S390 ARCHITECTURE,
	open list

On Sun, Mar 08, 2026 at 11:32:51AM +0100, Jori Koolstra wrote:
> The create_class() api is retiring in favor of class_register() (see:
> https://lore.kernel.org/all/2023040244-duffel-pushpin-f738@gregkh/).
> The HMCDRV_DEV_CLASS define is hiding a use of create_class(), but it is
> permanently disabled as it is commented out. To avoid supporting code
> that is disabled, the suggestion is to remove all code hiding be behind
> any #ifdef HMCDRV_DEV_CLASS.
> 
> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
> ---
>  drivers/s390/char/hmcdrv_dev.c | 114 +--------------------------------
>  1 file changed, 1 insertion(+), 113 deletions(-)

Reviewed-by: Heiko Carstens <hca@linux.ibm.com>

Vasily, will you pick this one up?

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

* Re: [PATCH] drivers: s390: hmcdrv_dev: remove commented out code
  2026-03-08 10:32 [PATCH] drivers: s390: hmcdrv_dev: remove commented out code Jori Koolstra
  2026-03-08 11:04 ` Greg KH
  2026-03-16 13:20 ` Heiko Carstens
@ 2026-03-16 15:55 ` Vasily Gorbik
  2 siblings, 0 replies; 4+ messages in thread
From: Vasily Gorbik @ 2026-03-16 15:55 UTC (permalink / raw)
  To: Jori Koolstra
  Cc: gregkh, Heiko Carstens, Alexander Gordeev, Christian Borntraeger,
	Sven Schnelle, Thomas Richter, Thorsten Blum,
	open list:S390 ARCHITECTURE, open list

On Sun, Mar 08, 2026 at 11:32:51AM +0100, Jori Koolstra wrote:
> The create_class() api is retiring in favor of class_register() (see:
> https://lore.kernel.org/all/2023040244-duffel-pushpin-f738@gregkh/).
> The HMCDRV_DEV_CLASS define is hiding a use of create_class(), but it is
> permanently disabled as it is commented out. To avoid supporting code
> that is disabled, the suggestion is to remove all code hiding be behind
> any #ifdef HMCDRV_DEV_CLASS.
> 
> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
> ---
>  drivers/s390/char/hmcdrv_dev.c | 114 +--------------------------------
>  1 file changed, 1 insertion(+), 113 deletions(-)

Applied, thank you!

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

end of thread, other threads:[~2026-03-16 15:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-08 10:32 [PATCH] drivers: s390: hmcdrv_dev: remove commented out code Jori Koolstra
2026-03-08 11:04 ` Greg KH
2026-03-16 13:20 ` Heiko Carstens
2026-03-16 15:55 ` Vasily Gorbik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox