Re: [PATCH 1/1] drivers/usb/image/mdc800.c: Remove "typdef enum".

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

 



On Sun, Apr 17, 2011 at 9:54 PM, Wanlong Gao <wanlong.gao@xxxxxxxxx> wrote:
> On 4/18/11, Thiago Farina <tfransosi@xxxxxxxxx> wrote:
>> Instead use the keyword "enum" where we use it.
>>
>> Signed-off-by: Thiago Farina <tfransosi@xxxxxxxxx>
>> ---
>> Âdrivers/usb/image/mdc800.c | Â111
>> +++++++++++++++++++++----------------------
>> Â1 files changed, 54 insertions(+), 57 deletions(-)
>>
>> diff --git a/drivers/usb/image/mdc800.c b/drivers/usb/image/mdc800.c
>> index 575b56c..4b0a032 100644
>> --- a/drivers/usb/image/mdc800.c
>> +++ b/drivers/usb/image/mdc800.c
>> @@ -122,59 +122,57 @@
>> Â/* Minor Number of the device (create with mknod /dev/mustek c 180 32) */
>> Â#define MDC800_DEVICE_MINOR_BASE 32
>>
>> +/*
>> + * Data and structs.
>> + */
>>
>> -/**************************************************************************
>> - Â Â Data and structs
>> -***************************************************************************/
>> -
>> -
>> -typedef enum {
>> +enum mdc800_state {
>> Â Â Â NOT_CONNECTED, READY, WORKING, DOWNLOAD
>> -} mdc800_state;
>> +};
>>
>>
>> -/* Data for the driver */
>> +/* Data for the driver. */
>> Âstruct mdc800_data
>> Â{
>> - Â Â struct usb_device * Â Â dev; Â Â Â Â Â Â Â Â Â Â// Device Data
>> -   mdc800_state      Âstate;
>> + Â Â struct usb_device* Â Â Âdev; Â Â Â Â Â Â Â Â Â/* Device Data. */
>> +   enum mdc800_state    state;
>>
>> -   unsigned int      Âendpoint [4];
>> +   unsigned int      Âendpoint[4];
>>
>> - Â Â struct urb * Â Â Â Â Â Âirq_urb;
>> + Â Â struct urb* Â Â Â Â Â Â irq_urb;
>>    wait_queue_head_t    irq_wait;
>>    int           irq_woken;
>> Â Â Â char* Â Â Â Â Â Â Â Â Â irq_urb_buffer;
>>
>> -   int           camera_busy;     Â// is camera busy ?
>> -   int           camera_request_ready; // Status to synchronize with irq
>> -   char          Âcamera_response [8]; Â// last Bytes send after busy
>> +   int           camera_busy;     Â/* Is camera busy? */
>> +   int           camera_request_ready; /* Status to synchronize with irq. */
>> +   char          Âcamera_response[8];  /* last Bytes send after busy. */
>>
>> - Â Â struct urb * Â Â Â Â Â Âwrite_urb;
>> + Â Â struct urb* Â Â Â Â Â Â write_urb;
>> Â Â Â char* Â Â Â Â Â Â Â Â Â write_urb_buffer;
>>    wait_queue_head_t    write_wait;
>>    int           written;
>>
>>
>> - Â Â struct urb * Â Â Â Â Â Âdownload_urb;
>> + Â Â struct urb* Â Â Â Â Â Â download_urb;
>> Â Â Â char* Â Â Â Â Â Â Â Â Â download_urb_buffer;
>>    wait_queue_head_t    download_wait;
>>    int           downloaded;
>> -   int           download_left;     Â// Bytes left to download ?
>> +   int           download_left;    /* Bytes left to download? */
>>
>>
>> Â Â Â /* Device Data */
>> -   char          Âout [64];    // Answer Buffer
>> -   int           out_ptr;    Â// Index to the first not readen byte
>> -   int           out_count;   Â// Bytes in the buffer
>> +   char          Âout[64];    Â/* Answer buffer. */
>> +   int           out_ptr;    Â/* Index to the first not readen byte. */
>> +   int           out_count;   Â/* Bytes in the buffer. */
>>
>> -   int           open;      // Camera device open ?
>> -   struct mutex      Âio_lock;    Â// IO -lock
>> +   int           open;      /* Camera device open. */
>> +   struct mutex      Âio_lock;    Â/* IO -lock. */
>>
>> -   char          Âin [8];     // Command Input Buffer
>> -   int           in_count;
>> +   char          Âin [8];     /* Command Input Buffer. */
>> +   int           in_count;
>>
>> -   int           pic_index;   Â// Cache for the Imagesize (-1 for nothing cached )
>> +   int           pic_index;   Â/* Cache for the Imagesize (-1 for nothing cached) */
>>    int           pic_len;
>>    int           minor;
>> Â};
>> @@ -183,52 +181,51 @@ struct mdc800_data
>> Â/* Specification of the Endpoints */
>> Âstatic struct usb_endpoint_descriptor mdc800_ed [4] =
>> Â{
>> - Â Â {
>> - Â Â Â Â Â Â .bLength = Â Â Â Â Â Â Â0,
>> + Â Â {
>> + Â Â Â Â Â Â .bLength = Â Â Â Â Â Â Â0,
>> Â Â Â Â Â Â Â .bDescriptorType = Â Â Â0,
>> Â Â Â Â Â Â Â .bEndpointAddress = Â Â 0x01,
>> - Â Â Â Â Â Â .bmAttributes = Â Â Â Â 0x02,
>> + Â Â Â Â Â Â .bmAttributes = Â Â Â Â 0x02,
>> Â Â Â Â Â Â Â .wMaxPacketSize = Â Â Â cpu_to_le16(8),
>> - Â Â Â Â Â Â .bInterval = Â Â Â Â Â Â0,
>> - Â Â Â Â Â Â .bRefresh = Â Â Â Â Â Â 0,
>> - Â Â Â Â Â Â .bSynchAddress = Â Â Â Â0,
>> + Â Â Â Â Â Â .bInterval = Â Â Â Â Â Â0,
>> + Â Â Â Â Â Â .bRefresh = Â Â Â Â Â Â 0,
>> + Â Â Â Â Â Â .bSynchAddress = Â Â Â Â0,
>> Â Â Â },
>> Â Â Â {
>> - Â Â Â Â Â Â .bLength = Â Â Â Â Â Â Â0,
>> - Â Â Â Â Â Â .bDescriptorType = Â Â Â0,
>> - Â Â Â Â Â Â .bEndpointAddress = Â Â 0x82,
>> - Â Â Â Â Â Â .bmAttributes = Â Â Â Â 0x03,
>> - Â Â Â Â Â Â .wMaxPacketSize = Â Â Â cpu_to_le16(8),
>> - Â Â Â Â Â Â .bInterval = Â Â Â Â Â Â0,
>> - Â Â Â Â Â Â .bRefresh = Â Â Â Â Â Â 0,
>> - Â Â Â Â Â Â .bSynchAddress = Â Â Â Â0,
>> + Â Â Â Â Â Â .bLength = Â Â Â Â Â Â Â0,
>> + Â Â Â Â Â Â .bDescriptorType = Â Â Â0,
>> + Â Â Â Â Â Â .bEndpointAddress = Â Â 0x82,
>> + Â Â Â Â Â Â .bmAttributes = Â Â Â Â 0x03,
>> + Â Â Â Â Â Â .wMaxPacketSize = Â Â Â cpu_to_le16(8),
>> + Â Â Â Â Â Â .bInterval = Â Â Â Â Â Â0,
>> + Â Â Â Â Â Â .bRefresh = Â Â Â Â Â Â 0,
>> + Â Â Â Â Â Â .bSynchAddress = Â Â Â Â0,
>> Â Â Â },
>> Â Â Â {
>> - Â Â Â Â Â Â .bLength = Â Â Â Â Â Â Â0,
>> - Â Â Â Â Â Â .bDescriptorType = Â Â Â0,
>> - Â Â Â Â Â Â .bEndpointAddress = Â Â 0x03,
>> - Â Â Â Â Â Â .bmAttributes = Â Â Â Â 0x02,
>> - Â Â Â Â Â Â .wMaxPacketSize = Â Â Â cpu_to_le16(64),
>> - Â Â Â Â Â Â .bInterval = Â Â Â Â Â Â0,
>> - Â Â Â Â Â Â .bRefresh = Â Â Â Â Â Â 0,
>> - Â Â Â Â Â Â .bSynchAddress = Â Â Â Â0,
>> + Â Â Â Â Â Â .bLength = Â Â Â Â Â Â Â0,
>> + Â Â Â Â Â Â .bDescriptorType = Â Â Â0,
>> + Â Â Â Â Â Â .bEndpointAddress = Â Â 0x03,
>> + Â Â Â Â Â Â .bmAttributes = Â Â Â Â 0x02,
>> + Â Â Â Â Â Â .wMaxPacketSize = Â Â Â cpu_to_le16(64),
>> + Â Â Â Â Â Â .bInterval = Â Â Â Â Â Â0,
>> + Â Â Â Â Â Â .bRefresh = Â Â Â Â Â Â 0,
>> + Â Â Â Â Â Â .bSynchAddress = Â Â Â Â0,
>> Â Â Â },
>> Â Â Â {
>> - Â Â Â Â Â Â .bLength = Â Â Â Â Â Â Â0,
>> - Â Â Â Â Â Â .bDescriptorType = Â Â Â0,
>> - Â Â Â Â Â Â .bEndpointAddress = Â Â 0x84,
>> - Â Â Â Â Â Â .bmAttributes = Â Â Â Â 0x02,
>> - Â Â Â Â Â Â .wMaxPacketSize = Â Â Â cpu_to_le16(64),
>> - Â Â Â Â Â Â .bInterval = Â Â Â Â Â Â0,
>> - Â Â Â Â Â Â .bRefresh = Â Â Â Â Â Â 0,
>> - Â Â Â Â Â Â .bSynchAddress = Â Â Â Â0,
>> + Â Â Â Â Â Â .bLength = Â Â Â Â Â Â Â0,
>> + Â Â Â Â Â Â .bDescriptorType = Â Â Â0,
>> + Â Â Â Â Â Â .bEndpointAddress = Â Â 0x84,
>> + Â Â Â Â Â Â .bmAttributes = Â Â Â Â 0x02,
>> + Â Â Â Â Â Â .wMaxPacketSize = Â Â Â cpu_to_le16(64),
>> + Â Â Â Â Â Â .bInterval = Â Â Â Â Â Â0,
>> + Â Â Â Â Â Â .bRefresh = Â Â Â Â Â Â 0,
>> + Â Â Â Â Â Â .bSynchAddress = Â Â Â Â0,
>> Â Â Â },
>> Â};
>>
>> Â/* The Variable used by the driver */
>> Âstatic struct mdc800_data* mdc800;
>>
>> -
>> /***************************************************************************
>> Â Â Â The USB Part of the driver
>> ****************************************************************************/
>> --
>> 1.7.3.2.343.g7d43d
>>
> Why did you change it ?

To get rid of the typedef?

> and why change so many lines ?

Removed whitespaces, and converted // to /* */

> It had some thing wrong ?

Hum?
ÿô.nlj·Ÿ®‰­†+%ŠË±é¥Šwÿº{.nlj·¥Š{±þë)íèjg¬±¨¶‰šŽŠÝjÿ¾«þG«é¸¢·¦j:+v‰¨Šwèm¶Ÿÿþø®w¥þŠà£¢·hšâÿ†Ù



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

  Powered by Linux