public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Rashika Kheria <rashika.kheria@gmail.com>,
	linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, josh@joshtriplett.org
Subject: Re: [PATCH 3/7] drivers: usb: Include appropriate header file in hcd.h
Date: Thu, 19 Dec 2013 20:48:48 +0300	[thread overview]
Message-ID: <52B33180.60701@cogentembedded.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1312191128500.984-100000@iolanthe.rowland.org>

Hello.

On 12/19/2013 07:38 PM, Alan Stern wrote:

>>>> Include header file include/linux/usb.h in include/linux/usb/hcd.h
>>>> because structures usb_device, usb_host_config and usb_interface have
>>>> their definitions in include/linux/usb.h.

>>>> This eliminates the following warning in include/linux/usb/hcd.h:
>>>> include/linux/usb/hcd.h:311:44: warning: ‘struct usb_device’ declared inside parameter list [enabled by default]
>>>> include/linux/usb/hcd.h:412:10: warning: ‘struct usb_host_config’ declared inside parameter list [enabled by default]
>>>> include/linux/usb/hcd.h:614:9: warning: ‘struct usb_interface’ declared inside parameter list [enabled by default]

>>      Rashika, would it be enough to forward-declare these structures ISO
>> #include'ing the whole header?

> I agree, that would fix the problem.

    It should also make Greg happier. :-)

>>> Where does this problem show up?

>>> Any file that include linux/usb/hcd.h should include linux/usb.h first.
>>> IMO it would be better to fix the source files that don't do the
>>> includes properly.

>>      Yeah, let's fix the consequency instead of the cause. :-)

> The _real_ cause is that the Linux source code is extremely
> complicated, and it is remarkably difficult to insure that all header
> files have no unsatisfied dependencies.  How do you suggest fixing
> _that_?

> For example, suppose A.c includes B.h, and B.h includes C.h, and C.h
> defines struct foo.  Then A.c can use struct foo freely without
> including C.h directly (and this sort of thing happens quite a lot in
> the kernel source).  But consider what happens when B.h is changed so
> that it no longer includes C.h.

    That's a whole different issue than what we're dealing with.

>>> Of course, people have varying opinions on this issue.  As far as I
>>> know, there is no fixed policy in the kernel about nested includes.

>>      So far, I've only encountered the dubious policy of satisfying header's
>> dependencies in the files that include them is the USB tree.

> Have you looked in any other places?

    I have over 500 patches in the different areas of the kernel, so 
apparently I have if I'm telling you this. The only place where my patch to 
fix a header file so that it would be self-contained has encountered a 
maintainer's resistance was linux-usb. And note that it wasn't merely a case 
like this, where incomplete structure declarations would be enough, it was the 
case where the full structure declarations were needed.

> For that matter, how do you know
> that the USB tree has such a policy?

    From Greg KH. Also, from the late David Brownell.

>  Is it documented anywhere?

    I don't think so.

> Alan Stern

WBR, Sergei


  reply	other threads:[~2013-12-19 16:48 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-19 10:06 [PATCH 1/7] drivers: usb: Include appropriate header file in hcd.c Rashika Kheria
2013-12-19 10:07 ` [PATCH 2/7] drivers: usb: Include appropriate header file in configfs.c Rashika Kheria
2013-12-19 10:09 ` [PATCH 3/7] drivers: usb: Include appropriate header file in hcd.h Rashika Kheria
2013-12-19 15:45   ` Alan Stern
2013-12-19 16:37     ` josh
2013-12-19 16:48       ` Alan Stern
2013-12-19 16:53         ` josh
2013-12-19 18:03         ` Sergei Shtylyov
2013-12-19 19:48           ` Alan Stern
2013-12-19 17:14     ` Sergei Shtylyov
2013-12-19 16:38       ` Alan Stern
2013-12-19 17:48         ` Sergei Shtylyov [this message]
2013-12-19 16:21   ` David Laight
2013-12-19 10:10 ` [PATCH 4/7] drivers: usb: Include appropriate header file in pci-quirks.c Rashika Kheria
2013-12-19 15:51   ` Alan Stern
2013-12-19 16:00     ` josh
2013-12-19 10:12 ` [PATCH 5/7] drivers: usb: Mark function as static in usbsevseg.c Rashika Kheria
2013-12-19 10:13 ` [PATCH 6/7] drivers: usb: Mark function as static in metro-usb.c Rashika Kheria
2013-12-19 10:14 ` [PATCH 7/7] drivers: usb: Include appropriate header file in phy-am335x-control.c Rashika Kheria
2013-12-19 16:36 ` [PATCH 1/7] drivers: usb: Include appropriate header file in hcd.c Greg Kroah-Hartman
2013-12-19 16:41   ` Rashika Kheria
2013-12-19 16:58     ` Greg Kroah-Hartman
2013-12-19 17:33       ` David Laight
2013-12-19 18:35         ` Josh Triplett
2013-12-20  9:40           ` David Laight
2013-12-19 18:34       ` Josh Triplett
2013-12-19 18:22 ` Greg Kroah-Hartman

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=52B33180.60701@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=rashika.kheria@gmail.com \
    --cc=stern@rowland.harvard.edu \
    /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