[staging-next 10/12] stagine/easycap: make functions regset and regget static

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

 



regget and regset functions are used only from within
easycap_low.c so they can be static
Move the functions to avoid forward declarations
Move GET and SET macro definitions into the c-file

Cc: Mike Thomas <rmthomas@xxxxxxxxxxx>
Signed-off-by: Tomas Winkler <tomas.winkler@xxxxxxxxx>
---
 drivers/staging/easycap/easycap.h     |   23 ----
 drivers/staging/easycap/easycap_low.c |  182 ++++++++++++++++++---------------
 2 files changed, 100 insertions(+), 105 deletions(-)

diff --git a/drivers/staging/easycap/easycap.h b/drivers/staging/easycap/easycap.h
index 7ce3444..0ee60af 100644
--- a/drivers/staging/easycap/easycap.h
+++ b/drivers/staging/easycap/easycap.h
@@ -575,8 +575,6 @@ int              stop_100(struct usb_device *);
 int              write_300(struct usb_device *);
 int              read_vt(struct usb_device *, u16);
 int              write_vt(struct usb_device *, u16, u16);
-int              regset(struct usb_device *, u16, u16);
-int              regget(struct usb_device *, u16, void *);
 int		isdongle(struct easycap *);
 /*---------------------------------------------------------------------------*/
 struct signed_div_result {
@@ -587,27 +585,6 @@ struct signed_div_result {
 
 /*---------------------------------------------------------------------------*/
 /*
- *  MACROS
- */
-/*---------------------------------------------------------------------------*/
-#define GET(X, Y, Z) do { \
-	int __rc; \
-	*(Z) = (u16)0; \
-	__rc = regget(X, Y, Z); \
-	if (0 > __rc) { \
-		JOT(8, ":-(%i\n", __LINE__);  return __rc; \
-	} \
-} while (0)
-
-#define SET(X, Y, Z) do { \
-	int __rc; \
-	__rc = regset(X, Y, Z); \
-	if (0 > __rc) { \
-		JOT(8, ":-(%i\n", __LINE__);  return __rc; \
-	} \
-} while (0)
-/*---------------------------------------------------------------------------*/
-/*
  *  MACROS SAM(...) AND JOM(...) ALLOW DIAGNOSTIC OUTPUT TO BE TAGGED WITH
  *  THE IDENTITY OF THE DONGLE TO WHICH IT APPLIES, BUT IF INVOKED WHEN THE
  *  POINTER peasycap IS INVALID AN Oops IS LIKELY, AND ITS CAUSE MAY NOT BE
diff --git a/drivers/staging/easycap/easycap_low.c b/drivers/staging/easycap/easycap_low.c
index 1ed90f9..39e22d5 100644
--- a/drivers/staging/easycap/easycap_low.c
+++ b/drivers/staging/easycap/easycap_low.c
@@ -40,6 +40,23 @@
 
 #include "easycap.h"
 
+#define GET(X, Y, Z) do { \
+	int __rc; \
+	*(Z) = (u16)0; \
+	__rc = regget(X, Y, Z); \
+	if (0 > __rc) { \
+		JOT(8, ":-(%i\n", __LINE__);  return __rc; \
+	} \
+} while (0)
+
+#define SET(X, Y, Z) do { \
+	int __rc; \
+	__rc = regset(X, Y, Z); \
+	if (0 > __rc) { \
+		JOT(8, ":-(%i\n", __LINE__);  return __rc; \
+	} \
+} while (0)
+
 /*--------------------------------------------------------------------------*/
 static const struct stk1160config {
 	int reg;
@@ -238,7 +255,89 @@ static const struct saa7113config saa7113configNTSC[256] = {
 
 		{0xFF, 0xFF}
 };
-/*--------------------------------------------------------------------------*/
+
+static int regget(struct usb_device *pusb_device, u16 index, void *pvoid)
+{
+	int rc;
+
+	if (!pusb_device)
+		return -ENODEV;
+
+	rc = usb_control_msg(pusb_device, usb_rcvctrlpipe(pusb_device, 0),
+			(u8)0x00,
+			(u8)(USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE),
+			(u16)0x00,
+			(u16)index,
+			(void *)pvoid,
+			sizeof(u8),
+			(int)50000);
+
+	return 0xFF & rc;
+}
+
+static int regset(struct usb_device *pusb_device, u16 index, u16 value)
+{
+	u16 igot;
+	int rc0, rc1;
+
+	if (!pusb_device)
+		return -ENODEV;
+
+	rc1 = 0;  igot = 0;
+	rc0 = usb_control_msg(pusb_device, usb_sndctrlpipe(pusb_device, 0),
+			(u8)0x01,
+			(u8)(USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE),
+			(u16)value,
+			(u16)index,
+			NULL,
+			(u16)0,
+			(int)500);
+
+#ifdef NOREADBACK
+#
+#else
+	rc1 = usb_control_msg(pusb_device, usb_rcvctrlpipe(pusb_device, 0),
+			(u8)0x00,
+			(u8)(USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE),
+			(u16)0x00,
+			(u16)index,
+			(void *)&igot,
+			(u16)sizeof(u16),
+			(int)50000);
+	igot = 0xFF & igot;
+	switch (index) {
+	case 0x000:
+	case 0x500:
+	case 0x502:
+	case 0x503:
+	case 0x504:
+	case 0x506:
+	case 0x507:
+		break;
+
+	case 0x204:
+	case 0x205:
+	case 0x350:
+	case 0x351:
+		if (0 != (0xFF & igot)) {
+			JOT(8, "unexpected 0x%02X for STK register 0x%03X\n",
+								igot, index);
+		}
+		break;
+
+	default:
+		if ((0xFF & value) != (0xFF & igot)) {
+			JOT(8, "unexpected 0x%02X != 0x%02X "
+						"for STK register 0x%03X\n",
+						igot, value, index);
+		}
+		break;
+	}
+#endif /* ! NOREADBACK*/
+
+	return (0 > rc0) ? rc0 : rc1;
+}
+/*****************************************************************************/
 
 /****************************************************************************/
 int
@@ -903,87 +1002,6 @@ for (k = 0;  k < max;  k++) {
 return -1;
 }
 /****************************************************************************/
-int regset(struct usb_device *pusb_device, u16 index, u16 value)
-{
-	u16 igot;
-	int rc0, rc1;
-
-	if (!pusb_device)
-		return -ENODEV;
-
-	rc1 = 0;  igot = 0;
-	rc0 = usb_control_msg(pusb_device, usb_sndctrlpipe(pusb_device, 0),
-			(u8)0x01,
-			(u8)(USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE),
-			(u16)value,
-			(u16)index,
-			NULL,
-			(u16)0,
-			(int)500);
-
-#ifdef NOREADBACK
-#
-#else
-	rc1 = usb_control_msg(pusb_device, usb_rcvctrlpipe(pusb_device, 0),
-			(u8)0x00,
-			(u8)(USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE),
-			(u16)0x00,
-			(u16)index,
-			(void *)&igot,
-			(u16)sizeof(u16),
-			(int)50000);
-	igot = 0xFF & igot;
-	switch (index) {
-	case 0x000:
-	case 0x500:
-	case 0x502:
-	case 0x503:
-	case 0x504:
-	case 0x506:
-	case 0x507:
-		break;
-
-	case 0x204:
-	case 0x205:
-	case 0x350:
-	case 0x351:
-		if (0 != (0xFF & igot)) {
-			JOT(8, "unexpected 0x%02X for STK register 0x%03X\n",
-								igot, index);
-		}
-		break;
-
-	default:
-		if ((0xFF & value) != (0xFF & igot)) {
-			JOT(8, "unexpected 0x%02X != 0x%02X "
-						"for STK register 0x%03X\n",
-						igot, value, index);
-		}
-		break;
-	}
-#endif /* ! NOREADBACK*/
-
-	return (0 > rc0) ? rc0 : rc1;
-}
-/*****************************************************************************/
-int regget(struct usb_device *pusb_device, u16 index, void *pvoid)
-{
-	int rc;
-
-	if (!pusb_device)
-		return -ENODEV;
-
-	rc = usb_control_msg(pusb_device, usb_rcvctrlpipe(pusb_device, 0),
-			(u8)0x00,
-			(u8)(USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE),
-			(u16)0x00,
-			(u16)index,
-			(void *)pvoid,
-			sizeof(u8),
-			(int)50000);
-
-	return 0xFF & rc;
-}
 /*****************************************************************************/
 int
 wakeup_device(struct usb_device *pusb_device)
-- 
1.7.4

---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux