summaryrefslogtreecommitdiff
path: root/drivers/dahdi/wctdm24xxp
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2008-10-28 21:49:02 +0000
committerKevin P. Fleming <kpfleming@digium.com>2008-10-28 21:49:02 +0000
commitcb2fd65e3da7a68ef11d458e9ca99463f90b32a0 (patch)
tree8acd0b016433ced01fd64876a031381c822c30aa /drivers/dahdi/wctdm24xxp
parent8b0e06e5f588d24af0666b1d605084a83c7c8c25 (diff)
fix a large number of warnings found by sparse, the kernel code sanity checking tool. some of these fixes are non-optimal (casting 'unsigned long' to '__user void *'), but are unavoidable in many cases. started from tzafrir's patch, did most of the work myself.
(closes issue #13763) Reported by: tzafrir Patches: sparse_fixes_1.diff uploaded by tzafrir (license 46) git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@5162 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/wctdm24xxp')
-rw-r--r--drivers/dahdi/wctdm24xxp/GpakApi.c2
-rw-r--r--drivers/dahdi/wctdm24xxp/GpakCust.c16
-rw-r--r--drivers/dahdi/wctdm24xxp/base.c39
3 files changed, 29 insertions, 28 deletions
diff --git a/drivers/dahdi/wctdm24xxp/GpakApi.c b/drivers/dahdi/wctdm24xxp/GpakApi.c
index 45825fb..1f1bb0b 100644
--- a/drivers/dahdi/wctdm24xxp/GpakApi.c
+++ b/drivers/dahdi/wctdm24xxp/GpakApi.c
@@ -1265,7 +1265,7 @@ gpakReadFramingStatsStatus_t gpakReadFramingStats(
*pFramingError3Count = ReadBuffer[2];
*pDmaStopErrorCount = ReadBuffer[3];
- if(pDmaSlipStatsBuffer != 0)
+ if(pDmaSlipStatsBuffer != NULL)
// If users want to get the DMA slips count
{
pDmaSlipStatsBuffer[0] = ReadBuffer[4];
diff --git a/drivers/dahdi/wctdm24xxp/GpakCust.c b/drivers/dahdi/wctdm24xxp/GpakCust.c
index 95c5f8e..ea77e0d 100644
--- a/drivers/dahdi/wctdm24xxp/GpakCust.c
+++ b/drivers/dahdi/wctdm24xxp/GpakCust.c
@@ -133,8 +133,8 @@ static inline int vpm150m_io_wait(struct wctdm *wc)
return ret;
}
-int wctdm_vpm150m_getreg_full_async(struct wctdm *wc, int pagechange, unsigned int len,
- unsigned short addr, unsigned short *outbuf, struct vpm150m_cmd **hit_p)
+static int wctdm_vpm150m_getreg_full_async(struct wctdm *wc, int pagechange, unsigned int len,
+ unsigned short addr, unsigned short *outbuf, struct vpm150m_cmd **hit_p)
{
int ret=0;
unsigned long flags;
@@ -157,8 +157,8 @@ int wctdm_vpm150m_getreg_full_async(struct wctdm *wc, int pagechange, unsigned i
return ret;
}
-int wctdm_vpm150m_getreg_full_return(struct wctdm *wc, int pagechange, unsigned int len,
- unsigned short addr, unsigned short *outbuf, struct vpm150m_cmd **hit_p)
+static int wctdm_vpm150m_getreg_full_return(struct wctdm *wc, int pagechange, unsigned int len,
+ unsigned short addr, unsigned short *outbuf, struct vpm150m_cmd **hit_p)
{
int ret = 0;
unsigned long flags;
@@ -184,9 +184,9 @@ int wctdm_vpm150m_getreg_full_return(struct wctdm *wc, int pagechange, unsigned
return ret;
}
-int wctdm_vpm150m_getreg_full(struct wctdm *wc, int pagechange, unsigned int len, unsigned short addr, unsigned short *outbuf)
+static int wctdm_vpm150m_getreg_full(struct wctdm *wc, int pagechange, unsigned int len, unsigned short addr, unsigned short *outbuf)
{
- struct vpm150m_cmd *hit = 0;
+ struct vpm150m_cmd *hit = NULL;
int ret = 0;
do {
ret = wctdm_vpm150m_getreg_full_async(wc, pagechange, len, addr, outbuf, &hit);
@@ -202,7 +202,7 @@ int wctdm_vpm150m_getreg_full(struct wctdm *wc, int pagechange, unsigned int len
return ret;
}
-int wctdm_vpm150m_setreg_full(struct wctdm *wc, int pagechange, unsigned int len, unsigned int addr, unsigned short *data)
+static int wctdm_vpm150m_setreg_full(struct wctdm *wc, int pagechange, unsigned int len, unsigned int addr, unsigned short *data)
{
unsigned long flags;
struct vpm150m_cmd *hit;
@@ -293,7 +293,7 @@ void gpakReadDspMemory(
vpm150m_io_wait(wc);
if ( NumWords < VPM150M_MAX_COMMANDS ) {
- struct vpm150m_cmd* cmds[VPM150M_MAX_COMMANDS] = {0};
+ struct vpm150m_cmd* cmds[VPM150M_MAX_COMMANDS] = { NULL };
wctdm_vpm150m_setpage(wc, DspAddress >> 16);
DspAddress &= 0xffff;
for (i=0; i < NumWords; ++i) {
diff --git a/drivers/dahdi/wctdm24xxp/base.c b/drivers/dahdi/wctdm24xxp/base.c
index d915c54..f157af2 100644
--- a/drivers/dahdi/wctdm24xxp/base.c
+++ b/drivers/dahdi/wctdm24xxp/base.c
@@ -1574,14 +1574,14 @@ static inline void wctdm_isr_misc(struct wctdm *wc)
#endif
}
-void handle_receive(void* vbb, void* context)
+static void handle_receive(void* vbb, void* context)
{
struct wctdm *wc = context;
wc->rxints++;
wctdm_receiveprep(wc, vbb);
}
-void handle_transmit(void* vbb, void* context)
+static void handle_transmit(void* vbb, void* context)
{
struct wctdm *wc = context;
memset(vbb, 0, SFRAME_SIZE);
@@ -2408,7 +2408,7 @@ static int wctdm_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long
case DAHDI_ONHOOKTRANSFER:
if (wc->modtype[chan->chanpos - 1] != MOD_TYPE_FXS)
return -EINVAL;
- if (get_user(x, (int *)data))
+ if (get_user(x, (__user int *) data))
return -EFAULT;
wc->mods[chan->chanpos - 1].fxs.ohttimer = x << 3;
wc->mods[chan->chanpos - 1].fxs.idletxhookstate = 0x2; /* OHT mode when idle */
@@ -2430,7 +2430,7 @@ static int wctdm_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long
stats.batvolt = (signed char)wctdm_getreg(wc, chan->chanpos - 1, 29) * 1000;
} else
return -EINVAL;
- if (copy_to_user((struct wctdm_stats *)data, &stats, sizeof(stats)))
+ if (copy_to_user((__user void *) data, &stats, sizeof(stats)))
return -EFAULT;
break;
case WCTDM_GET_REGS:
@@ -2448,11 +2448,11 @@ static int wctdm_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long
for (x=0;x<NUM_FXO_REGS;x++)
regs.direct[x] = wctdm_getreg(wc, chan->chanpos - 1, x);
}
- if (copy_to_user((struct wctdm_regs *)data, &regs, sizeof(regs)))
+ if (copy_to_user((__user void *)data, &regs, sizeof(regs)))
return -EFAULT;
break;
case WCTDM_SET_REG:
- if (copy_from_user(&regop, (struct wctdm_regop *)data, sizeof(regop)))
+ if (copy_from_user(&regop, (__user void *) data, sizeof(regop)))
return -EFAULT;
if (regop.indirect) {
if (wc->modtype[chan->chanpos - 1] != MOD_TYPE_FXS)
@@ -2470,7 +2470,7 @@ static int wctdm_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long
break;
case WCTDM_SET_ECHOTUNE:
printk(KERN_INFO "-- Setting echo registers: \n");
- if (copy_from_user(&echoregs, (struct wctdm_echo_coefs*)data, sizeof(echoregs)))
+ if (copy_from_user(&echoregs, (__user void *) data, sizeof(echoregs)))
return -EFAULT;
if (wc->modtype[chan->chanpos - 1] == MOD_TYPE_FXO) {
@@ -2496,7 +2496,7 @@ static int wctdm_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long
}
break;
case DAHDI_SET_HWGAIN:
- if (copy_from_user(&hwgain, (struct dahdi_hwgain*) data, sizeof(hwgain)))
+ if (copy_from_user(&hwgain, (__user void *) data, sizeof(hwgain)))
return -EFAULT;
wctdm_set_hwgain(wc, chan->chanpos-1, hwgain.newgain, hwgain.tx);
@@ -2507,7 +2507,7 @@ static int wctdm_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long
break;
#ifdef VPM_SUPPORT
case DAHDI_TONEDETECT:
- if (get_user(x, (int *) data))
+ if (get_user(x, (__user int *) data))
return -EFAULT;
if (!wc->vpm && !wc->vpm150m)
return -ENOSYS;
@@ -2532,7 +2532,8 @@ static int wctdm_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long
case DAHDI_RADIO_GETPARAM:
if (wc->modtype[chan->chanpos - 1] != MOD_TYPE_QRV)
return -ENOTTY;
- if (copy_from_user(&stack.p,(struct dahdi_radio_param *)data,sizeof(struct dahdi_radio_param))) return -EFAULT;
+ if (copy_from_user(&stack.p, (__user void *) data, sizeof(stack.p)))
+ return -EFAULT;
stack.p.data = 0; /* start with 0 value in output */
switch(stack.p.radpar) {
case DAHDI_RADPAR_INVERTCOR:
@@ -2584,12 +2585,14 @@ static int wctdm_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long
default:
return -EINVAL;
}
- if (copy_to_user((struct dahdi_radio_param *)data,&stack.p,sizeof(struct dahdi_radio_param))) return -EFAULT;
+ if (copy_to_user((__user void *) data, &stack.p, sizeof(stack.p)))
+ return -EFAULT;
break;
case DAHDI_RADIO_SETPARAM:
if (wc->modtype[chan->chanpos - 1] != MOD_TYPE_QRV)
return -ENOTTY;
- if (copy_from_user(&stack.p,(struct dahdi_radio_param *)data,sizeof(struct dahdi_radio_param))) return -EFAULT;
+ if (copy_from_user(&stack.p, (__user void *) data, sizeof(stack.p)))
+ return -EFAULT;
switch(stack.p.radpar) {
case DAHDI_RADPAR_INVERTCOR:
if (stack.p.data)
@@ -2987,7 +2990,7 @@ static void wctdm_post_initialize(struct wctdm *wc)
#ifdef VPM150M_SUPPORT
-void vpm150m_set_chanconfig_from_state(struct adt_lec_params * parms, int channum, GpakChannelConfig_t *chanconfig)
+static void vpm150m_set_chanconfig_from_state(struct adt_lec_params * parms, int channum, GpakChannelConfig_t *chanconfig)
{
chanconfig->PcmInPortA = 3;
chanconfig->PcmInSlotA = channum;
@@ -4032,12 +4035,10 @@ static struct pci_device_id wctdm_pci_tbl[] = {
MODULE_DEVICE_TABLE(pci, wctdm_pci_tbl);
static struct pci_driver wctdm_driver = {
- name: "wctdm24xxp",
- probe: wctdm_init_one,
- remove: __devexit_p(wctdm_remove_one),
- suspend: NULL,
- resume: NULL,
- id_table: wctdm_pci_tbl,
+ .name = "wctdm24xxp",
+ .probe = wctdm_init_one,
+ .remove = __devexit_p(wctdm_remove_one),
+ .id_table = wctdm_pci_tbl,
};
static int __init wctdm_init(void)