public inbox for linux-mediatek@lists.infradead.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Chunfeng Yun <chunfeng.yun@mediatek.com>
Cc: Peter Chen <Peter.Chen@nxp.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Wolfram Sang <wsa@the-dreams.de>,
	Yangtao Li <tiny.windzz@gmail.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	linux-kernel@vger.kernel.org,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Mans Rullgard <mans@mansr.com>,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Fabio Estevam <festevam@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Robert Jarzmik <robert.jarzmik@free.fr>,
	Kevin Cernekee <cernekee@gmail.com>,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	Ludovic Desroches <ludovic.desroches@microchip.com>,
	Alan Stern <stern@rowland.harvard.edu>,
	NXP Linux Team <linux-imx@nxp.com>,
	bcm-kernel-feedback-list@broadcom.com,
	David Kershner <david.kershner@unisys.com>,
	Hans Ulli Kroll <ulli.kroll@googlemail.com>,
	Cristian Birsan <cristian.birsan@microchip.com>,
	linux-media@vger.kernel.org,
	Fabrizio Castro <fabrizio.castro@bp.renesas.com>,
	Mathias Payer <mathias.payer@nebelwelt.net>,
	Mathias Nyman <mathias.nyman@intel.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Haojian Zhuang <haojian.zhuang@gmail.com>,
	Stephen Boyd <swboyd@chromium.org>,
	linux-mediatek@lists.infradead.org,
	Minas Harutyunyan <hminas@synopsys.com>,
	Simon Horman <horms+renesas@verge.net.au>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Bin Liu <b-liu@ti.com>,
	linux-arm-kernel@lists.infradead.org,
	Biju Das <biju.das@bp.renesas.com>,
	Felipe Balbi <balbi@kernel.org>,
	Laurentiu Tudor <laurentiu.tudor@nxp.com>,
	Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
	linux-usb@vger.kernel.org,
	Nicolas Ferre <nicolas.ferre@microchip.com>,
	Dmitry Torokhov <dtor@chromium.org>,
	Guenter Roeck <linux@roeck-us.net>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Colin Ian King <colin.king@canonical.com>,
	Shawn Guo <shawnguo@kernel.org>, Daniel Mack <daniel@zonque.org>
Subject: Re: [PATCH 01/28] usb: common: change usb_debug_root as static variable
Date: Thu, 7 Nov 2019 10:16:24 +0100	[thread overview]
Message-ID: <20191107091624.GB1328892@kroah.com> (raw)
In-Reply-To: <1573117594.18464.87.camel@mhfsdcap03>

On Thu, Nov 07, 2019 at 05:06:34PM +0800, Chunfeng Yun wrote:
> Hi Greg,
> 
> On Wed, 2019-11-06 at 06:00 -0800, Guenter Roeck wrote:
> > On 11/6/19 1:11 AM, Chunfeng Yun wrote:
> > > On Tue, 2019-11-05 at 20:03 -0800, Guenter Roeck wrote:
> > >> On 11/5/19 7:15 PM, Chunfeng Yun wrote:
> > >>> Try to avoid using extern global variable, and provide two
> > >>> functions for the usage cases
> > >>>
> > >>> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > >>> ---
> > >>>    drivers/usb/common/common.c | 16 ++++++++++++++--
> > >>>    include/linux/usb.h         |  5 ++++-
> > >>>    2 files changed, 18 insertions(+), 3 deletions(-)
> > >>>
> > >>> diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
> > >>> index 1433260d99b4..639ee6d243a2 100644
> > >>> --- a/drivers/usb/common/common.c
> > >>> +++ b/drivers/usb/common/common.c
> > >>> @@ -293,8 +293,20 @@ struct device *usb_of_get_companion_dev(struct device *dev)
> > >>>    EXPORT_SYMBOL_GPL(usb_of_get_companion_dev);
> > >>>    #endif
> > >>>    
> > >>> -struct dentry *usb_debug_root;
> > >>> -EXPORT_SYMBOL_GPL(usb_debug_root);
> > >>> +static struct dentry *usb_debug_root;
> > >>> +
> > >>
> > >> I don't think it is a good idea to declare this variable static
> > >> before all its uses are removed. This patch will leave the system
> > >> in a non-compileable state until all patches of the series have
> > >> been applied.
> > > Yes, you are right, I'll fix it, may be split into two patch
> > > 
> > >>
> > >> I am curious. What is the rationale for this change ?
> > >> Did exported variables run out of favor ?
> > > Personally, I think it's good practice to avoid global varibale,
> > > it may not a good reason.
> > 
> > Personally I don't think it is a good reason at all. When you are done,
> > someone else may come in and declare the opposite, re-introduce the global
> > variable, and drop the new functions as unnecessary.
> > 
> > This is ok for new code, but I think we should leave existing code alone
> > unless it is broken and needs to get fixed. This is not the case here.
> What do you think about this, if you also agree with Guenter's opinion,

I do.

> I'll abandon this patch.

Please do.

> BTW, how about moving udc's debug directory into usb root?

Sure, feel free to send a patch for that.

thanks,

greg k-h

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

  reply	other threads:[~2019-11-07  9:16 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-06  3:15 [PATCH 01/28] usb: common: change usb_debug_root as static variable Chunfeng Yun
2019-11-06  3:15 ` [PATCH 02/28] usb: core: use usb_debugfs_create_file() to create debugfs file Chunfeng Yun
2019-11-06  3:15 ` [PATCH 03/28] usb: host: sl811: use usb_debugfs_create_file() to create file Chunfeng Yun
2019-11-06  3:15 ` [PATCH 04/28] usb: host: isp1362: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 05/28] usb: typec: tcpm: use usb_debugfs_create_file() to create debugfs file Chunfeng Yun
2019-11-06  3:15 ` [PATCH 06/28] usb: typec: fusb302: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 07/28] usb: ehci-hcd: use usb_debugfs_create_dir() to create directory Chunfeng Yun
2019-11-06  3:15 ` [PATCH 08/28] usb: fhci-hcd: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 09/28] usb: ohci-hcd: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 10/28] usb: uhci-hcd: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 11/28] usb: xhci: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 12/28] usb: host: fotg2: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 13/28] usb: mon: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 14/28] usb: mtu3: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 15/28] media: uvcvideo: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 16/28] media: siano: " Chunfeng Yun
2019-11-06  8:50   ` Greg Kroah-Hartman
2019-11-06  9:55   ` Greg Kroah-Hartman
2019-11-06  3:15 ` [PATCH 17/28] usb: chipidea: debug: create debugfs directory under usb root Chunfeng Yun
2019-11-06  3:15 ` [PATCH 18/28] usb: host: imx21: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 19/28] usb: dwc3: create debugfs subdirectory under usb root directory Chunfeng Yun
2019-11-06  3:15 ` [PATCH 20/28] usb: musb: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 21/28] usb: musb: dsps: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 22/28] usb: dwc2: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 23/28] usb: gadget: bcm63xx_udc: create debugfs directory under usb root Chunfeng Yun
2019-11-06  3:15 ` [PATCH 24/28] usb: gadget: atmel: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 25/28] usb: gadget: udc: renesas_usb3: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 26/28] usb: gadget: pxa27x: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 27/28] usb: gadget: udc: gr_udc: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 28/28] usb: gadget: udc: s3c2410_udc: " Chunfeng Yun
2019-11-06  4:03 ` [PATCH 01/28] usb: common: change usb_debug_root as static variable Guenter Roeck
2019-11-06  7:33   ` Wolfram Sang
2019-11-06  8:51     ` Greg Kroah-Hartman
2019-11-06  9:25       ` Chunfeng Yun
2019-11-06  9:11   ` Chunfeng Yun
2019-11-06 14:00     ` Guenter Roeck
2019-11-07  9:06       ` Chunfeng Yun
2019-11-07  9:16         ` Greg Kroah-Hartman [this message]
2019-11-06  8:51 ` Greg Kroah-Hartman
2019-11-06  9:15   ` Chunfeng Yun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191107091624.GB1328892@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=Peter.Chen@nxp.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=b-liu@ti.com \
    --cc=balbi@kernel.org \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=biju.das@bp.renesas.com \
    --cc=cernekee@gmail.com \
    --cc=chunfeng.yun@mediatek.com \
    --cc=colin.king@canonical.com \
    --cc=cristian.birsan@microchip.com \
    --cc=daniel@zonque.org \
    --cc=david.kershner@unisys.com \
    --cc=dtor@chromium.org \
    --cc=f.fainelli@gmail.com \
    --cc=fabrizio.castro@bp.renesas.com \
    --cc=festevam@gmail.com \
    --cc=gustavo@embeddedor.com \
    --cc=haojian.zhuang@gmail.com \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=hminas@synopsys.com \
    --cc=horms+renesas@verge.net.au \
    --cc=kernel@pengutronix.de \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=laurentiu.tudor@nxp.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=ludovic.desroches@microchip.com \
    --cc=mans@mansr.com \
    --cc=mathias.nyman@intel.com \
    --cc=mathias.payer@nebelwelt.net \
    --cc=matthias.bgg@gmail.com \
    --cc=mchehab@kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=robert.jarzmik@free.fr \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=stern@rowland.harvard.edu \
    --cc=suzuki.poulose@arm.com \
    --cc=swboyd@chromium.org \
    --cc=tiny.windzz@gmail.com \
    --cc=ulli.kroll@googlemail.com \
    --cc=wsa@the-dreams.de \
    --cc=yoshihiro.shimoda.uh@renesas.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox