All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Wang YanQing <udknight@gmail.com>
Cc: Johan Hovold <johan@kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	gregkh@linuxfoundation.org, jhovold@gmail.com, andi@lisas.de,
	dforsi@gmail.com, gnomes@lxorguk.ukuu.org.uk,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7] usb:serial:pl2303: add GPIOs interface on PL2303
Date: Mon, 18 Aug 2014 12:07:20 +0200	[thread overview]
Message-ID: <20140818100720.GF31755@localhost> (raw)
In-Reply-To: <20140817020536.GA2509@localhost.localdomain>

On Sun, Aug 17, 2014 at 10:05:36AM +0800, Wang YanQing wrote:
> Hi Johan Hovold.
> 
> Another two questions.
> 	
> On Tue, Aug 12, 2014 at 04:46:25PM +0200, Johan Hovold wrote:
> > 
> > > +	int (*gpio_startup)(struct usb_serial *serial);
> > > +	void (*gpio_release)(struct usb_serial *serial);
> > 
> > This isn't the right place for this abstraction. Most of the setup code
> > would be common for any device type with GPIOs.
> 
> I assume you mean any pl2303 variant, not any device type, because
> no device in drivers/gpio has common setup code except many of them
> use struct gpio_chip.

Yes, pl2303 type/variant. Specifically, much of the setup code will be
identical even if say the number of gpio differ (2 or 4) depending on
type.

> > Just keep the generic gpio_startup and release from v6, and verify that
> > ngpio > 0. Any further abstraction should only be added once we know how
> > the other types handles GPIOs.
> 
> Instead of assume code works for all situation firstly,  test and write
> code for only one type device, and make code become generic when we find
> it works for others' type.
> 
> I don't known which way is better.

Add support for your device type (HXA). We should verify that it also
works for the non-end-of-life HXD, or we might need to find a way to
detect those two different types of HX and limit it to HXA for now.

If and when someone reverse-engineers a device type with a different
protocol for dealing with GPIOs, that's when you add further abstraction.

> Thanks very much for your patient review !!

You're welcome.

Johan

  reply	other threads:[~2014-08-18 10:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-09  5:28 [PATCH v7] usb:serial:pl2303: add GPIOs interface on PL2303 Wang YanQing
2014-08-12 14:46 ` Johan Hovold
2014-08-13  6:17   ` Hannes Petermaier
2014-08-13  7:05     ` Johan Hovold
2014-08-13  7:09       ` Greg KH
2014-08-17  1:04   ` Wang YanQing
2014-08-18 10:00     ` Johan Hovold
2014-08-17  2:05   ` Wang YanQing
2014-08-18 10:07     ` Johan Hovold [this message]
2014-08-27 23:43       ` Wang YanQing
2014-08-29 10:44         ` Johan Hovold

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=20140818100720.GF31755@localhost \
    --to=johan@kernel.org \
    --cc=andi@lisas.de \
    --cc=dforsi@gmail.com \
    --cc=gnomes@lxorguk.ukuu.org.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=jhovold@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=udknight@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.