Re: [PATCH 4/5] usb/s3c2410_udc: use platform ids instead

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

 



Hi,

On Tue, Jun 14, 2011 at 09:38:05AM +0200, Sebastian Andrzej Siewior wrote:
> * Kukjin Kim | 2011-06-14 11:33:11 [+0900]:
> 
> >Hi Felipe and Sebastian,
> Hi Kukjin,
> 
> >> ACKs ?
> >> 
> >Hmm...
> >
> >In this case, proper platform_driver_unregister should be added if need to
> >fix the error path.
> >
> >I think, since the S3C2410 H/W fifo_size of the EP[1~4] is different with
> >S3C2440, we need to handle it now. Of course the USB 1.1 bulk max packet is
> >64 bytes and according to current driver code handles just 64bytes fifo_size
> >during write_packet not 128bytes fifo_size.
> >
> >So it seems we don't need to handle different fifo_size but if required, to
> >add its handling looks better.
> 
> You need to difference between those two chips in your probe function
> and I don't know how do you want to do this without ids. So what about I
> add this to the patch:
> 
>     enum s3c_udc_type {
>         S3C2410-USBGADGET,
>         S3C2440-USBGADGET,
>     };
>     
>     static const struct platform_device_id s3c_udc_ids[] = {
>         { "s3c2410-usbgadget", s3c2410-usbgadget},
>         { "s3c2440-usbgadget", s3c2440-usbgadget},
>     };
>     MODULE_DEVICE_TABLE(platform, s3c_udc_ids);
> 
> and once you are going to add the different fifo sizes to the driver you
> can use:
> 
>     const struct platform_device_id *id = platform_get_device_id(dev);
>     enum s3c_udc_type udc_type = id->driver_data;
> 
> in the probe function. What do you think?

if this is the only different between them, it's fine. But if there are
more, you rather use something like:

struct s3c_udc_features {
	unsigned int	fifo_size;
	unsigned int	foo;
	...
};

static const struct s3c_udc_features s3c2410_features __devinitconst = {
	.fifo_size	= bla,
	.foo		= bar,
};

static const struct s3c_udc_features s3c2440_features __devinitconst = {
	.fifo_size	= bla,
	.foo		= bar,
};

static const struct platform_device_id s3c_udc_ids[] = {
	{ "s3c2410-usbgadget", &s3c2410_features},
	{ "s3c2440-usbgadget", &s3c2440_features},
};
MODULE_DEVICE_TABLE(platform, s3c_udc_ids);

-- 
balbi

Attachment: signature.asc
Description: Digital signature


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

  Powered by Linux