From: Frans Klaver <fransklaver@gmail.com>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Greg KH <gregkh@linuxfoundation.org>,
Guenter Roeck <linux@roeck-us.net>,
Oliver Neukum <oneukum@suse.com>,
Felipe Balbi <felipe.balbi@linux.intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: Re: [PATCH v5 1/2] usb: USB Type-C connector class
Date: Wed, 17 Aug 2016 16:00:41 +0200 [thread overview]
Message-ID: <CAH6sp9OTuH14wO2BHWr5AfyfL9Y895LKteoPKBnDgp5CE6pmdA@mail.gmail.com> (raw)
In-Reply-To: <20160817135318.GT9927@kuha.fi.intel.com>
On Wed, Aug 17, 2016 at 3:53 PM, Heikki Krogerus
<heikki.krogerus@linux.intel.com> wrote:
> Hi,
>
> On Wed, Aug 17, 2016 at 03:14:03PM +0200, Frans Klaver wrote:
>> On Wed, Aug 17, 2016 at 12:34 PM, Heikki Krogerus
>> > +static const char * const typec_partner_types[] = {
>> > + [TYPEC_PARTNER_USB] = "USB",
>> > + [TYPEC_PARTNER_CHARGER] = "Charger",
>> > + [TYPEC_PARTNER_ALTMODE] = "Alternate Mode",
>> > + [TYPEC_PARTNER_ACCESSORY] = "Accessory",
>> > +};
>> > +
>> > +static ssize_t partner_type_show(struct device *dev,
>> > + struct device_attribute *attr, char *buf)
>> > +{
>> > + struct typec_partner *partner = container_of(dev, struct typec_partner,
>> > + dev);
>> > +
>> > + return sprintf(buf, "%s\n", typec_partner_types[partner->type]);
>> > +}
>> > +
>> > +static struct device_attribute dev_attr_partner_type = {
>> > + .attr = {
>> > + .name = "type",
>> > + .mode = S_IRUGO,
>> > + },
>> > + .show = partner_type_show,
>> > +};
>>
>> Why not use DEVICE_ATTR_RO() for this?
>
> Because I don't want to tie the attribute names to the function names
> in this case. There are other *type* attributes being created in the
> driver, so type_show() is not good, and we can't name the attribute
> "partner_type". The attribute will be placed in group named "partner".
>
Ah, makes sense.
Thanks,
Frans
next prev parent reply other threads:[~2016-08-17 14:00 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-17 10:34 [PATCH v5 0/2] USB Type-C Connector class Heikki Krogerus
2016-08-17 10:34 ` [PATCH v5 1/2] usb: USB Type-C connector class Heikki Krogerus
2016-08-17 13:14 ` Frans Klaver
2016-08-17 13:53 ` Heikki Krogerus
2016-08-17 14:00 ` Frans Klaver [this message]
2016-08-17 13:30 ` Guenter Roeck
2016-08-17 13:56 ` Heikki Krogerus
2016-08-17 17:53 ` Guenter Roeck
2016-08-18 10:43 ` Heikki Krogerus
2016-08-17 17:58 ` Guenter Roeck
2016-08-18 10:44 ` Heikki Krogerus
2016-08-17 10:34 ` [PATCH v5 2/2] usb: typec: add driver for Intel Whiskey Cove PMIC USB Type-C PHY Heikki Krogerus
2016-08-17 12:53 ` Felipe Balbi
2016-08-17 13:32 ` Heikki Krogerus
2016-08-17 23:00 ` Peter Chen
2016-08-18 6:33 ` Felipe Balbi
2016-08-18 13:32 ` Guenter Roeck
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=CAH6sp9OTuH14wO2BHWr5AfyfL9Y895LKteoPKBnDgp5CE6pmdA@mail.gmail.com \
--to=fransklaver@gmail.com \
--cc=felipe.balbi@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=oneukum@suse.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
all inboxes | Powered by JetHome®