From: Sergei Shtylyov <sshtylyov@mvista.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Tatyana Brokhman <tlinder@codeaurora.org>,
gregkh@suse.de, linux-arm-msm@vger.kernel.org, balbi@ti.com,
ablay@codeaurora.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/5] usb/gadget: don't deploy SS descriptors if SS is not enabled.
Date: Wed, 13 Apr 2011 14:46:39 +0400 [thread overview]
Message-ID: <4DA57F0F.1090609@ru.mvista.com> (raw)
In-Reply-To: <1302636896-12717-5-git-send-email-bigeasy@linutronix.de>
Hello.
On 12-04-2011 23:34, Sebastian Andrzej Siewior wrote:
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
> drivers/usb/gadget/composite.c | 4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
> diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
> index 92cc238..ac30e2f 100644
> --- a/drivers/usb/gadget/composite.c
> +++ b/drivers/usb/gadget/composite.c
> @@ -74,10 +74,12 @@ MODULE_PARM_DESC(iSerialNumber, "SerialNumber string");
> static char composite_manufacturer[50];
>
> /* Default endpoint companion descriptor */
> +#ifdef CONFIG_USB_GADGET_SUPERSPEED
> static struct usb_ss_ep_comp_descriptor default_ep_comp_desc = {
> .bDescriptorType = USB_DT_SS_ENDPOINT_COMP,
> .bLength = sizeof(struct usb_ss_ep_comp_descriptor),
> };
> +#endif
>
> /**
> * usb_create_ss_descriptors() - Generate SuperSpeed descriptors
> @@ -93,6 +95,7 @@ static struct usb_ss_ep_comp_descriptor default_ep_comp_desc = {
> */
> void usb_create_ss_descriptors(struct usb_function *f)
> {
> +#ifdef CONFIG_USB_GADGET_SUPERSPEED
> struct usb_ss_ep_comp_descriptor *ep_comp_desc;
> struct usb_endpoint_descriptor *ep_desc;
> struct usb_descriptor_header **src = f->hs_descriptors;
> @@ -185,6 +188,7 @@ void usb_create_ss_descriptors(struct usb_function *f)
> */
> *tmp = NULL;
> f->ss_desc_allocated = true;
> +#endif
Documentation/SubmittingPatches says this:
2) #ifdefs are ugly
Code cluttered with ifdefs is difficult to read and maintain. Don't do
it. Instead, put your ifdefs in a header, and conditionally define
'static inline' functions, or macros, which are used in the code.
Let the compiler optimize away the "no-op" case.
Simple example, of poor code:
dev = alloc_etherdev (sizeof(struct funky_private));
if (!dev)
return -ENODEV;
#ifdef CONFIG_NET_FUNKINESS
init_funky_net(dev);
#endif
Cleaned-up example:
(in header)
#ifndef CONFIG_NET_FUNKINESS
static inline void init_funky_net (struct net_device *d) {}
#endif
(in the code itself)
dev = alloc_etherdev (sizeof(struct funky_private));
if (!dev)
return -ENODEV;
init_funky_net(dev);
WBR, Sergei
next prev parent reply other threads:[~2011-04-13 10:48 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-23 8:04 [PATCH 5/5 v5] usb:gadget: Add SuperSpeed support to the Gadget Framework Tatyana Brokhman
2011-03-25 13:41 ` Felipe Balbi
2011-03-28 8:45 ` Tanya Brokhman
2011-03-28 8:54 ` Felipe Balbi
2011-03-28 9:15 ` Tanya Brokhman
2011-04-11 17:59 ` Sebastian Andrzej Siewior
2011-04-12 19:34 ` Sebastian Andrzej Siewior
2011-04-12 19:34 ` [PATCH 1/5] usb/gadget: cleanup of "Add SuperSpeed support to the Gadget Framework" Sebastian Andrzej Siewior
2011-04-13 8:17 ` Felipe Balbi
2011-04-12 19:34 ` [PATCH 2/5] usb/gadget: rename bos to get_bos_descr in composite Sebastian Andrzej Siewior
2011-04-12 19:34 ` [PATCH 3/5] usb/gadget: rename create_ss_descriptors() to usb_create_ss_descriptors() Sebastian Andrzej Siewior
2011-04-12 19:34 ` [PATCH 4/5] usb/gadget: don't deploy SS descriptors if SS is not enabled Sebastian Andrzej Siewior
2011-04-13 10:46 ` Sergei Shtylyov [this message]
2011-04-13 10:56 ` Sebastian Andrzej Siewior
2011-04-13 10:59 ` Michal Nazarewicz
2011-04-12 19:34 ` [PATCH 5/5] usb/gadget: don't auto-create SS descriptors if HS are avilable Sebastian Andrzej Siewior
2011-04-13 11:12 ` [PATCH 5/5 v5] usb:gadget: Add SuperSpeed support to the Gadget Framework Tanya Brokhman
2011-04-14 7:36 ` Tanya Brokhman
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=4DA57F0F.1090609@ru.mvista.com \
--to=sshtylyov@mvista.com \
--cc=ablay@codeaurora.org \
--cc=balbi@ti.com \
--cc=bigeasy@linutronix.de \
--cc=gregkh@suse.de \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=tlinder@codeaurora.org \
/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
Powered by JetHome