media: ddbridge: fix sparse warnings
authorDaniel Scheller <d.scheller@gmx.net>
Wed, 23 Aug 2017 16:10:00 +0000 (12:10 -0400)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Sun, 27 Aug 2017 10:36:34 +0000 (06:36 -0400)
Fix several

  drivers/media/pci/ddbridge/ddbridge-core.c: warning: symbol ... was not declared. Should it be static?
  drivers/media/pci/ddbridge/ddbridge-core.c: warning: Using plain integer as NULL pointer
  drivers/media/pci/ddbridge/ddbridge-io.h: warning: cast removes address space of expression
  drivers/media/pci/ddbridge/ddbridge-io.h: warning: incorrect type in argument 1 (different address spaces)

at multiple places.

Cc: Ralph Metzler <rjkm@metzlerbros.de>
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/pci/ddbridge/ddbridge-core.c
drivers/media/pci/ddbridge/ddbridge-io.h

index 281b6739b0c152d373194fc64ee08221ead18979..f4bd4908acdd57735852c43533795193e211d14b 100644 (file)
@@ -69,7 +69,7 @@ MODULE_PARM_DESC(adapter_alloc,
 
 /****************************************************************************/
 
-DEFINE_MUTEX(redirect_lock);
+static DEFINE_MUTEX(redirect_lock);
 
 struct workqueue_struct *ddb_wq;
 
@@ -135,8 +135,8 @@ static void ddb_redirect_dma(struct ddb *dev,
 
 static int ddb_unredirect(struct ddb_port *port)
 {
-       struct ddb_input *oredi, *iredi = 0;
-       struct ddb_output *iredo = 0;
+       struct ddb_input *oredi, *iredi = NULL;
+       struct ddb_output *iredo = NULL;
 
        /* dev_info(port->dev->dev,
         * "unredirect %d.%d\n", port->dev->nr, port->nr);
@@ -160,14 +160,14 @@ static int ddb_unredirect(struct ddb_port *port)
                                ddb_redirect_dma(oredi->port->dev,
                                                 oredi->dma, iredo->dma);
                        }
-                       port->input[0]->redo = 0;
+                       port->input[0]->redo = NULL;
                        ddb_set_dma_table(port->input[0]);
                }
                oredi->redi = iredi;
-               port->input[0]->redi = 0;
+               port->input[0]->redi = NULL;
        }
-       oredi->redo = 0;
-       port->output->redi = 0;
+       oredi->redo = NULL;
+       port->output->redi = NULL;
 
        ddb_set_dma_table(oredi);
 done:
@@ -209,7 +209,7 @@ static int ddb_redirect(u32 i, u32 p)
        if (input2) {
                if (input->redi) {
                        input2->redi = input->redi;
-                       input->redi = 0;
+                       input->redi = NULL;
                } else
                        input2->redi = input;
        }
@@ -811,11 +811,11 @@ static const struct file_operations ci_fops = {
        .open    = ts_open,
        .release = ts_release,
        .poll    = ts_poll,
-       .mmap    = 0,
+       .mmap    = NULL,
 };
 
 static struct dvb_device dvbdev_ci = {
-       .priv    = 0,
+       .priv    = NULL,
        .readers = 1,
        .writers = 1,
        .users   = 2,
@@ -2053,7 +2053,7 @@ static struct dvb_ca_en50221 en_templ = {
 
 static void ci_attach(struct ddb_port *port)
 {
-       struct ddb_ci *ci = 0;
+       struct ddb_ci *ci = NULL;
 
        ci = kzalloc(sizeof(*ci), GFP_KERNEL);
        if (!ci)
@@ -2206,7 +2206,7 @@ static void ci_xo2_attach(struct ddb_port *port)
 /****************************************************************************/
 /****************************************************************************/
 
-struct cxd2099_cfg cxd_cfg = {
+static struct cxd2099_cfg cxd_cfg = {
        .bitrate =  72000,
        .adr     =  0x40,
        .polarity = 1,
@@ -3445,7 +3445,7 @@ int ddb_device_create(struct ddb *dev)
        if (res) {
                ddb_device_attrs_del(dev);
                device_destroy(&ddb_class, MKDEV(ddb_major, dev->nr));
-               ddbs[dev->nr] = 0;
+               ddbs[dev->nr] = NULL;
                dev->ddb_dev = ERR_PTR(-ENODEV);
        } else
                ddb_num++;
index ce92e94840756301d3d119311c94626e913c63a5..a4c6bbe0916851bfd7d193d1657243209e17cd5f 100644 (file)
 
 static inline u32 ddblreadl(struct ddb_link *link, u32 adr)
 {
-       return readl((char *) (link->dev->regs + (adr)));
+       return readl(link->dev->regs + adr);
 }
 
 static inline void ddblwritel(struct ddb_link *link, u32 val, u32 adr)
 {
-       writel(val, (char *) (link->dev->regs + (adr)));
+       writel(val, link->dev->regs + adr);
 }
 
 static inline u32 ddbreadl(struct ddb *dev, u32 adr)
 {
-       return readl((char *) (dev->regs + (adr)));
+       return readl(dev->regs + adr);
 }
 
 static inline void ddbwritel(struct ddb *dev, u32 val, u32 adr)
 {
-       writel(val, (char *) (dev->regs + (adr)));
+       writel(val, dev->regs + adr);
 }
 
 static inline void ddbcpyto(struct ddb *dev, u32 adr, void *src, long count)
 {
-       return memcpy_toio((char *) (dev->regs + adr), src, count);
+       return memcpy_toio(dev->regs + adr, src, count);
 }
 
 static inline void ddbcpyfrom(struct ddb *dev, void *dst, u32 adr, long count)
 {
-       return memcpy_fromio(dst, (char *) (dev->regs + adr), count);
+       return memcpy_fromio(dst, dev->regs + adr, count);
 }
 
 static inline u32 safe_ddbreadl(struct ddb *dev, u32 adr)