linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] USB: phy: fsl-usb: remove sysfs abuse
@ 2020-07-02  7:29 Greg Kroah-Hartman
  2020-07-02  7:29 ` [PATCH 2/2] USB: phy: fsl-usb: remove character device usage Greg Kroah-Hartman
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Greg Kroah-Hartman @ 2020-07-02  7:29 UTC (permalink / raw)
  To: balbi; +Cc: linux-usb, linux-kernel, Greg Kroah-Hartman

This file has a HUGE debugging sysfs file that spews out a lot of
information all at once, which violates the one-value-per-file rule for
sysfs.  If this is really needed, it should go into debugfs, but given
the age of this driver, I strongly doubt anyone is using it anymore.

So just remove the file entirely, it was never documented, so obviously,
no one actually needed it :)

Cc: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/phy/phy-fsl-usb.c | 93 -----------------------------------
 1 file changed, 93 deletions(-)

diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c
index b451f4695f3f..93d2257aeec8 100644
--- a/drivers/usb/phy/phy-fsl-usb.c
+++ b/drivers/usb/phy/phy-fsl-usb.c
@@ -957,98 +957,6 @@ int usb_otg_start(struct platform_device *pdev)
 	return 0;
 }
 
-/*
- * state file in sysfs
- */
-static ssize_t show_fsl_usb2_otg_state(struct device *dev,
-				   struct device_attribute *attr, char *buf)
-{
-	struct otg_fsm *fsm = &fsl_otg_dev->fsm;
-	char *next = buf;
-	unsigned size = PAGE_SIZE;
-	int t;
-
-	mutex_lock(&fsm->lock);
-
-	/* basic driver infomation */
-	t = scnprintf(next, size,
-			DRIVER_DESC "\n" "fsl_usb2_otg version: %s\n\n",
-			DRIVER_VERSION);
-	size -= t;
-	next += t;
-
-	/* Registers */
-	t = scnprintf(next, size,
-			"OTGSC:   0x%08x\n"
-			"PORTSC:  0x%08x\n"
-			"USBMODE: 0x%08x\n"
-			"USBCMD:  0x%08x\n"
-			"USBSTS:  0x%08x\n"
-			"USBINTR: 0x%08x\n",
-			fsl_readl(&usb_dr_regs->otgsc),
-			fsl_readl(&usb_dr_regs->portsc),
-			fsl_readl(&usb_dr_regs->usbmode),
-			fsl_readl(&usb_dr_regs->usbcmd),
-			fsl_readl(&usb_dr_regs->usbsts),
-			fsl_readl(&usb_dr_regs->usbintr));
-	size -= t;
-	next += t;
-
-	/* State */
-	t = scnprintf(next, size,
-		      "OTG state: %s\n\n",
-		      usb_otg_state_string(fsl_otg_dev->phy.otg->state));
-	size -= t;
-	next += t;
-
-	/* State Machine Variables */
-	t = scnprintf(next, size,
-			"a_bus_req: %d\n"
-			"b_bus_req: %d\n"
-			"a_bus_resume: %d\n"
-			"a_bus_suspend: %d\n"
-			"a_conn: %d\n"
-			"a_sess_vld: %d\n"
-			"a_srp_det: %d\n"
-			"a_vbus_vld: %d\n"
-			"b_bus_resume: %d\n"
-			"b_bus_suspend: %d\n"
-			"b_conn: %d\n"
-			"b_se0_srp: %d\n"
-			"b_ssend_srp: %d\n"
-			"b_sess_vld: %d\n"
-			"id: %d\n",
-			fsm->a_bus_req,
-			fsm->b_bus_req,
-			fsm->a_bus_resume,
-			fsm->a_bus_suspend,
-			fsm->a_conn,
-			fsm->a_sess_vld,
-			fsm->a_srp_det,
-			fsm->a_vbus_vld,
-			fsm->b_bus_resume,
-			fsm->b_bus_suspend,
-			fsm->b_conn,
-			fsm->b_se0_srp,
-			fsm->b_ssend_srp,
-			fsm->b_sess_vld,
-			fsm->id);
-	size -= t;
-	next += t;
-
-	mutex_unlock(&fsm->lock);
-
-	return PAGE_SIZE - size;
-}
-
-static DEVICE_ATTR(fsl_usb2_otg_state, S_IRUGO, show_fsl_usb2_otg_state, NULL);
-
-static struct attribute *fsl_otg_attrs[] = {
-	&dev_attr_fsl_usb2_otg_state.attr,
-	NULL,
-};
-ATTRIBUTE_GROUPS(fsl_otg);
-
 /* Char driver interface to control some OTG input */
 
 /*
@@ -1167,7 +1075,6 @@ struct platform_driver fsl_otg_driver = {
 	.driver = {
 		.name = driver_name,
 		.owner = THIS_MODULE,
-		.dev_groups = fsl_otg_groups,
 	},
 };
 
-- 
2.27.0


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

* [PATCH 2/2] USB: phy: fsl-usb: remove character device usage
  2020-07-02  7:29 [PATCH 1/2] USB: phy: fsl-usb: remove sysfs abuse Greg Kroah-Hartman
@ 2020-07-02  7:29 ` Greg Kroah-Hartman
  2020-07-02  9:07   ` Peter Chen
  2020-07-02  9:07 ` [PATCH 1/2] USB: phy: fsl-usb: remove sysfs abuse Peter Chen
  2020-07-23 11:40 ` Felipe Balbi
  2 siblings, 1 reply; 9+ messages in thread
From: Greg Kroah-Hartman @ 2020-07-02  7:29 UTC (permalink / raw)
  To: balbi; +Cc: linux-usb, linux-kernel, Greg Kroah-Hartman

No idea why this driver is using a char device node, statically
allocated, with no dynamic allocation or hook up with devtmpfs, along
with a reserverd major number, for "special" operations, not all of
which ever were implemented.

So just rip it out, as no one must be using it because no modern system
will ever actually create the /dev/ node it needs.

Cc: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/phy/phy-fsl-usb.c | 69 -----------------------------------
 drivers/usb/phy/phy-fsl-usb.h | 14 -------
 2 files changed, 83 deletions(-)

diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c
index 93d2257aeec8..0c6d9f9f2994 100644
--- a/drivers/usb/phy/phy-fsl-usb.c
+++ b/drivers/usb/phy/phy-fsl-usb.c
@@ -957,67 +957,6 @@ int usb_otg_start(struct platform_device *pdev)
 	return 0;
 }
 
-/* Char driver interface to control some OTG input */
-
-/*
- * Handle some ioctl command, such as get otg
- * status and set host suspend
- */
-static long fsl_otg_ioctl(struct file *file, unsigned int cmd,
-			  unsigned long arg)
-{
-	u32 retval = 0;
-
-	switch (cmd) {
-	case GET_OTG_STATUS:
-		retval = fsl_otg_dev->host_working;
-		break;
-
-	case SET_A_SUSPEND_REQ:
-		fsl_otg_dev->fsm.a_suspend_req_inf = arg;
-		break;
-
-	case SET_A_BUS_DROP:
-		fsl_otg_dev->fsm.a_bus_drop = arg;
-		break;
-
-	case SET_A_BUS_REQ:
-		fsl_otg_dev->fsm.a_bus_req = arg;
-		break;
-
-	case SET_B_BUS_REQ:
-		fsl_otg_dev->fsm.b_bus_req = arg;
-		break;
-
-	default:
-		break;
-	}
-
-	otg_statemachine(&fsl_otg_dev->fsm);
-
-	return retval;
-}
-
-static int fsl_otg_open(struct inode *inode, struct file *file)
-{
-	return 0;
-}
-
-static int fsl_otg_release(struct inode *inode, struct file *file)
-{
-	return 0;
-}
-
-static const struct file_operations otg_fops = {
-	.owner = THIS_MODULE,
-	.llseek = NULL,
-	.read = NULL,
-	.write = NULL,
-	.unlocked_ioctl = fsl_otg_ioctl,
-	.open = fsl_otg_open,
-	.release = fsl_otg_release,
-};
-
 static int fsl_otg_probe(struct platform_device *pdev)
 {
 	int ret;
@@ -1039,12 +978,6 @@ static int fsl_otg_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	ret = register_chrdev(FSL_OTG_MAJOR, FSL_OTG_NAME, &otg_fops);
-	if (ret) {
-		dev_err(&pdev->dev, "unable to register FSL OTG device\n");
-		return ret;
-	}
-
 	return ret;
 }
 
@@ -1061,8 +994,6 @@ static int fsl_otg_remove(struct platform_device *pdev)
 	kfree(fsl_otg_dev->phy.otg);
 	kfree(fsl_otg_dev);
 
-	unregister_chrdev(FSL_OTG_MAJOR, FSL_OTG_NAME);
-
 	if (pdata->exit)
 		pdata->exit(pdev);
 
diff --git a/drivers/usb/phy/phy-fsl-usb.h b/drivers/usb/phy/phy-fsl-usb.h
index fbcc28ad9964..d70341ae5a92 100644
--- a/drivers/usb/phy/phy-fsl-usb.h
+++ b/drivers/usb/phy/phy-fsl-usb.h
@@ -371,21 +371,7 @@ struct fsl_otg_config {
 	u8 otg_port;
 };
 
-/* For SRP and HNP handle */
-#define FSL_OTG_MAJOR		240
 #define FSL_OTG_NAME		"fsl-usb2-otg"
-/* Command to OTG driver ioctl */
-#define OTG_IOCTL_MAGIC		FSL_OTG_MAJOR
-/* if otg work as host, it should return 1, otherwise return 0 */
-#define GET_OTG_STATUS		_IOR(OTG_IOCTL_MAGIC, 1, int)
-#define SET_A_SUSPEND_REQ	_IOW(OTG_IOCTL_MAGIC, 2, int)
-#define SET_A_BUS_DROP		_IOW(OTG_IOCTL_MAGIC, 3, int)
-#define SET_A_BUS_REQ		_IOW(OTG_IOCTL_MAGIC, 4, int)
-#define SET_B_BUS_REQ		_IOW(OTG_IOCTL_MAGIC, 5, int)
-#define GET_A_SUSPEND_REQ	_IOR(OTG_IOCTL_MAGIC, 6, int)
-#define GET_A_BUS_DROP		_IOR(OTG_IOCTL_MAGIC, 7, int)
-#define GET_A_BUS_REQ		_IOR(OTG_IOCTL_MAGIC, 8, int)
-#define GET_B_BUS_REQ		_IOR(OTG_IOCTL_MAGIC, 9, int)
 
 void fsl_otg_add_timer(struct otg_fsm *fsm, void *timer);
 void fsl_otg_del_timer(struct otg_fsm *fsm, void *timer);
-- 
2.27.0


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

* RE: [PATCH 1/2] USB: phy: fsl-usb: remove sysfs abuse
  2020-07-02  7:29 [PATCH 1/2] USB: phy: fsl-usb: remove sysfs abuse Greg Kroah-Hartman
  2020-07-02  7:29 ` [PATCH 2/2] USB: phy: fsl-usb: remove character device usage Greg Kroah-Hartman
@ 2020-07-02  9:07 ` Peter Chen
  2020-07-03  1:49   ` Ran Wang
  2020-07-23 11:40 ` Felipe Balbi
  2 siblings, 1 reply; 9+ messages in thread
From: Peter Chen @ 2020-07-02  9:07 UTC (permalink / raw)
  To: Greg Kroah-Hartman, balbi, Ran Wang, Leo Li; +Cc: linux-usb, linux-kernel

 
> 
> This file has a HUGE debugging sysfs file that spews out a lot of information all at
> once, which violates the one-value-per-file rule for sysfs.  If this is really needed, it
> should go into debugfs, but given the age of this driver, I strongly doubt anyone is
> using it anymore.
> 
> So just remove the file entirely, it was never documented, so obviously, no one
> actually needed it :)
> 


Add related people from NXP.

Peter

> Cc: Felipe Balbi <balbi@kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  drivers/usb/phy/phy-fsl-usb.c | 93 -----------------------------------
>  1 file changed, 93 deletions(-)
> 
> diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c index
> b451f4695f3f..93d2257aeec8 100644
> --- a/drivers/usb/phy/phy-fsl-usb.c
> +++ b/drivers/usb/phy/phy-fsl-usb.c
> @@ -957,98 +957,6 @@ int usb_otg_start(struct platform_device *pdev)
>  	return 0;
>  }
> 
> -/*
> - * state file in sysfs
> - */
> -static ssize_t show_fsl_usb2_otg_state(struct device *dev,
> -				   struct device_attribute *attr, char *buf)
> -{
> -	struct otg_fsm *fsm = &fsl_otg_dev->fsm;
> -	char *next = buf;
> -	unsigned size = PAGE_SIZE;
> -	int t;
> -
> -	mutex_lock(&fsm->lock);
> -
> -	/* basic driver infomation */
> -	t = scnprintf(next, size,
> -			DRIVER_DESC "\n" "fsl_usb2_otg version: %s\n\n",
> -			DRIVER_VERSION);
> -	size -= t;
> -	next += t;
> -
> -	/* Registers */
> -	t = scnprintf(next, size,
> -			"OTGSC:   0x%08x\n"
> -			"PORTSC:  0x%08x\n"
> -			"USBMODE: 0x%08x\n"
> -			"USBCMD:  0x%08x\n"
> -			"USBSTS:  0x%08x\n"
> -			"USBINTR: 0x%08x\n",
> -			fsl_readl(&usb_dr_regs->otgsc),
> -			fsl_readl(&usb_dr_regs->portsc),
> -			fsl_readl(&usb_dr_regs->usbmode),
> -			fsl_readl(&usb_dr_regs->usbcmd),
> -			fsl_readl(&usb_dr_regs->usbsts),
> -			fsl_readl(&usb_dr_regs->usbintr));
> -	size -= t;
> -	next += t;
> -
> -	/* State */
> -	t = scnprintf(next, size,
> -		      "OTG state: %s\n\n",
> -		      usb_otg_state_string(fsl_otg_dev->phy.otg->state));
> -	size -= t;
> -	next += t;
> -
> -	/* State Machine Variables */
> -	t = scnprintf(next, size,
> -			"a_bus_req: %d\n"
> -			"b_bus_req: %d\n"
> -			"a_bus_resume: %d\n"
> -			"a_bus_suspend: %d\n"
> -			"a_conn: %d\n"
> -			"a_sess_vld: %d\n"
> -			"a_srp_det: %d\n"
> -			"a_vbus_vld: %d\n"
> -			"b_bus_resume: %d\n"
> -			"b_bus_suspend: %d\n"
> -			"b_conn: %d\n"
> -			"b_se0_srp: %d\n"
> -			"b_ssend_srp: %d\n"
> -			"b_sess_vld: %d\n"
> -			"id: %d\n",
> -			fsm->a_bus_req,
> -			fsm->b_bus_req,
> -			fsm->a_bus_resume,
> -			fsm->a_bus_suspend,
> -			fsm->a_conn,
> -			fsm->a_sess_vld,
> -			fsm->a_srp_det,
> -			fsm->a_vbus_vld,
> -			fsm->b_bus_resume,
> -			fsm->b_bus_suspend,
> -			fsm->b_conn,
> -			fsm->b_se0_srp,
> -			fsm->b_ssend_srp,
> -			fsm->b_sess_vld,
> -			fsm->id);
> -	size -= t;
> -	next += t;
> -
> -	mutex_unlock(&fsm->lock);
> -
> -	return PAGE_SIZE - size;
> -}
> -
> -static DEVICE_ATTR(fsl_usb2_otg_state, S_IRUGO, show_fsl_usb2_otg_state,
> NULL);
> -
> -static struct attribute *fsl_otg_attrs[] = {
> -	&dev_attr_fsl_usb2_otg_state.attr,
> -	NULL,
> -};
> -ATTRIBUTE_GROUPS(fsl_otg);
> -
>  /* Char driver interface to control some OTG input */
> 
>  /*
> @@ -1167,7 +1075,6 @@ struct platform_driver fsl_otg_driver = {
>  	.driver = {
>  		.name = driver_name,
>  		.owner = THIS_MODULE,
> -		.dev_groups = fsl_otg_groups,
>  	},
>  };
> 
> --
> 2.27.0


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

* RE: [PATCH 2/2] USB: phy: fsl-usb: remove character device usage
  2020-07-02  7:29 ` [PATCH 2/2] USB: phy: fsl-usb: remove character device usage Greg Kroah-Hartman
@ 2020-07-02  9:07   ` Peter Chen
  2020-07-02 10:33     ` Greg Kroah-Hartman
  2020-07-03  1:56     ` Ran Wang
  0 siblings, 2 replies; 9+ messages in thread
From: Peter Chen @ 2020-07-02  9:07 UTC (permalink / raw)
  To: Greg Kroah-Hartman, balbi, Ran Wang, Leo Li; +Cc: linux-usb, linux-kernel

 
> 
> No idea why this driver is using a char device node, statically allocated, with no
> dynamic allocation or hook up with devtmpfs, along with a reserverd major number,
> for "special" operations, not all of which ever were implemented.
> 
> So just rip it out, as no one must be using it because no modern system will ever
> actually create the /dev/ node it needs.
> 

Add related people from NXP.

Peter

> Cc: Felipe Balbi <balbi@kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  drivers/usb/phy/phy-fsl-usb.c | 69 -----------------------------------
>  drivers/usb/phy/phy-fsl-usb.h | 14 -------
>  2 files changed, 83 deletions(-)
> 
> diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c index
> 93d2257aeec8..0c6d9f9f2994 100644
> --- a/drivers/usb/phy/phy-fsl-usb.c
> +++ b/drivers/usb/phy/phy-fsl-usb.c
> @@ -957,67 +957,6 @@ int usb_otg_start(struct platform_device *pdev)
>  	return 0;
>  }
> 
> -/* Char driver interface to control some OTG input */
> -
> -/*
> - * Handle some ioctl command, such as get otg
> - * status and set host suspend
> - */
> -static long fsl_otg_ioctl(struct file *file, unsigned int cmd,
> -			  unsigned long arg)
> -{
> -	u32 retval = 0;
> -
> -	switch (cmd) {
> -	case GET_OTG_STATUS:
> -		retval = fsl_otg_dev->host_working;
> -		break;
> -
> -	case SET_A_SUSPEND_REQ:
> -		fsl_otg_dev->fsm.a_suspend_req_inf = arg;
> -		break;
> -
> -	case SET_A_BUS_DROP:
> -		fsl_otg_dev->fsm.a_bus_drop = arg;
> -		break;
> -
> -	case SET_A_BUS_REQ:
> -		fsl_otg_dev->fsm.a_bus_req = arg;
> -		break;
> -
> -	case SET_B_BUS_REQ:
> -		fsl_otg_dev->fsm.b_bus_req = arg;
> -		break;
> -
> -	default:
> -		break;
> -	}
> -
> -	otg_statemachine(&fsl_otg_dev->fsm);
> -
> -	return retval;
> -}
> -
> -static int fsl_otg_open(struct inode *inode, struct file *file) -{
> -	return 0;
> -}
> -
> -static int fsl_otg_release(struct inode *inode, struct file *file) -{
> -	return 0;
> -}
> -
> -static const struct file_operations otg_fops = {
> -	.owner = THIS_MODULE,
> -	.llseek = NULL,
> -	.read = NULL,
> -	.write = NULL,
> -	.unlocked_ioctl = fsl_otg_ioctl,
> -	.open = fsl_otg_open,
> -	.release = fsl_otg_release,
> -};
> -
>  static int fsl_otg_probe(struct platform_device *pdev)  {
>  	int ret;
> @@ -1039,12 +978,6 @@ static int fsl_otg_probe(struct platform_device *pdev)
>  		return ret;
>  	}
> 
> -	ret = register_chrdev(FSL_OTG_MAJOR, FSL_OTG_NAME, &otg_fops);
> -	if (ret) {
> -		dev_err(&pdev->dev, "unable to register FSL OTG device\n");
> -		return ret;
> -	}
> -
>  	return ret;
>  }
> 
> @@ -1061,8 +994,6 @@ static int fsl_otg_remove(struct platform_device *pdev)
>  	kfree(fsl_otg_dev->phy.otg);
>  	kfree(fsl_otg_dev);
> 
> -	unregister_chrdev(FSL_OTG_MAJOR, FSL_OTG_NAME);
> -
>  	if (pdata->exit)
>  		pdata->exit(pdev);
> 
> diff --git a/drivers/usb/phy/phy-fsl-usb.h b/drivers/usb/phy/phy-fsl-usb.h index
> fbcc28ad9964..d70341ae5a92 100644
> --- a/drivers/usb/phy/phy-fsl-usb.h
> +++ b/drivers/usb/phy/phy-fsl-usb.h
> @@ -371,21 +371,7 @@ struct fsl_otg_config {
>  	u8 otg_port;
>  };
> 
> -/* For SRP and HNP handle */
> -#define FSL_OTG_MAJOR		240
>  #define FSL_OTG_NAME		"fsl-usb2-otg"
> -/* Command to OTG driver ioctl */
> -#define OTG_IOCTL_MAGIC		FSL_OTG_MAJOR
> -/* if otg work as host, it should return 1, otherwise return 0 */
> -#define GET_OTG_STATUS		_IOR(OTG_IOCTL_MAGIC, 1, int)
> -#define SET_A_SUSPEND_REQ	_IOW(OTG_IOCTL_MAGIC, 2, int)
> -#define SET_A_BUS_DROP		_IOW(OTG_IOCTL_MAGIC, 3, int)
> -#define SET_A_BUS_REQ		_IOW(OTG_IOCTL_MAGIC, 4, int)
> -#define SET_B_BUS_REQ		_IOW(OTG_IOCTL_MAGIC, 5, int)
> -#define GET_A_SUSPEND_REQ	_IOR(OTG_IOCTL_MAGIC, 6, int)
> -#define GET_A_BUS_DROP		_IOR(OTG_IOCTL_MAGIC, 7, int)
> -#define GET_A_BUS_REQ		_IOR(OTG_IOCTL_MAGIC, 8, int)
> -#define GET_B_BUS_REQ		_IOR(OTG_IOCTL_MAGIC, 9, int)
> 
>  void fsl_otg_add_timer(struct otg_fsm *fsm, void *timer);  void
> fsl_otg_del_timer(struct otg_fsm *fsm, void *timer);
> --
> 2.27.0


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

* Re: [PATCH 2/2] USB: phy: fsl-usb: remove character device usage
  2020-07-02  9:07   ` Peter Chen
@ 2020-07-02 10:33     ` Greg Kroah-Hartman
  2020-07-03  1:56     ` Ran Wang
  1 sibling, 0 replies; 9+ messages in thread
From: Greg Kroah-Hartman @ 2020-07-02 10:33 UTC (permalink / raw)
  To: Peter Chen; +Cc: balbi, Ran Wang, Leo Li, linux-usb, linux-kernel

On Thu, Jul 02, 2020 at 09:07:43AM +0000, Peter Chen wrote:
>  
> > 
> > No idea why this driver is using a char device node, statically allocated, with no
> > dynamic allocation or hook up with devtmpfs, along with a reserverd major number,
> > for "special" operations, not all of which ever were implemented.
> > 
> > So just rip it out, as no one must be using it because no modern system will ever
> > actually create the /dev/ node it needs.
> > 
> 
> Add related people from NXP.

If there are related people, MAINTAINERS should have reflected that :)

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

* RE: [PATCH 1/2] USB: phy: fsl-usb: remove sysfs abuse
  2020-07-02  9:07 ` [PATCH 1/2] USB: phy: fsl-usb: remove sysfs abuse Peter Chen
@ 2020-07-03  1:49   ` Ran Wang
  0 siblings, 0 replies; 9+ messages in thread
From: Ran Wang @ 2020-07-03  1:49 UTC (permalink / raw)
  To: Peter Chen, Greg Kroah-Hartman, balbi, Leo Li; +Cc: linux-usb, linux-kernel

Hi,

On Thursday, July 2, 2020 5:07 PM, wrote:
> >
> > This file has a HUGE debugging sysfs file that spews out a lot of
> > information all at once, which violates the one-value-per-file rule
> > for sysfs.  If this is really needed, it should go into debugfs, but
> > given the age of this driver, I strongly doubt anyone is using it anymore.
> >
> > So just remove the file entirely, it was never documented, so
> > obviously, no one actually needed it :)
> >
> 
> 
> Add related people from NXP.

Thanks for having me. Agree to clean this up for above reasons.

Regards,
Ran

> Peter
> 
> > Cc: Felipe Balbi <balbi@kernel.org>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > ---
> >  drivers/usb/phy/phy-fsl-usb.c | 93
> > -----------------------------------
> >  1 file changed, 93 deletions(-)
> >
> > diff --git a/drivers/usb/phy/phy-fsl-usb.c
> > b/drivers/usb/phy/phy-fsl-usb.c index
> > b451f4695f3f..93d2257aeec8 100644
> > --- a/drivers/usb/phy/phy-fsl-usb.c
> > +++ b/drivers/usb/phy/phy-fsl-usb.c
> > @@ -957,98 +957,6 @@ int usb_otg_start(struct platform_device *pdev)
> >  	return 0;
> >  }
> >
> > -/*
> > - * state file in sysfs
> > - */
> > -static ssize_t show_fsl_usb2_otg_state(struct device *dev,
> > -				   struct device_attribute *attr, char *buf)
> > -{
> > -	struct otg_fsm *fsm = &fsl_otg_dev->fsm;
> > -	char *next = buf;
> > -	unsigned size = PAGE_SIZE;
> > -	int t;
> > -
> > -	mutex_lock(&fsm->lock);
> > -
> > -	/* basic driver infomation */
> > -	t = scnprintf(next, size,
> > -			DRIVER_DESC "\n" "fsl_usb2_otg version: %s\n\n",
> > -			DRIVER_VERSION);
> > -	size -= t;
> > -	next += t;
> > -
> > -	/* Registers */
> > -	t = scnprintf(next, size,
> > -			"OTGSC:   0x%08x\n"
> > -			"PORTSC:  0x%08x\n"
> > -			"USBMODE: 0x%08x\n"
> > -			"USBCMD:  0x%08x\n"
> > -			"USBSTS:  0x%08x\n"
> > -			"USBINTR: 0x%08x\n",
> > -			fsl_readl(&usb_dr_regs->otgsc),
> > -			fsl_readl(&usb_dr_regs->portsc),
> > -			fsl_readl(&usb_dr_regs->usbmode),
> > -			fsl_readl(&usb_dr_regs->usbcmd),
> > -			fsl_readl(&usb_dr_regs->usbsts),
> > -			fsl_readl(&usb_dr_regs->usbintr));
> > -	size -= t;
> > -	next += t;
> > -
> > -	/* State */
> > -	t = scnprintf(next, size,
> > -		      "OTG state: %s\n\n",
> > -		      usb_otg_state_string(fsl_otg_dev->phy.otg->state));
> > -	size -= t;
> > -	next += t;
> > -
> > -	/* State Machine Variables */
> > -	t = scnprintf(next, size,
> > -			"a_bus_req: %d\n"
> > -			"b_bus_req: %d\n"
> > -			"a_bus_resume: %d\n"
> > -			"a_bus_suspend: %d\n"
> > -			"a_conn: %d\n"
> > -			"a_sess_vld: %d\n"
> > -			"a_srp_det: %d\n"
> > -			"a_vbus_vld: %d\n"
> > -			"b_bus_resume: %d\n"
> > -			"b_bus_suspend: %d\n"
> > -			"b_conn: %d\n"
> > -			"b_se0_srp: %d\n"
> > -			"b_ssend_srp: %d\n"
> > -			"b_sess_vld: %d\n"
> > -			"id: %d\n",
> > -			fsm->a_bus_req,
> > -			fsm->b_bus_req,
> > -			fsm->a_bus_resume,
> > -			fsm->a_bus_suspend,
> > -			fsm->a_conn,
> > -			fsm->a_sess_vld,
> > -			fsm->a_srp_det,
> > -			fsm->a_vbus_vld,
> > -			fsm->b_bus_resume,
> > -			fsm->b_bus_suspend,
> > -			fsm->b_conn,
> > -			fsm->b_se0_srp,
> > -			fsm->b_ssend_srp,
> > -			fsm->b_sess_vld,
> > -			fsm->id);
> > -	size -= t;
> > -	next += t;
> > -
> > -	mutex_unlock(&fsm->lock);
> > -
> > -	return PAGE_SIZE - size;
> > -}
> > -
> > -static DEVICE_ATTR(fsl_usb2_otg_state, S_IRUGO,
> > show_fsl_usb2_otg_state, NULL);
> > -
> > -static struct attribute *fsl_otg_attrs[] = {
> > -	&dev_attr_fsl_usb2_otg_state.attr,
> > -	NULL,
> > -};
> > -ATTRIBUTE_GROUPS(fsl_otg);
> > -
> >  /* Char driver interface to control some OTG input */
> >
> >  /*
> > @@ -1167,7 +1075,6 @@ struct platform_driver fsl_otg_driver = {
> >  	.driver = {
> >  		.name = driver_name,
> >  		.owner = THIS_MODULE,
> > -		.dev_groups = fsl_otg_groups,
> >  	},
> >  };
> >
> > --
> > 2.27.0


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

* RE: [PATCH 2/2] USB: phy: fsl-usb: remove character device usage
  2020-07-02  9:07   ` Peter Chen
  2020-07-02 10:33     ` Greg Kroah-Hartman
@ 2020-07-03  1:56     ` Ran Wang
  2020-07-03  7:02       ` Greg Kroah-Hartman
  1 sibling, 1 reply; 9+ messages in thread
From: Ran Wang @ 2020-07-03  1:56 UTC (permalink / raw)
  To: Peter Chen, Greg Kroah-Hartman, balbi, Leo Li; +Cc: linux-usb, linux-kernel

Hi

On Thursday, July 2, 2020 5:08 PM, Peter Chen wrote
> >
> > No idea why this driver is using a char device node, statically
> > allocated, with no dynamic allocation or hook up with devtmpfs, along
> > with a reserverd major number, for "special" operations, not all of which ever
> were implemented.
> >
> > So just rip it out, as no one must be using it because no modern
> > system will ever actually create the /dev/ node it needs.
> >
> 
> Add related people from NXP.
> 

Reviewed-by: Ran Wang <ran.wang_1@nxp.com>

Regards,
Ran

<snip>


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

* Re: [PATCH 2/2] USB: phy: fsl-usb: remove character device usage
  2020-07-03  1:56     ` Ran Wang
@ 2020-07-03  7:02       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 9+ messages in thread
From: Greg Kroah-Hartman @ 2020-07-03  7:02 UTC (permalink / raw)
  To: Ran Wang; +Cc: Peter Chen, balbi, Leo Li, linux-usb, linux-kernel

On Fri, Jul 03, 2020 at 01:56:28AM +0000, Ran Wang wrote:
> Hi
> 
> On Thursday, July 2, 2020 5:08 PM, Peter Chen wrote
> > >
> > > No idea why this driver is using a char device node, statically
> > > allocated, with no dynamic allocation or hook up with devtmpfs, along
> > > with a reserverd major number, for "special" operations, not all of which ever
> > were implemented.
> > >
> > > So just rip it out, as no one must be using it because no modern
> > > system will ever actually create the /dev/ node it needs.
> > >
> > 
> > Add related people from NXP.
> > 
> 
> Reviewed-by: Ran Wang <ran.wang_1@nxp.com>

Thanks for the review!

greg k-h

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

* Re: [PATCH 1/2] USB: phy: fsl-usb: remove sysfs abuse
  2020-07-02  7:29 [PATCH 1/2] USB: phy: fsl-usb: remove sysfs abuse Greg Kroah-Hartman
  2020-07-02  7:29 ` [PATCH 2/2] USB: phy: fsl-usb: remove character device usage Greg Kroah-Hartman
  2020-07-02  9:07 ` [PATCH 1/2] USB: phy: fsl-usb: remove sysfs abuse Peter Chen
@ 2020-07-23 11:40 ` Felipe Balbi
  2 siblings, 0 replies; 9+ messages in thread
From: Felipe Balbi @ 2020-07-23 11:40 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-usb, linux-kernel, Greg Kroah-Hartman

[-- Attachment #1: Type: text/plain, Size: 612 bytes --]

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

> This file has a HUGE debugging sysfs file that spews out a lot of
> information all at once, which violates the one-value-per-file rule for
> sysfs.  If this is really needed, it should go into debugfs, but given
> the age of this driver, I strongly doubt anyone is using it anymore.
>
> So just remove the file entirely, it was never documented, so obviously,
> no one actually needed it :)
>
> Cc: Felipe Balbi <balbi@kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

applied both, thanks Greg.

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

end of thread, other threads:[~2020-07-23 11:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-02  7:29 [PATCH 1/2] USB: phy: fsl-usb: remove sysfs abuse Greg Kroah-Hartman
2020-07-02  7:29 ` [PATCH 2/2] USB: phy: fsl-usb: remove character device usage Greg Kroah-Hartman
2020-07-02  9:07   ` Peter Chen
2020-07-02 10:33     ` Greg Kroah-Hartman
2020-07-03  1:56     ` Ran Wang
2020-07-03  7:02       ` Greg Kroah-Hartman
2020-07-02  9:07 ` [PATCH 1/2] USB: phy: fsl-usb: remove sysfs abuse Peter Chen
2020-07-03  1:49   ` Ran Wang
2020-07-23 11:40 ` Felipe Balbi

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).