Re: [RFC PATCH 1/3] usb: convert port_owners type from void * to struct dev_state *

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 20 Jun 2012, Sergei Shtylyov wrote:

> Hello.
> 
> On 20-06-2012 6:06, Lan Tianyu wrote:
> 
> >>> -struct dev_state {
> >>> - struct list_head list; /* state list */
> >>> - struct usb_device *dev;
> >>> - struct file *file;
> >>> - spinlock_t lock; /* protects the async urb lists */
> >>> - struct list_head async_pending;
> >>> - struct list_head async_completed;
> >>> - wait_queue_head_t wait; /* wake up if a request completed */
> >>> - unsigned int discsignr;
> >>> - struct pid *disc_pid;
> >>> - const struct cred *cred;
> >>> - void __user *disccontext;
> >>> - unsigned long ifclaimed;
> >>> - u32 secid;
> >>> - u32 disabled_bulk_eps;
> >>> -};
> 
> >> Please don't move the definition of this structure. It is private to
> >> devio.c.
> 
> > But the struct dev_state will be used in the hub.c.
> 
>     Only to declare the pointer to that structure. We don't need to know its 
> members for that.

Right.  To put it another way, hub.c doesn't use struct dev_state -- it
uses only _pointers_ to struct dev_state, which is quite a different
thing.

> > Is there
> > other ways to do that without moving the definition of struct
> > dev_state to a head file?
> 
>     Yes, of course: incomplete declaration of the structure in hub.c:
> 
> struct dev_state;

Even that isn't needed.  The compiler will realize that dev_state is an 
incomplete structure the first time it sees

	struct dev_state	*owner;

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux