From: Eric Lescouet on
Hi,

The USBIP modules (and some others) have a direct dependency on the following headers:
- drivers/usb/core/hdc.h (struct usb_hcd and various routines)
- drivers/usb/core/hub.h (couple of constants)
Because those headers are not part of include/, it makes it quite difficult
to compile them as standalone modules (e.g.: against pre-compiled kernel).

hdc.c and hub.c are relatively self-contained and could be moved to e.g.: include/linux/usb/.

What do you think?

Thanks,
Eric.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Alan Stern on
On Fri, 23 Apr 2010, Greg KH wrote:

> On Fri, Apr 23, 2010 at 12:44:11PM +0200, Eric Lescouet wrote:
> > Hi,
> >
> > The USBIP modules (and some others) have a direct dependency on the following headers:
> > - drivers/usb/core/hdc.h (struct usb_hcd and various routines)
> > - drivers/usb/core/hub.h (couple of constants)
> > Because those headers are not part of include/, it makes it quite difficult
> > to compile them as standalone modules (e.g.: against pre-compiled kernel).
>
> Then don't do that :)
>
> > hdc.c and hub.c are relatively self-contained and could be moved to e.g.: include/linux/usb/.
> >
> > What do you think?
>
> I think the code needs to be cleaned up and merged to the main part of
> the kernel tree, then this wouldn't be an issue, right?

I think moving hub.h into include/linux/usb would be a good thing.
However, if this is done then the file contents should be rearranged
slightly:

Everything from the "Hub request types" comment through the
various HUB_TTTT_* definitions (except the line declaring
struct usb_device) should be extracted into a separate file.
This new file could be called ch11.h (because it contains
constants and structures from Chapter 11 of the USB 2.0 spec,
just as ch9.h contains information from Chapter 9) or it
could keep the name hub.h. It could even be exported as
a userspace header file.

The remainder (not very much) should be merged into hcd.h.

Once that's done, moving hcd.h into include/linux/usb would be a
reasonable thing to do as well. It is shared between usbcore and the
HCDs, so it really does belong in a more public location.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Eric Lescouet on
Greg KH wrote:
> On Fri, Apr 23, 2010 at 11:52:26AM -0400, Alan Stern wrote:
>> On Fri, 23 Apr 2010, Greg KH wrote:
>>
>>> On Fri, Apr 23, 2010 at 12:44:11PM +0200, Eric Lescouet wrote:
>>>> Hi,
>>>>
>>>> The USBIP modules (and some others) have a direct dependency on the following headers:
>>>> - drivers/usb/core/hdc.h (struct usb_hcd and various routines)
>>>> - drivers/usb/core/hub.h (couple of constants)
>>>> Because those headers are not part of include/, it makes it quite difficult
>>>> to compile them as standalone modules (e.g.: against pre-compiled kernel).
>>> Then don't do that :)
>>>
>>>> hdc.c and hub.c are relatively self-contained and could be moved to e.g.: include/linux/usb/.
>>>>
>>>> What do you think?
>>> I think the code needs to be cleaned up and merged to the main part of
>>> the kernel tree, then this wouldn't be an issue, right?
>> I think moving hub.h into include/linux/usb would be a good thing.
>> However, if this is done then the file contents should be rearranged
>> slightly:
>>
>> Everything from the "Hub request types" comment through the
>> various HUB_TTTT_* definitions (except the line declaring
>> struct usb_device) should be extracted into a separate file.
>> This new file could be called ch11.h (because it contains
>> constants and structures from Chapter 11 of the USB 2.0 spec,
>> just as ch9.h contains information from Chapter 9) or it
>> could keep the name hub.h. It could even be exported as
>> a userspace header file.
>>
>> The remainder (not very much) should be merged into hcd.h.
>>
>> Once that's done, moving hcd.h into include/linux/usb would be a
>> reasonable thing to do as well. It is shared between usbcore and the
>> HCDs, so it really does belong in a more public location.
>
> Ok, fair enough. Patches are always welcome :)
>
> thanks,
>
> greg k-h

If I understand correctly, splitting hub.h into hub.h + ch11.h is
independent of the move. At the end the 2 (or 3 files) would end up
into include/linux/usb/.
correct?

I've tried to move hub.h and hcd.h and to compile the kernel, already.
Changing the path of the #include directives in ~40 files did the trick.

Would you like 2 patches (move and then split) or only 1?

Thanks,
Eric.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Alan Stern on
On Fri, 23 Apr 2010, Eric Lescouet wrote:

> If I understand correctly, splitting hub.h into hub.h + ch11.h is
> independent of the move. At the end the 2 (or 3 files) would end up
> into include/linux/usb/.
> correct?

Two files. The first would be ch11.h (or maybe keep the name hub.h;
I'm not sure which is best), and the second would be hcd.h (including
the leftover parts from the original hub.h).

> I've tried to move hub.h and hcd.h and to compile the kernel, already.
> Changing the path of the #include directives in ~40 files did the trick.
>
> Would you like 2 patches (move and then split) or only 1?

If it weren't for the rename, I'd say do it in two patches. But if the
name is changed to ch11.h then those 40 files would have to be altered
twice.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Eric Lescouet on
Alan Stern wrote:
> On Fri, 23 Apr 2010, Eric Lescouet wrote:
>
>> If I understand correctly, splitting hub.h into hub.h + ch11.h is
>> independent of the move. At the end the 2 (or 3 files) would end up
>> into include/linux/usb/.
>> correct?
>
> Two files. The first would be ch11.h (or maybe keep the name hub.h;
> I'm not sure which is best), and the second would be hcd.h (including
> the leftover parts from the original hub.h).
>

OK. understood now ;-)

>> I've tried to move hub.h and hcd.h and to compile the kernel, already.
>> Changing the path of the #include directives in ~40 files did the trick.
>>
>> Would you like 2 patches (move and then split) or only 1?
>
> If it weren't for the rename, I'd say do it in two patches. But if the
> name is changed to ch11.h then those 40 files would have to be altered
> twice.
>
> Alan Stern
>

Well, most of the files include hcd.h (which includes hub.h),
only ~4 of them directly use hub.h.
So what's your vote? rename hub.h into ch11.h?

Eric.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/