Skip to contentSkip to conversation

media:gspca:dtcs033 Clean sparse check warnings on endianess

PATCH In review Robert Butora 2 participants 2 messages Apr 16, 2014 – Apr 18, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media:gspca:dtcs033 Clean sparse check warnings on endianess

Warnings due to __le16 / u16 conversions. Replace offending struct and so stay on cpu domain.

---
 drivers/media/usb/gspca/dtcs033.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/media/usb/gspca/dtcs033.c +11 -4
index 5e42c71..96bfd4e 100644
@@ -22,6 +22,13 @@ MODULE_AUTHOR("Robert Butora <[email protected]>");
 MODULE_DESCRIPTION("Scopium DTCS033 astro-cam USB Camera Driver");
 MODULE_LICENSE("GPL");
 
+struct dtcs033_usb_requests {
+	u8 bRequestType;
+	u8 bRequest;
+	u16 wValue;
+	u16 wIndex;
+	u16 wLength;
+};
 
 /* send a usb request */
 static void reg_rw(struct gspca_dev *gspca_dev,
@@ -50,10 +57,10 @@ static void reg_rw(struct gspca_dev *gspca_dev,
 }
 /* send several usb in/out requests */
 static int reg_reqs(struct gspca_dev *gspca_dev,
-		    const struct usb_ctrlrequest *preqs, int n_reqs)
+		    const struct dtcs033_usb_requests *preqs, int n_reqs)
 {
 	int i = 0;
-	const struct usb_ctrlrequest *preq;
+	const struct dtcs033_usb_requests *preq;
 
 	while ((i < n_reqs) && (gspca_dev->usb_err >= 0)) {
 
@@ -290,7 +297,7 @@ module_usb_driver(sd_driver);
  0x40 =  USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
  0xC0 =  USB_DIR_IN  | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
 */
-static const struct usb_ctrlrequest dtcs033_start_reqs[] = {
+static const struct dtcs033_usb_requests dtcs033_start_reqs[] = {
 /* -- bRequest,wValue,wIndex,wLength */
 { 0x40, 0x01, 0x0001, 0x000F, 0x0000 },
 { 0x40, 0x01, 0x0000, 0x000F, 0x0000 },
@@ -414,7 +421,7 @@ static const struct usb_ctrlrequest dtcs033_start_reqs[] = {
 { 0x40, 0x01, 0x0003, 0x000F, 0x0000 }
 };
 
-static const struct usb_ctrlrequest dtcs033_stop_reqs[] = {
+static const struct dtcs033_usb_requests dtcs033_stop_reqs[] = {
 /* -- bRequest,wValue,wIndex,wLength */
 { 0x40, 0x01, 0x0001, 0x000F, 0x0000 },
 { 0x40, 0x01, 0x0000, 0x000F, 0x0000 },
Signature · 1 line
1.8.3.2
#1 lore raw

Hi,

Quoted 4 lines · Robert Butora

Warnings due to __le16 / u16 conversions. Replace offending struct and so stay on cpu domain.

Thanks, I'll include this in my next pull-req to Mauro.

Regards,

Hans

Quoted 54 lines
---
 drivers/media/usb/gspca/dtcs033.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/media/usb/gspca/dtcs033.c +11 -4
index 5e42c71..96bfd4e 100644
@@ -22,6 +22,13 @@ MODULE_AUTHOR("Robert Butora <[email protected]>");
 MODULE_DESCRIPTION("Scopium DTCS033 astro-cam USB Camera Driver");
 MODULE_LICENSE("GPL");
 
+struct dtcs033_usb_requests {
+	u8 bRequestType;
+	u8 bRequest;
+	u16 wValue;
+	u16 wIndex;
+	u16 wLength;
+};
 
 /* send a usb request */
 static void reg_rw(struct gspca_dev *gspca_dev,
@@ -50,10 +57,10 @@ static void reg_rw(struct gspca_dev *gspca_dev,
 }
 /* send several usb in/out requests */
 static int reg_reqs(struct gspca_dev *gspca_dev,
-		    const struct usb_ctrlrequest *preqs, int n_reqs)
+		    const struct dtcs033_usb_requests *preqs, int n_reqs)
 {
 	int i = 0;
-	const struct usb_ctrlrequest *preq;
+	const struct dtcs033_usb_requests *preq;
 
 	while ((i < n_reqs) && (gspca_dev->usb_err >= 0)) {
 
@@ -290,7 +297,7 @@ module_usb_driver(sd_driver);
  0x40 =  USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
  0xC0 =  USB_DIR_IN  | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
 */
-static const struct usb_ctrlrequest dtcs033_start_reqs[] = {
+static const struct dtcs033_usb_requests dtcs033_start_reqs[] = {
 /* -- bRequest,wValue,wIndex,wLength */
 { 0x40, 0x01, 0x0001, 0x000F, 0x0000 },
 { 0x40, 0x01, 0x0000, 0x000F, 0x0000 },
@@ -414,7 +421,7 @@ static const struct usb_ctrlrequest dtcs033_start_reqs[] = {
 { 0x40, 0x01, 0x0003, 0x000F, 0x0000 }
 };
 
-static const struct usb_ctrlrequest dtcs033_stop_reqs[] = {
+static const struct dtcs033_usb_requests dtcs033_stop_reqs[] = {
 /* -- bRequest,wValue,wIndex,wLength */
 { 0x40, 0x01, 0x0001, 0x000F, 0x0000 },
 { 0x40, 0x01, 0x0000, 0x000F, 0x0000 },