lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1426515811.2330.16.camel@linaro.org>
Date:	Mon, 16 Mar 2015 16:23:31 +0200
From:	"Ivan T. Ivanov" <ivan.ivanov@...aro.org>
To:	Roger Quadros <rogerq@...com>
Cc:	cw00.choi@...sung.com, myungjoo.ham@...sung.com, balbi@...com,
	tony@...mide.com, nsekhar@...com, devicetree@...r.kernel.org,
	linux-usb@...r.kernel.org, linux-omap@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 1/1] extcon: usb-gpio: Introduce gpio usb extcon
 driver


Hi Roger, 

On Mon, 2015-03-16 at 15:11 +0200, Roger Quadros wrote:
> Hi Ivan,
> 
> On 16/03/15 14:32, Ivan T. Ivanov wrote:
> > Hi,
> > 
> > On Mon, 2015-02-02 at 12:21 +0200, Roger Quadros wrote:
> > > This driver observes the USB ID pin connected over a GPIO and
> > > updates the USB cable extcon states accordingly.
> > > 
> > > The existing GPIO extcon driver is not suitable for this purpose
> > > as it needs to be taught to understand USB cable states and it
> > > can't handle more than one cable per instance.
> > > 
> > > For the USB case we need to handle 2 cable states.
> > > 1) USB (attach/detach)
> > > 2) USB-HOST (attach/detach)
> > > 
> > > This driver can be easily updated in the future to handle VBUS
> > > events in case it happens to be available on GPIO for any platform.
> > > 
> > > Signed-off-by: Roger Quadros <rogerq@...com>
> > > ---
> > > v4:
> > > - got rid of id_irqwake flag. Fail if enable/disable_irq_wake() fails
> > > - changed host cable name to "USB-HOST"
> > 
> > I am sorry that I am getting a bit little late into this.
> > 
> > Isn't supposed that we have to use strings defined in
> > const char extcon_cable_name[][]?
> > 
> > 
> > > +
> > > +/* List of detectable cables */
> > > +enum {
> > > +       EXTCON_CABLE_USB = 0,
> > > +       EXTCON_CABLE_USB_HOST,
> > > +
> > 
> > Same here: duplicated with enum extcon_cable_name
> > 
> > > +       EXTCON_CABLE_END,
> > > +};
> > > +
> > > +static const char *usb_extcon_cable[] = {
> > > +       [EXTCON_CABLE_USB] = "USB",
> > > +       [EXTCON_CABLE_USB_HOST] = "USB-HOST",
> > > +       NULL,
> > > +};
> 
> I'm not exactly sure how else it is supposed to work if we
> support only a subset of cables from the global extcon_cable_name[][].

I don't see issue that we use just 2 events. I think that we can
reuse  enum extcon_cable_name and strings already defined in 
extcon_cable_name[][] global variable. It is defined extern in
extcon.h file exactly for this purpose, no?

> 
> > 
> > <snip>
> > 
> > > +
> > > +static int usb_extcon_probe(struct platform_device *pdev)
> > > +{
> > > 
> > 
> > <snip>
> > 
> > > +
> > > +       ret = devm_request_threaded_irq(dev, info->id_irq, NULL,
> > > +                                       usb_irq_handler,
> > > +                                       IRQF_TRIGGER_RISING |
> > > +                                       IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
> > 
> > Shouldn't triggers be defined in DTS files?
> 
> Could be but we're sure that we always need the trigger for both rising/falling edges
> in this case. So the usage is more appropriately decided from application point of view
> rather than h/w point of view. h/w is generic GPIO.

No strong opinion on this. Could it be that GPIO did't support edge
triggered interrupt, but just level triggered?

Regards,
Ivan

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ