linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Mao Wenan <maowenan@huawei.com>,
	gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH -next] usb: roles: Hide option USB_ROLE_SWITCH
Date: Tue, 5 Nov 2019 17:26:24 +0200	[thread overview]
Message-ID: <20191105152624.GC12204@kuha.fi.intel.com> (raw)
In-Reply-To: <20191105131605.GF10409@kadam>

Hi Dan,

On Tue, Nov 05, 2019 at 04:16:05PM +0300, Dan Carpenter wrote:
> On Tue, Nov 05, 2019 at 02:42:18PM +0200, Heikki Krogerus wrote:
> > On Mon, Nov 04, 2019 at 10:48:50PM +0800, Mao Wenan wrote:
> > > The USB role switch class is, after all,
> > > not useful by itself. Hiding USB_ROLE_SWITCH
> > > so we can avoid any of the pitfalls associated
> > > with user-visible symbols and "select".
> > > 
> > > Signed-off-by: Mao Wenan <maowenan@huawei.com>
> > > ---
> > >  drivers/usb/roles/Kconfig | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/usb/roles/Kconfig b/drivers/usb/roles/Kconfig
> > > index f8b31aa..1da58d4 100644
> > > --- a/drivers/usb/roles/Kconfig
> > > +++ b/drivers/usb/roles/Kconfig
> > > @@ -1,7 +1,7 @@
> > >  # SPDX-License-Identifier: GPL-2.0
> > >  
> > >  config USB_ROLE_SWITCH
> > > -	tristate "USB Role Switch Support"
> > > +	tristate
> > >  	help
> > >  	  USB Role Switch is a device that can select the USB role - host or
> > >  	  device - for a USB port (connector). In most cases dual-role capable
> > 
> > You didn't actually convert the "depends on USB_ROLE_SWTICH" to
> > "select USB_ROLE_SWITCH" before this. You also left the help text that
> > is now useless.
> > 
> > I really think that instead of this, we should just convert all
> > "select USB_ROLE_SWTICH" to "depends on USB_ROLE_SWITCH".
> 
> The you have to find USB_ROLE_SWITCH first when you want to enable your
> hardware...  It's feels really confusing when you want to create a
> .config file...

Unfortunately selecting the class alone is not enough. The USB role
switch on the system may be a dual-role capable USB controller, but it
may also be a mux that has its own separate driver.

It's equally or even more confusing for the user if the USB drivers
are enabled, including the dual-role mode, but the connector still
works only in one role, or in worst case not at all (if there is no
mux driver and the mux is left in "safe mode" so that the pins on the
connector are not connected to anything).

I still think that we should make these drivers depend on the class
instead of just selecting it. That way we at least give the user a
hint that there are also separate USB role switch drivers that may be
needed.

> I sometimes think maybe I'm too stupid to configure a kernel these days
> and that's sort of sad because how is Aunt Tillie supposed to manage?

We can always use something like conditional comments in the
Kconfig files to make sure that the user is told that in order to
select the driver, a dependency must be satisfied:

        config MY_AWESOME_DRIVER
                tristate "My awesome driver!"
                depends on USB_ROLE_SWITCH
                help
                  That's right! IT REALLY IS AWESOME!

        comment "My awesome driver depends on USB_ROLE_SWITCH..."
                depends on USB_ROLE_SWITCH=n

thanks,

-- 
heikki

  reply	other threads:[~2019-11-05 15:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-04  2:59 [PATCH -next] usb: gadget: Add dependency for USB_TEGRA_XUDC Mao Wenan
2019-11-04 10:04 ` Thierry Reding
2019-11-04 10:50   ` maowenan
2019-11-04 11:21     ` [PATCH v2 " Mao Wenan
2019-11-04 13:52       ` Thierry Reding
2019-11-04 13:53     ` [PATCH " Thierry Reding
2019-11-04 14:48       ` [PATCH -next] usb: roles: Hide option USB_ROLE_SWITCH Mao Wenan
2019-11-05 12:42         ` Heikki Krogerus
2019-11-05 13:16           ` Dan Carpenter
2019-11-05 15:26             ` Heikki Krogerus [this message]
2019-11-06 11:23               ` Dan Carpenter
2019-11-05 12:37   ` [PATCH -next] usb: gadget: Add dependency for USB_TEGRA_XUDC Heikki Krogerus

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=20191105152624.GC12204@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=dan.carpenter@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=maowenan@huawei.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;
as well as URLs for NNTP newsgroup(s).