aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2005-03-29 06:47:47 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2005-03-29 06:47:47 -0800
commit2d615d2bda151f93bb626695be41663e38954828 (patch)
tree1add01ecb6012646fb85eede5c1202def4aea092
parentc2d295511be28543893c0bb21cc7f4b52dc2d2a9 (diff)
downloadhistory-2d615d2bda151f93bb626695be41663e38954828.tar.gz
USB: fix up a lot of sparse warnings and bugs in the pwc driver.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/usb/media/pwc/pwc-ctrl.c4
-rw-r--r--drivers/usb/media/pwc/pwc-dec23.c4
-rw-r--r--drivers/usb/media/pwc/pwc-if.c39
3 files changed, 24 insertions, 23 deletions
diff --git a/drivers/usb/media/pwc/pwc-ctrl.c b/drivers/usb/media/pwc/pwc-ctrl.c
index 8ee3c122a39de..26aa914bc541a 100644
--- a/drivers/usb/media/pwc/pwc-ctrl.c
+++ b/drivers/usb/media/pwc/pwc-ctrl.c
@@ -341,7 +341,7 @@ static inline int set_video_mode_Timon(struct pwc_device *pdev, int size, int fr
static inline int set_video_mode_Kiara(struct pwc_device *pdev, int size, int frames, int compression, int snapshot)
{
- const struct Kiara_table_entry *pChoose = 0;
+ const struct Kiara_table_entry *pChoose = NULL;
int fps, ret;
unsigned char buf[12];
struct Kiara_table_entry RawEntry = {6, 773, 1272, {0xAD, 0xF4, 0x10, 0x27, 0xB6, 0x24, 0x96, 0x02, 0x30, 0x05, 0x03, 0x80}};
@@ -1087,7 +1087,7 @@ static inline int pwc_get_dynamic_noise(struct pwc_device *pdev, int *noise)
return 0;
}
-int pwc_mpt_reset(struct pwc_device *pdev, int flags)
+static int pwc_mpt_reset(struct pwc_device *pdev, int flags)
{
unsigned char buf;
diff --git a/drivers/usb/media/pwc/pwc-dec23.c b/drivers/usb/media/pwc/pwc-dec23.c
index 0a7ebd00cf1c7..98fa3f7a9eff4 100644
--- a/drivers/usb/media/pwc/pwc-dec23.c
+++ b/drivers/usb/media/pwc/pwc-dec23.c
@@ -87,7 +87,7 @@ static void fill_table_d000(unsigned char *p)
* Timon: 0 <= ver <= 15
*
*/
-void fill_table_color(unsigned int version, const unsigned int *romtable,
+static void fill_table_color(unsigned int version, const unsigned int *romtable,
unsigned char *p0004,
unsigned char *p8004)
{
@@ -150,7 +150,7 @@ void fill_table_color(unsigned int version, const unsigned int *romtable,
* precision = (pdev->xx + pdev->yy)
*
*/
-void fill_table_dc00_d800(unsigned int precision, unsigned int *pdc00, unsigned int *pd800)
+static void fill_table_dc00_d800(unsigned int precision, unsigned int *pdc00, unsigned int *pd800)
{
int i;
unsigned int offset1, offset2;
diff --git a/drivers/usb/media/pwc/pwc-if.c b/drivers/usb/media/pwc/pwc-if.c
index 0881548995fe3..a4532288ae4a7 100644
--- a/drivers/usb/media/pwc/pwc-if.c
+++ b/drivers/usb/media/pwc/pwc-if.c
@@ -141,7 +141,7 @@ static struct {
static int pwc_video_open(struct inode *inode, struct file *file);
static int pwc_video_close(struct inode *inode, struct file *file);
-static ssize_t pwc_video_read(struct file *file, char *buf,
+static ssize_t pwc_video_read(struct file *file, char __user * buf,
size_t count, loff_t *ppos);
static unsigned int pwc_video_poll(struct file *file, poll_table *wait);
static int pwc_video_ioctl(struct inode *inode, struct file *file,
@@ -618,7 +618,7 @@ static void pwc_isoc_handler(struct urb *urb, struct pt_regs *regs)
int i, fst, flen;
int awake;
struct pwc_frame_buf *fbuf;
- unsigned char *fillptr = 0, *iso_buf = 0;
+ unsigned char *fillptr = NULL, *iso_buf = NULL;
awake = 0;
pdev = (struct pwc_device *)urb->context;
@@ -844,7 +844,7 @@ static int pwc_isoc_init(struct pwc_device *pdev)
pdev->vmax_packet_size = -1;
for (i = 0; i < idesc->desc.bNumEndpoints; i++)
if ((idesc->endpoint[i].desc.bEndpointAddress & 0xF) == pdev->vendpoint) {
- pdev->vmax_packet_size = idesc->endpoint[i].desc.wMaxPacketSize;
+ pdev->vmax_packet_size = le16_to_cpu(idesc->endpoint[i].desc.wMaxPacketSize);
break;
}
@@ -1170,7 +1170,7 @@ static int pwc_video_close(struct inode *inode, struct file *file)
device is tricky anyhow.
*/
-static ssize_t pwc_video_read(struct file *file, char *buf,
+static ssize_t pwc_video_read(struct file *file, char __user * buf,
size_t count, loff_t *ppos)
{
struct video_device *vdev = file->private_data;
@@ -1653,7 +1653,8 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
/* Check if we can handle this device */
Trace(TRACE_PROBE, "probe() called [%04X %04X], if %d\n",
- udev->descriptor.idVendor, udev->descriptor.idProduct,
+ le16_to_cpu(udev->descriptor.idVendor),
+ le16_to_cpu(udev->descriptor.idProduct),
intf->altsetting->desc.bInterfaceNumber);
/* the interfaces are probed one by one. We are only interested in the
@@ -1663,8 +1664,8 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
if (intf->altsetting->desc.bInterfaceNumber > 0)
return -ENODEV;
- vendor_id = udev->descriptor.idVendor;
- product_id = udev->descriptor.idProduct;
+ vendor_id = le16_to_cpu(udev->descriptor.idVendor);
+ product_id = le16_to_cpu(udev->descriptor.idProduct);
if (vendor_id == 0x0471) {
switch (product_id) {
@@ -1915,7 +1916,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
pdev->vdev->owner = THIS_MODULE;
video_set_drvdata(pdev->vdev, pdev);
- pdev->release = udev->descriptor.bcdDevice;
+ pdev->release = le16_to_cpu(udev->descriptor.bcdDevice);
Trace(TRACE_PROBE, "Release: %04x\n", pdev->release);
/* Now search device_hint[] table for a match, so we can hint a node number. */
@@ -2027,7 +2028,7 @@ static int pwc_atoi(const char *s)
* Initialization code & module stuff
*/
-static char *size = NULL;
+static char size[10];
static int fps = 0;
static int fbufs = 0;
static int mbufs = 0;
@@ -2036,23 +2037,23 @@ static int compression = -1;
static int leds[2] = { -1, -1 };
static char *dev_hint[MAX_DEV_HINTS] = { };
-MODULE_PARM(size, "s");
+module_param_string(size, size, sizeof(size), 0);
MODULE_PARM_DESC(size, "Initial image size. One of sqcif, qsif, qcif, sif, cif, vga");
-MODULE_PARM(fps, "i");
+module_param(fps, int, 0000);
MODULE_PARM_DESC(fps, "Initial frames per second. Varies with model, useful range 5-30");
-MODULE_PARM(fbufs, "i");
+module_param(fbufs, int, 0000);
MODULE_PARM_DESC(fbufs, "Number of internal frame buffers to reserve");
-MODULE_PARM(mbufs, "i");
+module_param(mbufs, int, 0000);
MODULE_PARM_DESC(mbufs, "Number of external (mmap()ed) image buffers");
-MODULE_PARM(trace, "i");
+module_param(trace, int, 0000);
MODULE_PARM_DESC(trace, "For debugging purposes");
-MODULE_PARM(power_save, "i");
+module_param(power_save, bool, 0000);
MODULE_PARM_DESC(power_save, "Turn power save feature in camera on or off");
-MODULE_PARM(compression, "i");
+module_param(compression, int, 0000);
MODULE_PARM_DESC(compression, "Preferred compression quality. Range 0 (uncompressed) to 3 (high compression)");
-MODULE_PARM(leds, "2i");
+module_param_array(leds, int, NULL, 0000);
MODULE_PARM_DESC(leds, "LED on,off time in milliseconds");
-MODULE_PARM(dev_hint, "0-20s");
+module_param_array(dev_hint, charp, NULL, 0000);
MODULE_PARM_DESC(dev_hint, "Device node hints");
MODULE_DESCRIPTION("Philips & OEM USB webcam driver");
@@ -2078,7 +2079,7 @@ static int __init usb_pwc_init(void)
Info("Default framerate set to %d.\n", default_fps);
}
- if (size) {
+ if (size[0]) {
/* string; try matching with array */
for (sz = 0; sz < PSZ_MAX; sz++) {
if (!strcmp(sizenames[sz], size)) { /* Found! */