public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Michal Marek <mmarek@suse.cz>
To: matt mooney <mfm@muteddisk.com>
Cc: linux-kbuild@vger.kernel.org, Sam Ravnborg <sam@ravnborg.org>
Subject: Re: [RFC PATCH] usb: makefile cleanup
Date: Wed, 06 Oct 2010 14:01:37 +0200	[thread overview]
Message-ID: <4CAC6521.3050303@suse.cz> (raw)
In-Reply-To: <1286351501-24413-1-git-send-email-mfm@muteddisk.com>

On 6.10.2010 09:51, matt mooney wrote:
> For all modules, change <module>-objs to <module>-y; remove
> if-statements and replace with lists using the kbuild idiom; move
> flags to the top of the file; and fix alignment while trying to
> maintain the original scheme in each file.
> 
> None of the dependencies are modified.
> 
> Signed-off-by: matt mooney <mfm@muteddisk.com>
> ---
> 
> So here is a sample cleanup patch; I am not posting it to greg-kh or
> the rest of the necessary usb guys yet because I would like to know
> what you guys think first.

The elimination of conditionals in Makefiles is definitely worth it. Not
sure about pure whitespace fixes, if the USB developers don't show
interest, you can try pushing these through trivial@kernel.org. I have
only one remark below:

> diff --git a/drivers/usb/musb/Makefile b/drivers/usb/musb/Makefile
> index 4fd29f8..b1f79ae 100644
> --- a/drivers/usb/musb/Makefile
> +++ b/drivers/usb/musb/Makefile
> [...]
>  # the kconfig must guarantee that only one of the
>  # possible I/O schemes will be enabled at a time ...
> @@ -54,24 +27,17 @@ endif
>  ifneq ($(CONFIG_MUSB_PIO_ONLY),y)
>  
>    ifeq ($(CONFIG_USB_INVENTRA_DMA),y)
> -    musb_hdrc-objs		+= musbhsdma.o
> +    musb_hdrc-y			+= musbhsdma.o
>  
>    else
>      ifeq ($(CONFIG_USB_TI_CPPI_DMA),y)
> -      musb_hdrc-objs		+= cppi_dma.o
> +      musb_hdrc-y		+= cppi_dma.o
>  
>      else
>        ifeq ($(CONFIG_USB_TUSB_OMAP_DMA),y)
> -        musb_hdrc-objs		+= tusb6010_omap.o
> +	musb_hdrc-y		+= tusb6010_omap.o
>  
>        endif
>      endif
>    endif
>  endif

So this wasn't exactly elegant before and you are only changing *-objs
to *-y. Looking at drivers/usb/musb/Kconfig, al the three USB_*_DMA
depend on !MUSB_PIO_ONLY, so the outermost if statement can go away.
Furthermore, the intent seems to be to only enable one of the four modes
(MUSB_PIO_ONLY, USB_INVENTRA_DMA, USB_TI_CPPI_DMA or USB_TUSB_OMAP_DMA),
so it is a perfect candidate for a "choice" group. Have a look e.g. at
"PCI access mode" in arch/x86/Kconfig. Then, the Makefile part can be
reduced to three lines without any ifs.

Michal


  reply	other threads:[~2010-10-06 12:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-06  7:51 [RFC PATCH] usb: makefile cleanup matt mooney
2010-10-06 12:01 ` Michal Marek [this message]
2010-10-07  0:17   ` matt mooney
2010-10-06 16:50 ` Sam Ravnborg
2010-10-07  0:31   ` matt mooney
2010-10-08  7:47   ` matt mooney

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=4CAC6521.3050303@suse.cz \
    --to=mmarek@suse.cz \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=mfm@muteddisk.com \
    --cc=sam@ravnborg.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