Re: [PATCH] staging: comedi: hwdrv_apci1500: use dev->class_dev in calls to dev_warn()
On 2014-09-04 00:58, Chase Southwood wrote: git-grep reveals that hwdrv_apci1500.c is the only file in comedi that uses dev->hw_dev in calls to dev_{err,warn}(). The rest of the drivers pass dev->class_dev to these macros instead. Switch the dev_warn() calls in this driver to use dev->class_dev as well, for consistency. Signed-off-by: Chase Southwood Cc: Ian Abbott Cc: H Hartley Sweeten --- As an aside, it looks like lots of these cases are actually error conditions that might be more appropriate use cases for dev_err(). But they could be changed in a follow on patch, this is enough for this one. .../comedi/drivers/addi-data/hwdrv_apci1500.c | 104 ++--- 1 file changed, 52 insertions(+), 52 deletions(-) Reviewed-by: Ian Abbott -- -=( Ian Abbott @ MEV Ltd.E-mail: )=- -=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=- ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] [next-20140903] staging: emxx_udc: remove check for CONFIG_MACH_EMGR
There's a check for CONFIG_MACH_EMGR. But the Kconfig symbol MACH_EMGR doesn't exist. Remove that check and the single #define it hides. Note that this macro isn't used by this driver anyway. Signed-off-by: Paul Bolle --- Compile tested only (on x86_64). drivers/staging/emxx_udc/emxx_udc.h | 4 1 file changed, 4 deletions(-) diff --git a/drivers/staging/emxx_udc/emxx_udc.h b/drivers/staging/emxx_udc/emxx_udc.h index 578fdcfed5e9..ee1b80d705fa 100644 --- a/drivers/staging/emxx_udc/emxx_udc.h +++ b/drivers/staging/emxx_udc/emxx_udc.h @@ -437,10 +437,6 @@ #define PLL_RESUME BIT05 /* RW */ #define PLL_LOCK BIT04 /* R */ -#ifdef CONFIG_MACH_EMGR -#define PLL_RSTBIT02 /* RW */ -#endif - #define EPC_RSTBIT00 /* RW */ /*--- (0x1014) USBF_EPTEST Register */ -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
staging: android: uapi: binder.h: Used __packed instead of __attribute__((packed))
Signed-off-by: Dipak Zope --- drivers/staging/android/uapi/binder.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/android/uapi/binder.h b/drivers/staging/android/uapi/binder.h index 904adb7..dba4cef 100644 --- a/drivers/staging/android/uapi/binder.h +++ b/drivers/staging/android/uapi/binder.h @@ -169,7 +169,7 @@ struct binder_ptr_cookie { struct binder_handle_cookie { __u32 handle; binder_uintptr_t cookie; -} __attribute__((packed)); +} __packed; struct binder_pri_desc { __s32 priority; -- 1.8.3.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[patch -next] hyperv: NULL dereference on error
We try to call free_netvsc_device(net_device) when "net_device" is NULL. It leads to an Oops. Fixes: f90251c8a6d0 ('hyperv: Increase the buffer length for netvsc_channel_cb()') Signed-off-by: Dan Carpenter diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index 5b5644a..977984b 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -1054,10 +1054,8 @@ int netvsc_device_add(struct hv_device *device, void *additional_info) struct net_device *ndev; net_device = alloc_net_device(device); - if (!net_device) { - ret = -ENOMEM; - goto cleanup; - } + if (!net_device) + return -ENOMEM; net_device->ring_size = ring_size; ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: staging: android: uapi: binder.h: Used __packed instead of __attribute__((packed))
On Mon, Sep 01, 2014 at 08:47:12AM -0400, Dipak Zope wrote: you have not mentioned any commit message . thanks sudip > Signed-off-by: Dipak Zope > --- > drivers/staging/android/uapi/binder.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/android/uapi/binder.h > b/drivers/staging/android/uapi/binder.h > index 904adb7..dba4cef 100644 > --- a/drivers/staging/android/uapi/binder.h > +++ b/drivers/staging/android/uapi/binder.h > @@ -169,7 +169,7 @@ struct binder_ptr_cookie { > struct binder_handle_cookie { > __u32 handle; > binder_uintptr_t cookie; > -} __attribute__((packed)); > +} __packed; > > struct binder_pri_desc { > __s32 priority; > -- > 1.8.3.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: lustre: Annotate user buffer with __user
Fix the warning reported by sparse on drivers/staging/lustre/lnet/lnet/router_proc.c warning: incorrect type in argument 4 (different address spaces) The correction is to annotate all user buffer variable by __user Signed-off-by: LABBE Corentin --- .../staging/lustre/include/linux/libcfs/libcfs_debug.h | 6 +++--- drivers/staging/lustre/lnet/lnet/router_proc.c | 13 +++-- drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c | 17 + drivers/staging/lustre/lustre/libcfs/tracefile.c| 12 ++-- drivers/staging/lustre/lustre/libcfs/tracefile.h| 10 +- 5 files changed, 30 insertions(+), 28 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h index 30098f3..aa9222c 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h @@ -265,9 +265,9 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata, /* other external symbols that tracefile provides: */ int cfs_trace_copyin_string(char *knl_buffer, int knl_buffer_nob, - const char *usr_buffer, int usr_buffer_nob); -int cfs_trace_copyout_string(char *usr_buffer, int usr_buffer_nob, - const char *knl_buffer, char *append); + const char __user *usr_buffer, int usr_buffer_nob); +int cfs_trace_copyout_string(char __user *usr_buffer, int usr_buffer_nob, + const char *knl_buffer, char *append); #define LIBCFS_DEBUG_FILE_PATH_DEFAULT "/tmp/lustre-log" diff --git a/drivers/staging/lustre/lnet/lnet/router_proc.c b/drivers/staging/lustre/lnet/lnet/router_proc.c index 166c1e6..6e8f7e2 100644 --- a/drivers/staging/lustre/lnet/lnet/router_proc.c +++ b/drivers/staging/lustre/lnet/lnet/router_proc.c @@ -90,9 +90,10 @@ enum { #define LNET_PROC_VERSION(v) ((unsigned int)((v) & LNET_PROC_VER_MASK)) -static int proc_call_handler(void *data, int write, loff_t *ppos, void *buffer, -size_t *lenp, int (*handler)(void *data, int write, -loff_t pos, void *buffer, int len)) +static int proc_call_handler(void *data, int write, loff_t *ppos, + void __user *buffer, size_t *lenp, + int (*handler)(void *data, int write, + loff_t pos, void __user *buffer, int len)) { int rc = handler(data, write, *ppos, buffer, *lenp); @@ -109,7 +110,7 @@ static int proc_call_handler(void *data, int write, loff_t *ppos, void *buffer, } static int __proc_lnet_stats(void *data, int write, -loff_t pos, void *buffer, int nob) +loff_t pos, void __user *buffer, int nob) { int rc; lnet_counters_t *ctrs; @@ -592,7 +593,7 @@ int proc_lnet_peers(struct ctl_table *table, int write, void __user *buffer, } static int __proc_lnet_buffers(void *data, int write, - loff_t pos, void *buffer, int nob) + loff_t pos, void __user *buffer, int nob) { char*s; char*tmpstr; @@ -815,7 +816,7 @@ static struct lnet_portal_rotorsportal_rotors[] = { extern int portal_rotor; static int __proc_lnet_portal_rotor(void *data, int write, - loff_t pos, void *buffer, int nob) + loff_t pos, void __user *buffer, int nob) { const int buf_len = 128; char*buf; diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c index 13a9266..bbe2c68 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c @@ -98,9 +98,10 @@ enum { PSDEV_LNET_FAIL_VAL, /* userdata for fail loc */ }; -static int proc_call_handler(void *data, int write, loff_t *ppos, void *buffer, -size_t *lenp, int (*handler)(void *data, int write, -loff_t pos, void *buffer, int len)) +static int proc_call_handler(void *data, int write, loff_t *ppos, + void __user *buffer, size_t *lenp, + int (*handler)(void *data, int write, + loff_t pos, void __user *buffer, int len)) { int rc = handler(data, write, *ppos, buffer, *lenp); @@ -117,7 +118,7 @@ static int proc_call_handler(void *data, int write, loff_t *ppos, void *buffer, } static int __proc_dobitmasks(void *data, int write, -loff_t pos, void *buffer, int nob) +loff_t pos, void __user *buffer, int nob) { const int tmpstrlen = 512; char *tmpstr; @@ -168,7 +169,7 @@ static int min_watchdog_ratelimit = 0;/* disable ratelimiting */ static int ma
[PATCH] Staging: rtl8192u: fix brace style coding issue in r819xU_firmware.c
*** BLURB HERE *** root (1): Staging: rtl8192u: fix brace style coding issue in r819xU_firmware.c This is a patch to the file r819xU_firmware.c that fixes a brace warning found by checkpatch.pl tool drivers/staging/rtl8192u/r819xU_firmware.c |5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -- 1.7.9.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: rtl8192u: fix brace style coding issue in r819xU_firmware.c This is a patch to the file r819xU_firmware.c that fixes a brace warning found by checkpatch.pl tool
From: root Signed-off-by: Chaitra Ramaiah --- drivers/staging/rtl8192u/r819xU_firmware.c |5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192u/r819xU_firmware.c b/drivers/staging/rtl8192u/r819xU_firmware.c index 671cbe6..40e1ef5 100644 --- a/drivers/staging/rtl8192u/r819xU_firmware.c +++ b/drivers/staging/rtl8192u/r819xU_firmware.c @@ -153,11 +153,10 @@ static bool CPUcheck_maincodeok_turnonCPU(struct net_device *dev) break; }while(check_bootOk_time--); - if (!(CPU_status&CPU_GEN_BOOT_RDY)) { + if (!(CPU_status&CPU_GEN_BOOT_RDY)) goto CPUCheckMainCodeOKAndTurnOnCPU_Fail; - } else { + else RT_TRACE(COMP_FIRMWARE, "Download Firmware: Boot ready!\n"); - } return rt_status; -- 1.7.9.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: rtl8192u: fix brace style coding issue in r819xU_firmware.c
On Thu, Sep 04, 2014 at 07:39:11PM +0530, Chaitra Ramaiah wrote: > *** BLURB HERE *** No blurb??? :) ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: rtl8192u: fix brace style coding issue in r819xU_firmware.c This is a patch to the file r819xU_firmware.c that fixes a brace warning found by checkpatch.pl tool
On Thu, Sep 04, 2014 at 07:39:12PM +0530, Chaitra Ramaiah wrote: > From: root I don't think that is your email address... ALso, look at your subject, something went wrong here :( Care to try again? thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: rtl8192u: fix brace style coding issue in r819xU_firmware.c This is a patch to the file r819xU_firmware.c that fixes a brace warning found by checkpatch.pl tool
Read the first paragraph of Documentation/email-clients.txt. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 06/18] staging: xillybus: Improved error handling
xilly_scan_idt() now returns an error status code, rather than being a void function and hint the status through an entry in a data structure. Suggested-by: Dan Carpenter Signed-off-by: Eli Billauer --- drivers/staging/xillybus/xillybus_core.c | 20 1 files changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/staging/xillybus/xillybus_core.c b/drivers/staging/xillybus/xillybus_core.c index 222457f..fc14b14 100644 --- a/drivers/staging/xillybus/xillybus_core.c +++ b/drivers/staging/xillybus/xillybus_core.c @@ -568,8 +568,8 @@ static int xilly_setupchannels(struct xilly_endpoint *ep, return 0; } -static void xilly_scan_idt(struct xilly_endpoint *endpoint, - struct xilly_idt_handle *idt_handle) +static int xilly_scan_idt(struct xilly_endpoint *endpoint, + struct xilly_idt_handle *idt_handle) { int count = 0; unsigned char *idt = endpoint->channels[1]->wr_buffers[0]->addr; @@ -593,23 +593,22 @@ static void xilly_scan_idt(struct xilly_endpoint *endpoint, if (scan > end_of_idt) { dev_err(endpoint->dev, "IDT device name list overflow. Aborting.\n"); - idt_handle->chandesc = NULL; - return; + return -ENODEV; } idt_handle->chandesc = scan; len = endpoint->idtlen - (3 + ((int) (scan - idt))); if (len & 0x03) { - idt_handle->chandesc = NULL; - dev_err(endpoint->dev, "Corrupt IDT device name list. Aborting.\n"); + return -ENODEV; } idt_handle->entries = len >> 2; - endpoint->num_channels = count; + + return 0; } static int xilly_obtain_idt(struct xilly_endpoint *endpoint) @@ -2041,12 +2040,9 @@ int xillybus_endpoint_discovery(struct xilly_endpoint *endpoint) if (rc) goto failed_idt; - xilly_scan_idt(endpoint, &idt_handle); - - if (!idt_handle.chandesc) { - rc = -ENODEV; + rc = xilly_scan_idt(endpoint, &idt_handle); + if (rc) goto failed_idt; - } devres_close_group(dev, bootstrap_resources); -- 1.7.2.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 02/18] staging: xillybus: Use SEEK_* predefined constants
Suggested-by: Dan Carpenter Signed-off-by: Eli Billauer --- drivers/staging/xillybus/xillybus_core.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/xillybus/xillybus_core.c b/drivers/staging/xillybus/xillybus_core.c index cacd560..61699fa 100644 --- a/drivers/staging/xillybus/xillybus_core.c +++ b/drivers/staging/xillybus/xillybus_core.c @@ -1720,13 +1720,13 @@ static loff_t xillybus_llseek(struct file *filp, loff_t offset, int whence) mutex_lock(&channel->rd_mutex); switch (whence) { - case 0: + case SEEK_SET: pos = offset; break; - case 1: + case SEEK_CUR: pos += offset; break; - case 2: + case SEEK_END: pos = offset; /* Going to the end => to the beginning */ break; default: -- 1.7.2.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 09/18] staging: xillybus: Fixes related to "rc" variable
"rc" is often used to hold the return value of a function call. This patch removes unnecessary assignments to this variable, and makes a few related execution flow improvements. Suggested-by: Dan Carpenter Signed-off-by: Eli Billauer --- drivers/staging/xillybus/xillybus_core.c | 32 +++-- drivers/staging/xillybus/xillybus_of.c |5 ++- drivers/staging/xillybus/xillybus_pcie.c | 10 +++- 3 files changed, 15 insertions(+), 32 deletions(-) diff --git a/drivers/staging/xillybus/xillybus_core.c b/drivers/staging/xillybus/xillybus_core.c index f66ffa7..53d5e42 100644 --- a/drivers/staging/xillybus/xillybus_core.c +++ b/drivers/staging/xillybus/xillybus_core.c @@ -613,7 +613,6 @@ static int xilly_scan_idt(struct xilly_endpoint *endpoint, static int xilly_obtain_idt(struct xilly_endpoint *endpoint) { - int rc = 0; struct xilly_channel *channel; unsigned char *version; @@ -635,8 +634,7 @@ static int xilly_obtain_idt(struct xilly_endpoint *endpoint) if (endpoint->fatal_error) return -EIO; - rc = -ENODEV; - return rc; + return -ENODEV; } endpoint->ephw->hw_sync_sgl_for_cpu( @@ -649,15 +647,13 @@ static int xilly_obtain_idt(struct xilly_endpoint *endpoint) dev_err(endpoint->dev, "IDT length mismatch (%d != %d). Aborting.\n", channel->wr_buffers[0]->end_offset, endpoint->idtlen); - rc = -ENODEV; - return rc; + return -ENODEV; } if (crc32_le(~0, channel->wr_buffers[0]->addr, endpoint->idtlen+1) != 0) { dev_err(endpoint->dev, "IDT failed CRC check. Aborting.\n"); - rc = -ENODEV; - return rc; + return -ENODEV; } version = channel->wr_buffers[0]->addr; @@ -667,8 +663,7 @@ static int xilly_obtain_idt(struct xilly_endpoint *endpoint) dev_err(endpoint->dev, "No support for IDT version 0x%02x. Maybe the xillybus driver needs an upgarde. Aborting.\n", (int) *version); - rc = -ENODEV; - return rc; + return -ENODEV; } return 0; /* Success */ @@ -696,12 +691,9 @@ static ssize_t xillybus_read(struct file *filp, char __user *userbuf, deadline = jiffies + 1 + XILLY_RX_TIMEOUT; rc = mutex_lock_interruptible(&channel->wr_mutex); - if (rc) return rc; - rc = 0; /* Just to be clear about it. Compiler optimizes this out */ - while (1) { /* Note that we may drop mutex within this loop */ int bytes_to_do = count - bytes_done; @@ -1010,7 +1002,7 @@ desperate: static int xillybus_myflush(struct xilly_channel *channel, long timeout) { - int rc = 0; + int rc; unsigned long flags; int end_offset_plus1; @@ -1022,7 +1014,6 @@ static int xillybus_myflush(struct xilly_channel *channel, long timeout) if (channel->endpoint->fatal_error) return -EIO; rc = mutex_lock_interruptible(&channel->rd_mutex); - if (rc) return rc; @@ -1120,8 +,6 @@ static int xillybus_myflush(struct xilly_channel *channel, long timeout) * If bufidx == channel->rd_fpga_buf_idx we're either empty or full. */ - rc = 0; - while (1) { /* Loop waiting for draining of buffers */ spin_lock_irqsave(&channel->rd_spinlock, flags); @@ -1217,12 +1206,9 @@ static ssize_t xillybus_write(struct file *filp, const char __user *userbuf, return -EIO; rc = mutex_lock_interruptible(&channel->rd_mutex); - if (rc) return rc; - rc = 0; /* Just to be clear about it. Compiler optimizes this out */ - while (1) { int bytes_to_do = count - bytes_done; @@ -1840,7 +1826,6 @@ static int xillybus_init_chrdev(struct xilly_endpoint *endpoint, rc = alloc_chrdev_region(&dev, 0, /* minor start */ endpoint->num_channels, xillyname); - if (rc) { dev_warn(endpoint->dev, "Failed to obtain major/minors"); return rc; @@ -1965,7 +1950,7 @@ static int xilly_quiesce(struct xilly_endpoint *endpoint) int xillybus_endpoint_discovery(struct xilly_endpoint *endpoint) { - int rc = 0; + int rc; void *bootstrap_resources; int idtbuffersize = (1 << PAGE_SHIFT); @@ -1999,7 +1984,6 @@ int xillybus_endpoint_discovery(struct xilly_endpoint *endpoint) endpoint->num_channels = 0; rc = xilly_setupchannels(endpoint, bogus_idt, 1); - if (rc) return rc; @@ -2121,10 +2105,10 @@ static int __init xillybus_init(void) xillybus_wq = allo
[PATCH 10/18] staging: xillybus: Use the return value of wait_event_interruptible
Rather than checking the wait condition, the return value of wait_event_interruptible() and wait_event_interruptible_timeout() is used. Suggested-by: Dan Carpenter Signed-off-by: Eli Billauer --- drivers/staging/xillybus/xillybus_core.c | 38 +++--- 1 files changed, 19 insertions(+), 19 deletions(-) diff --git a/drivers/staging/xillybus/xillybus_core.c b/drivers/staging/xillybus/xillybus_core.c index 53d5e42..63c2c14 100644 --- a/drivers/staging/xillybus/xillybus_core.c +++ b/drivers/staging/xillybus/xillybus_core.c @@ -615,6 +615,7 @@ static int xilly_obtain_idt(struct xilly_endpoint *endpoint) { struct xilly_channel *channel; unsigned char *version; + long t; channel = endpoint->channels[1]; /* This should be generated ad-hoc */ @@ -624,11 +625,11 @@ static int xilly_obtain_idt(struct xilly_endpoint *endpoint) (3 << 24), /* Opcode 3 for channel 0 = Send IDT */ endpoint->registers + fpga_buf_ctrl_reg); - wait_event_interruptible_timeout(channel->wr_wait, -(!channel->wr_sleepy), -XILLY_TIMEOUT); + t = wait_event_interruptible_timeout(channel->wr_wait, +(!channel->wr_sleepy), +XILLY_TIMEOUT); - if (channel->wr_sleepy) { + if (t <= 0) { dev_err(endpoint->dev, "Failed to obtain IDT. Aborting.\n"); if (endpoint->fatal_error) @@ -943,7 +944,7 @@ interrupted: /* Mutex is not held if got here */ (!channel->wr_sleepy), left_to_sleep); - if (!channel->wr_sleepy) + if (left_to_sleep > 0) /* wr_sleepy deasserted */ continue; if (left_to_sleep < 0) { /* Interrupt */ @@ -1379,10 +1380,8 @@ static ssize_t xillybus_write(struct file *filp, const char __user *userbuf, break; } - wait_event_interruptible(channel->rd_wait, -(!channel->rd_full)); - - if (channel->rd_full) { + if (wait_event_interruptible(channel->rd_wait, +(!channel->rd_full))) { mutex_unlock(&channel->rd_mutex); if (channel->endpoint->fatal_error) @@ -1931,16 +1930,17 @@ EXPORT_SYMBOL(xillybus_init_endpoint); static int xilly_quiesce(struct xilly_endpoint *endpoint) { + long t; + endpoint->idtlen = -1; iowrite32((u32) (endpoint->dma_using_dac & 0x0001), endpoint->registers + fpga_dma_control_reg); - wait_event_interruptible_timeout(endpoint->ep_wait, -(endpoint->idtlen >= 0), -XILLY_TIMEOUT); - - if (endpoint->idtlen < 0) { + t = wait_event_interruptible_timeout(endpoint->ep_wait, +(endpoint->idtlen >= 0), +XILLY_TIMEOUT); + if (t <= 0) { dev_err(endpoint->dev, "Failed to quiesce the device on exit.\n"); return -ENODEV; @@ -1951,6 +1951,7 @@ static int xilly_quiesce(struct xilly_endpoint *endpoint) int xillybus_endpoint_discovery(struct xilly_endpoint *endpoint) { int rc; + long t; void *bootstrap_resources; int idtbuffersize = (1 << PAGE_SHIFT); @@ -1999,11 +2000,10 @@ int xillybus_endpoint_discovery(struct xilly_endpoint *endpoint) iowrite32((u32) (endpoint->dma_using_dac & 0x0001), endpoint->registers + fpga_dma_control_reg); - wait_event_interruptible_timeout(endpoint->ep_wait, -(endpoint->idtlen >= 0), -XILLY_TIMEOUT); - - if (endpoint->idtlen < 0) { + t = wait_event_interruptible_timeout(endpoint->ep_wait, +(endpoint->idtlen >= 0), +XILLY_TIMEOUT); + if (t <= 0) { dev_err(endpoint->dev, "No response from FPGA. Aborting.\n"); return -ENODEV; } -- 1.7.2.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 00/18] staging: xillybus: Coding style fixes
These patches are a result of Dan Carpenter's remarks after looking at the driver. A huge thanks goes to him for taking the time to review the code, and his clear and helpful comments. A significant part of the corrections is my extrapolation of Dan's remarks on similar cases. If something silly stands out in these patches, odds are it's me, not Dan. :) Regards, Eli Eli Billauer (18): staging: xillybus: Use devm_kcalloc() for arrays staging: xillybus: Use SEEK_* predefined constants staging: xillybus: Non-interruptible mutex_lock() on release method staging: xillybus: Removed unnecessary warning message staging: xillybus: Removed unnecessary error message staging: xillybus: Improved error handling staging: xillybus: Improved goto flow for error handling staging: xillybus: EAGAIN status handling improvement staging: xillybus: Fixes related to "rc" variable staging: xillybus: Use the return value of wait_event_interruptible staging: xillybus: Clarified the stop condition for a loop staging: xillybus: Added curly brackets as required staging: xillybus: Fix comments staging: xillybus: Fix incorrect cast staging: xillybus: Reorganize line breaks for clarity staging: xillybus: Trivial coding style fixes staging: xillybus: Fix indentations staging: xillybus: Blank lines add/remove drivers/staging/xillybus/xillybus.h |1 - drivers/staging/xillybus/xillybus_core.c | 325 -- drivers/staging/xillybus/xillybus_of.c |5 +- drivers/staging/xillybus/xillybus_pcie.c | 16 +- 4 files changed, 144 insertions(+), 203 deletions(-) -- 1.7.2.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 07/18] staging: xillybus: Improved goto flow for error handling
Suggested-by: Dan Carpenter Signed-off-by: Eli Billauer --- drivers/staging/xillybus/xillybus_core.c | 12 ++-- 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/xillybus/xillybus_core.c b/drivers/staging/xillybus/xillybus_core.c index fc14b14..45dbf07 100644 --- a/drivers/staging/xillybus/xillybus_core.c +++ b/drivers/staging/xillybus/xillybus_core.c @@ -1837,7 +1837,7 @@ static int xillybus_init_chrdev(struct xilly_endpoint *endpoint, if (rc) { dev_warn(endpoint->dev, "Failed to obtain major/minors"); - goto error1; + return rc; } endpoint->major = major = MAJOR(dev); @@ -1849,7 +1849,7 @@ static int xillybus_init_chrdev(struct xilly_endpoint *endpoint, endpoint->num_channels); if (rc) { dev_warn(endpoint->dev, "Failed to add cdev. Aborting.\n"); - goto error2; + goto unregister_chrdev; } idt++; @@ -1874,7 +1874,8 @@ static int xillybus_init_chrdev(struct xilly_endpoint *endpoint, dev_warn(endpoint->dev, "Failed to create %s device. Aborting.\n", devname); - goto error3; + rc = -ENODEV; + goto unroll_device_create; } } @@ -1882,15 +1883,14 @@ static int xillybus_init_chrdev(struct xilly_endpoint *endpoint, endpoint->num_channels); return 0; /* succeed */ -error3: +unroll_device_create: devnum--; i--; for (; devnum >= 0; devnum--, i--) device_destroy(xillybus_class, MKDEV(major, i)); cdev_del(&endpoint->cdev); -error2: +unregister_chrdev: unregister_chrdev_region(MKDEV(major, minor), endpoint->num_channels); -error1: return rc; } -- 1.7.2.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 08/18] staging: xillybus: EAGAIN status handling improvement
The -EAGAIN status is passed through an "rc" variable instead of a less common flow. Suggested-by: Dan Carpenter Signed-off-by: Eli Billauer --- drivers/staging/xillybus/xillybus_core.c | 16 +++- 1 files changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/staging/xillybus/xillybus_core.c b/drivers/staging/xillybus/xillybus_core.c index 45dbf07..f66ffa7 100644 --- a/drivers/staging/xillybus/xillybus_core.c +++ b/drivers/staging/xillybus/xillybus_core.c @@ -833,7 +833,7 @@ static ssize_t xillybus_read(struct file *filp, char __user *userbuf, if (ready) goto desperate; - bytes_done = -EAGAIN; + rc = -EAGAIN; break; } @@ -995,6 +995,9 @@ desperate: if (channel->endpoint->fatal_error) return -EIO; + if (rc) + return rc; + return bytes_done; } @@ -1386,7 +1389,7 @@ static ssize_t xillybus_write(struct file *filp, const char __user *userbuf, */ if (filp->f_flags & O_NONBLOCK) { - bytes_done = -EAGAIN; + rc = -EAGAIN; break; } @@ -1412,6 +1415,12 @@ static ssize_t xillybus_write(struct file *filp, const char __user *userbuf, &channel->rd_workitem, XILLY_RX_TIMEOUT); + if (channel->endpoint->fatal_error) + return -EIO; + + if (rc) + return rc; + if ((channel->rd_synchronous) && (bytes_done > 0)) { rc = xillybus_myflush(filp->private_data, 0); /* No timeout */ @@ -1419,9 +1428,6 @@ static ssize_t xillybus_write(struct file *filp, const char __user *userbuf, return rc; } - if (channel->endpoint->fatal_error) - return -EIO; - return bytes_done; } -- 1.7.2.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 03/18] staging: xillybus: Non-interruptible mutex_lock() on release method
Responding to an interrupt while handling the "release" method can't end well anyhow. In practical cases, this can force the user to wait up to one second while flushing remaining data is attempted (a timeout on the flush mechanism limits the time for flushing). Suggested-by: Dan Carpenter Signed-off-by: Eli Billauer --- drivers/staging/xillybus/xillybus_core.c | 16 ++-- 1 files changed, 2 insertions(+), 14 deletions(-) diff --git a/drivers/staging/xillybus/xillybus_core.c b/drivers/staging/xillybus/xillybus_core.c index 61699fa..3e14198 100644 --- a/drivers/staging/xillybus/xillybus_core.c +++ b/drivers/staging/xillybus/xillybus_core.c @@ -1588,7 +1588,6 @@ unlock_wr: static int xillybus_release(struct inode *inode, struct file *filp) { - int rc; unsigned long flags; struct xilly_channel *channel = filp->private_data; @@ -1599,13 +1598,7 @@ static int xillybus_release(struct inode *inode, struct file *filp) return -EIO; if (filp->f_mode & FMODE_WRITE) { - rc = mutex_lock_interruptible(&channel->rd_mutex); - - if (rc) { - dev_warn(channel->endpoint->dev, -"Failed to close file. Hardware left in messy state.\n"); - return rc; - } + mutex_lock(&channel->rd_mutex); channel->rd_ref_count--; @@ -1625,12 +1618,7 @@ static int xillybus_release(struct inode *inode, struct file *filp) } if (filp->f_mode & FMODE_READ) { - rc = mutex_lock_interruptible(&channel->wr_mutex); - if (rc) { - dev_warn(channel->endpoint->dev, -"Failed to close file. Hardware left in messy state.\n"); - return rc; - } + mutex_lock(&channel->wr_mutex); channel->wr_ref_count--; -- 1.7.2.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 01/18] staging: xillybus: Use devm_kcalloc() for arrays
Replace devm_kzalloc where it applies. Suggested-by: Dan Carpenter Signed-off-by: Eli Billauer --- drivers/staging/xillybus/xillybus_core.c | 16 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/xillybus/xillybus_core.c b/drivers/staging/xillybus/xillybus_core.c index d5a7202..cacd560 100644 --- a/drivers/staging/xillybus/xillybus_core.c +++ b/drivers/staging/xillybus/xillybus_core.c @@ -329,9 +329,9 @@ static int xilly_get_dma_buffers(struct xilly_endpoint *ep, struct xilly_buffer *this_buffer = NULL; /* Init to silence warning */ if (buffers) { /* Not the message buffer */ - this_buffer = devm_kzalloc( - dev, bufnum * sizeof(struct xilly_buffer), - GFP_KERNEL); + this_buffer = devm_kcalloc(dev, bufnum, + sizeof(struct xilly_buffer), + GFP_KERNEL); if (!this_buffer) return -ENOMEM; @@ -434,13 +434,13 @@ static int xilly_setupchannels(struct xilly_endpoint *ep, .regdirection = 0x8000, }; - channel = devm_kzalloc(dev, ep->num_channels * + channel = devm_kcalloc(dev, ep->num_channels, sizeof(struct xilly_channel), GFP_KERNEL); if (!channel) goto memfail; - ep->channels = devm_kzalloc(dev, (ep->num_channels + 1) * + ep->channels = devm_kcalloc(dev, ep->num_channels + 1, sizeof(struct xilly_channel *), GFP_KERNEL); @@ -517,9 +517,9 @@ static int xilly_setupchannels(struct xilly_endpoint *ep, bytebufsize = channel->rd_buf_size = bufsize * (1 << channel->log2_element_size); - buffers = devm_kzalloc(dev, - bufnum * sizeof(struct xilly_buffer *), - GFP_KERNEL); + buffers = devm_kcalloc(dev, bufnum, + sizeof(struct xilly_buffer *), + GFP_KERNEL); if (!buffers) goto memfail; -- 1.7.2.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 05/18] staging: xillybus: Removed unnecessary error message
Suggested-by: Dan Carpenter Signed-off-by: Eli Billauer --- drivers/staging/xillybus/xillybus_core.c | 13 - 1 files changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/staging/xillybus/xillybus_core.c b/drivers/staging/xillybus/xillybus_core.c index 3050815..222457f 100644 --- a/drivers/staging/xillybus/xillybus_core.c +++ b/drivers/staging/xillybus/xillybus_core.c @@ -438,14 +438,14 @@ static int xilly_setupchannels(struct xilly_endpoint *ep, sizeof(struct xilly_channel), GFP_KERNEL); if (!channel) - goto memfail; + return -ENOMEM; ep->channels = devm_kcalloc(dev, ep->num_channels + 1, sizeof(struct xilly_channel *), GFP_KERNEL); if (!ep->channels) - goto memfail; + return -ENOMEM; ep->channels[0] = NULL; /* Channel 0 is message buf. */ @@ -522,7 +522,7 @@ static int xilly_setupchannels(struct xilly_endpoint *ep, GFP_KERNEL); if (!buffers) - goto memfail; + return -ENOMEM; } else { bytebufsize = bufsize << 2; } @@ -557,7 +557,7 @@ static int xilly_setupchannels(struct xilly_endpoint *ep, } if (rc) - goto memfail; + return -ENOMEM; } if (!msg_buf_done) { @@ -566,11 +566,6 @@ static int xilly_setupchannels(struct xilly_endpoint *ep, return -ENODEV; } return 0; - -memfail: - dev_err(ep->dev, - "Failed to assign DMA buffer memory. Aborting.\n"); - return -ENOMEM; } static void xilly_scan_idt(struct xilly_endpoint *endpoint, -- 1.7.2.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 04/18] staging: xillybus: Removed unnecessary warning message
Suggested-by: Dan Carpenter Signed-off-by: Eli Billauer --- drivers/staging/xillybus/xillybus_core.c | 10 ++ 1 files changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/staging/xillybus/xillybus_core.c b/drivers/staging/xillybus/xillybus_core.c index 3e14198..3050815 100644 --- a/drivers/staging/xillybus/xillybus_core.c +++ b/drivers/staging/xillybus/xillybus_core.c @@ -2115,17 +2115,11 @@ EXPORT_SYMBOL(xillybus_endpoint_remove); static int __init xillybus_init(void) { - int rc = 0; - mutex_init(&ep_list_lock); xillybus_class = class_create(THIS_MODULE, xillyname); - if (IS_ERR(xillybus_class)) { - rc = PTR_ERR(xillybus_class); - pr_warn("Failed to register class xillybus\n"); - - return rc; - } + if (IS_ERR(xillybus_class)) + return PTR_ERR(xillybus_class); xillybus_wq = alloc_workqueue(xillyname, 0, 0); if (!xillybus_wq) { -- 1.7.2.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 16/18] staging: xillybus: Trivial coding style fixes
Suggested-by: Dan Carpenter Signed-off-by: Eli Billauer --- drivers/staging/xillybus/xillybus_core.c |7 +++ 1 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/xillybus/xillybus_core.c b/drivers/staging/xillybus/xillybus_core.c index 65bbebb..c678b6c 100644 --- a/drivers/staging/xillybus/xillybus_core.c +++ b/drivers/staging/xillybus/xillybus_core.c @@ -407,8 +407,7 @@ static int xilly_get_dma_buffers(struct xilly_endpoint *ep, static int xilly_setupchannels(struct xilly_endpoint *ep, unsigned char *chandesc, - int entries - ) + int entries) { struct device *dev = ep->dev; int i, entry, rc; @@ -784,8 +783,8 @@ static ssize_t xillybus_read(struct file *filp, char __user *userbuf, * the channel-specific mutex. */ - iowrite32(1 | (channel->chan_num << 1) - | (bufidx << 12), + iowrite32(1 | (channel->chan_num << 1) | + (bufidx << 12), channel->endpoint->registers + fpga_buf_ctrl_reg); } -- 1.7.2.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 12/18] staging: xillybus: Added curly brackets as required
Suggested-by: Dan Carpenter Signed-off-by: Eli Billauer --- drivers/staging/xillybus/xillybus_core.c |8 +--- drivers/staging/xillybus/xillybus_pcie.c |4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/staging/xillybus/xillybus_core.c b/drivers/staging/xillybus/xillybus_core.c index 1b63197..0001d18 100644 --- a/drivers/staging/xillybus/xillybus_core.c +++ b/drivers/staging/xillybus/xillybus_core.c @@ -141,7 +141,7 @@ irqreturn_t xillybus_isr(int irq, void *data) ep->msg_buf_size, DMA_FROM_DEVICE); - for (i = 0; i < buf_size; i += 2) + for (i = 0; i < buf_size; i += 2) { if (((buf[i+1] >> 28) & 0xf) != ep->msg_counter) { malformed_message(ep, &buf[i]); dev_warn(ep->dev, @@ -166,6 +166,7 @@ irqreturn_t xillybus_isr(int irq, void *data) return IRQ_HANDLED; } else if (buf[i] & (1 << 22)) /* Last message */ break; + } if (i >= buf_size) { dev_err(ep->dev, "Bad interrupt message. Stopping.\n"); @@ -1093,10 +1094,11 @@ static int xillybus_myflush(struct xilly_channel *channel, long timeout) channel->endpoint->registers + fpga_buf_ctrl_reg); mutex_unlock(&channel->endpoint->register_mutex); - } else if (bufidx == 0) + } else if (bufidx == 0) { bufidx = channel->num_rd_buffers - 1; - else + } else { bufidx--; + } channel->rd_host_buf_pos = new_rd_host_buf_pos; diff --git a/drivers/staging/xillybus/xillybus_pcie.c b/drivers/staging/xillybus/xillybus_pcie.c index 371cec3..ec9b923 100644 --- a/drivers/staging/xillybus/xillybus_pcie.c +++ b/drivers/staging/xillybus/xillybus_pcie.c @@ -199,9 +199,9 @@ static int xilly_probe(struct pci_dev *pdev, * nobody and use 32 bits DMA addressing in any case. */ - if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) + if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { endpoint->dma_using_dac = 0; - else { + } else { dev_err(endpoint->dev, "Failed to set DMA mask. Aborting.\n"); return -ENODEV; } -- 1.7.2.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 13/18] staging: xillybus: Fix comments
Trivial comments removed, and one comment clarified Suggested-by: Dan Carpenter Signed-off-by: Eli Billauer --- drivers/staging/xillybus/xillybus_core.c | 15 --- 1 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/staging/xillybus/xillybus_core.c b/drivers/staging/xillybus/xillybus_core.c index 0001d18..04c60c6 100644 --- a/drivers/staging/xillybus/xillybus_core.c +++ b/drivers/staging/xillybus/xillybus_core.c @@ -402,7 +402,7 @@ static int xilly_get_dma_buffers(struct xilly_endpoint *ep, s->left_of_salami -= bytebufsize; s->salami += bytebufsize; } - return 0; /* Success */ + return 0; } static int xilly_setupchannels(struct xilly_endpoint *ep, @@ -668,7 +668,7 @@ static int xilly_obtain_idt(struct xilly_endpoint *endpoint) return -ENODEV; } - return 0; /* Success */ + return 0; } static ssize_t xillybus_read(struct file *filp, char __user *userbuf, @@ -977,10 +977,11 @@ desperate: } /* -* Formally speaking, we should block for data at this point. -* But to keep the code cleaner, we'll just finish the loop, -* make the unlikely check for data, and then block at the -* usual place. +* Reaching here means that we *do* have data in the buffer, +* but the "partial" flag disallows returning less than +* required. And we don't have as much. So loop again, +* which is likely to end up blocking indefinitely until +* enough data has arrived. */ } @@ -1947,7 +1948,7 @@ static int xilly_quiesce(struct xilly_endpoint *endpoint) "Failed to quiesce the device on exit.\n"); return -ENODEV; } - return 0; /* Success */ + return 0; } int xillybus_endpoint_discovery(struct xilly_endpoint *endpoint) -- 1.7.2.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 15/18] staging: xillybus: Reorganize line breaks for clarity
Suggested-by: Dan Carpenter Signed-off-by: Eli Billauer --- drivers/staging/xillybus/xillybus_core.c | 29 + 1 files changed, 13 insertions(+), 16 deletions(-) diff --git a/drivers/staging/xillybus/xillybus_core.c b/drivers/staging/xillybus/xillybus_core.c index 5ed89ce..65bbebb 100644 --- a/drivers/staging/xillybus/xillybus_core.c +++ b/drivers/staging/xillybus/xillybus_core.c @@ -770,14 +770,11 @@ static ssize_t xillybus_read(struct file *filp, char __user *userbuf, bytes_done += howmany; if (bufferdone) { - channel->endpoint->ephw-> - hw_sync_sgl_for_device - ( - channel->endpoint, - channel->wr_buffers[bufidx]-> - dma_addr, - channel->wr_buf_size, - DMA_FROM_DEVICE); + channel->endpoint->ephw->hw_sync_sgl_for_device( + channel->endpoint, + channel->wr_buffers[bufidx]->dma_addr, + channel->wr_buf_size, + DMA_FROM_DEVICE); /* * Tell FPGA the buffer is done with. It's an @@ -1031,7 +1028,9 @@ static int xillybus_myflush(struct xilly_channel *channel, long timeout) bufidx = channel->rd_host_buf_idx; - bufidx_minus1 = (bufidx == 0) ? channel->num_rd_buffers - 1 : bufidx-1; + bufidx_minus1 = (bufidx == 0) ? + channel->num_rd_buffers - 1 : + bufidx - 1; end_offset_plus1 = channel->rd_host_buf_pos >> channel->log2_element_size; @@ -1320,13 +1319,11 @@ static ssize_t xillybus_write(struct file *filp, const char __user *userbuf, bytes_done += howmany; if (bufferdone) { - channel->endpoint->ephw-> - hw_sync_sgl_for_device( - channel->endpoint, - channel->rd_buffers[bufidx]-> - dma_addr, - channel->rd_buf_size, - DMA_TO_DEVICE); + channel->endpoint->ephw->hw_sync_sgl_for_device( + channel->endpoint, + channel->rd_buffers[bufidx]->dma_addr, + channel->rd_buf_size, + DMA_TO_DEVICE); mutex_lock(&channel->endpoint->register_mutex); -- 1.7.2.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 17/18] staging: xillybus: Fix indentations
Signed-off-by: Eli Billauer --- drivers/staging/xillybus/xillybus_core.c | 58 +++--- drivers/staging/xillybus/xillybus_pcie.c |2 +- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/drivers/staging/xillybus/xillybus_core.c b/drivers/staging/xillybus/xillybus_core.c index c678b6c..c985774 100644 --- a/drivers/staging/xillybus/xillybus_core.c +++ b/drivers/staging/xillybus/xillybus_core.c @@ -146,9 +146,9 @@ irqreturn_t xillybus_isr(int irq, void *data) malformed_message(ep, &buf[i]); dev_warn(ep->dev, "Sending a NACK on counter %x (instead of %x) on entry %d\n", - ((buf[i+1] >> 28) & 0xf), - ep->msg_counter, - i/2); +((buf[i+1] >> 28) & 0xf), +ep->msg_counter, +i/2); if (++ep->failed_messages > 10) { dev_err(ep->dev, @@ -622,8 +622,8 @@ static int xilly_obtain_idt(struct xilly_endpoint *endpoint) channel->wr_sleepy = 1; iowrite32(1 | - (3 << 24), /* Opcode 3 for channel 0 = Send IDT */ - endpoint->registers + fpga_buf_ctrl_reg); + (3 << 24), /* Opcode 3 for channel 0 = Send IDT */ + endpoint->registers + fpga_buf_ctrl_reg); t = wait_event_interruptible_timeout(channel->wr_wait, (!channel->wr_sleepy), @@ -647,7 +647,7 @@ static int xilly_obtain_idt(struct xilly_endpoint *endpoint) if (channel->wr_buffers[0]->end_offset != endpoint->idtlen) { dev_err(endpoint->dev, "IDT length mismatch (%d != %d). Aborting.\n", - channel->wr_buffers[0]->end_offset, endpoint->idtlen); + channel->wr_buffers[0]->end_offset, endpoint->idtlen); return -ENODEV; } @@ -785,8 +785,8 @@ static ssize_t xillybus_read(struct file *filp, char __user *userbuf, iowrite32(1 | (channel->chan_num << 1) | (bufidx << 12), - channel->endpoint->registers + - fpga_buf_ctrl_reg); + channel->endpoint->registers + + fpga_buf_ctrl_reg); } if (rc) { @@ -875,10 +875,10 @@ static ssize_t xillybus_read(struct file *filp, char __user *userbuf, fpga_buf_offset_reg); iowrite32(1 | (channel->chan_num << 1) | - (2 << 24) | /* 2 = offset limit */ - (waiting_bufidx << 12), - channel->endpoint->registers + - fpga_buf_ctrl_reg); + (2 << 24) | /* 2 = offset limit */ + (waiting_bufidx << 12), + channel->endpoint->registers + + fpga_buf_ctrl_reg); mutex_unlock(&channel->endpoint-> register_mutex); @@ -966,10 +966,10 @@ desperate: */ iowrite32(1 | (channel->chan_num << 1) | - (3 << 24) | /* Opcode 3, flush it all! */ - (waiting_bufidx << 12), - channel->endpoint->registers + - fpga_buf_ctrl_reg); + (3 << 24) | /* Opcode 3, flush it all! */ + (waiting_bufidx << 12), + channel->endpoint->registers + + fpga_buf_ctrl_reg); } /* @@ -1088,9 +1088,9 @@ static int xillybus_myflush(struct xilly_channel *channel, long timeout) channel->endpoint->registers + fpga_buf_offset_reg); iowrite32((channel->chan_num << 1) | /* Channel ID */ - (2 << 24) | /* Opcode 2, submit buffer */ - (bufidx << 12), - channel->endpoint->registers + fpga_buf_ctrl_reg); + (2 << 24) | /* Opcode 2, submit buffer */ + (bufidx << 12), + channel->endpoint->registers + fpga_buf_ctrl_reg); mutex_unlock(&channel->endpoint->register_mutex); } else if (bufidx == 0) { @@ -1143,7 +114
[PATCH 18/18] staging: xillybus: Blank lines add/remove
* Blank lines between a function call and its return status check were removed. * Double blank lines were removed. * Blank lines were added and removed as to silence checkpatch.pl --strict Suggested-by: Dan Carpenter Signed-off-by: Eli Billauer --- drivers/staging/xillybus/xillybus.h |1 - drivers/staging/xillybus/xillybus_core.c | 23 ++- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/drivers/staging/xillybus/xillybus.h b/drivers/staging/xillybus/xillybus.h index a0806b5..b9a9eb6 100644 --- a/drivers/staging/xillybus/xillybus.h +++ b/drivers/staging/xillybus/xillybus.h @@ -146,7 +146,6 @@ struct xilly_mapping { int direction; }; - irqreturn_t xillybus_isr(int irq, void *data); struct xilly_endpoint *xillybus_init_endpoint(struct pci_dev *pdev, diff --git a/drivers/staging/xillybus/xillybus_core.c b/drivers/staging/xillybus/xillybus_core.c index c985774..4dca14e 100644 --- a/drivers/staging/xillybus/xillybus_core.c +++ b/drivers/staging/xillybus/xillybus_core.c @@ -185,7 +185,6 @@ irqreturn_t xillybus_isr(int irq, void *data) switch (opcode) { case XILLYMSG_OPCODE_RELEASEBUF: - if ((msg_channel > ep->num_channels) || (msg_channel == 0)) { malformed_message(ep, &buf[i]); @@ -333,7 +332,6 @@ static int xilly_get_dma_buffers(struct xilly_endpoint *ep, this_buffer = devm_kcalloc(dev, bufnum, sizeof(struct xilly_buffer), GFP_KERNEL); - if (!this_buffer) return -ENOMEM; } @@ -365,16 +363,15 @@ static int xilly_get_dma_buffers(struct xilly_endpoint *ep, dev, GFP_KERNEL | __GFP_DMA32 | __GFP_ZERO, allocorder); - if (!s->salami) return -ENOMEM; + s->left_of_salami = allocsize; } rc = ep->ephw->map_single(ep, s->salami, bytebufsize, s->direction, &dma_addr); - if (rc) return rc; @@ -436,14 +433,12 @@ static int xilly_setupchannels(struct xilly_endpoint *ep, channel = devm_kcalloc(dev, ep->num_channels, sizeof(struct xilly_channel), GFP_KERNEL); - if (!channel) return -ENOMEM; ep->channels = devm_kcalloc(dev, ep->num_channels + 1, sizeof(struct xilly_channel *), GFP_KERNEL); - if (!ep->channels) return -ENOMEM; @@ -520,7 +515,6 @@ static int xilly_setupchannels(struct xilly_endpoint *ep, buffers = devm_kcalloc(dev, bufnum, sizeof(struct xilly_buffer *), GFP_KERNEL); - if (!buffers) return -ENOMEM; } else { @@ -867,7 +861,6 @@ static ssize_t xillybus_read(struct file *filp, char __user *userbuf, if (channel->wr_synchronous || (offsetlimit < (buf_elements - 1))) { - mutex_lock(&channel->endpoint->register_mutex); iowrite32(offsetlimit, @@ -883,7 +876,6 @@ static ssize_t xillybus_read(struct file *filp, char __user *userbuf, mutex_unlock(&channel->endpoint-> register_mutex); } - } /* @@ -894,7 +886,6 @@ static ssize_t xillybus_read(struct file *filp, char __user *userbuf, if (!channel->wr_allow_partial || (no_time_left && (bytes_done == 0))) { - /* * This do-loop will run more than once if another * thread reasserted wr_sleepy before we got the mutex @@ -1104,7 +1095,6 @@ static int xillybus_myflush(struct xilly_channel *channel, long timeout) if (timeout < 0) goto done; /* Autoflush */ - /* * bufidx is now the last buffer written to (or equal to * rd_fpga_buf_idx if buffer was never written to), and @@ -1181,7 +1171,6 @@ static void xillybus_autoflush(struct work_struct *work) int rc; rc = xillybus_myflush(channel, -1); - if (rc == -EINTR) dev_warn(channel->endpoint->dev, "Autoflush failed because work queue thread got a signal.\n"); @@ -1449,7 +1438,6 @@ static int xillybus_open(struct inode *inode, struct file *filp
[PATCH 14/18] staging: xillybus: Fix incorrect cast
Suggested-by: Dan Carpenter Signed-off-by: Eli Billauer --- drivers/staging/xillybus/xillybus_core.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/staging/xillybus/xillybus_core.c b/drivers/staging/xillybus/xillybus_core.c index 04c60c6..5ed89ce 100644 --- a/drivers/staging/xillybus/xillybus_core.c +++ b/drivers/staging/xillybus/xillybus_core.c @@ -664,7 +664,7 @@ static int xilly_obtain_idt(struct xilly_endpoint *endpoint) if (*version > 0x82) { dev_err(endpoint->dev, "No support for IDT version 0x%02x. Maybe the xillybus driver needs an upgarde. Aborting.\n", - (int) *version); + (unsigned int) *version); return -ENODEV; } -- 1.7.2.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 11/18] staging: xillybus: Clarified the stop condition for a loop
Suggested-by: Dan Carpenter Signed-off-by: Eli Billauer --- drivers/staging/xillybus/xillybus_core.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/xillybus/xillybus_core.c b/drivers/staging/xillybus/xillybus_core.c index 63c2c14..1b63197 100644 --- a/drivers/staging/xillybus/xillybus_core.c +++ b/drivers/staging/xillybus/xillybus_core.c @@ -172,9 +172,9 @@ irqreturn_t xillybus_isr(int irq, void *data) return IRQ_HANDLED; } - buf_size = i; + buf_size = i + 2; - for (i = 0; i <= buf_size; i += 2) { /* Scan through messages */ + for (i = 0; i < buf_size; i += 2) { /* Scan through messages */ opcode = (buf[i] >> 24) & 0xff; msg_dir = buf[i] & 1; -- 1.7.2.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: rtl8192u: fix brace style coding issue in r819xU_firmware.c
This is a patch to the file r819xU_firmware.c that fixes a brace warning found by checkpatch.pl tool drivers/staging/rtl8192u/r819xU_firmware.c |5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -- 1.7.9.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: rtl8192u: fix brace style coding issue in r819xU_firmware.c
Signed-off-by: Chaitra Ramaiah --- drivers/staging/rtl8192u/r819xU_firmware.c |5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8192u/r819xU_firmware.c b/drivers/staging/rtl8192u/r819xU_firmware.c index 671cbe6..40e1ef5 100644 --- a/drivers/staging/rtl8192u/r819xU_firmware.c +++ b/drivers/staging/rtl8192u/r819xU_firmware.c @@ -153,11 +153,10 @@ static bool CPUcheck_maincodeok_turnonCPU(struct net_device *dev) break; }while(check_bootOk_time--); - if (!(CPU_status&CPU_GEN_BOOT_RDY)) { + if (!(CPU_status&CPU_GEN_BOOT_RDY)) goto CPUCheckMainCodeOKAndTurnOnCPU_Fail; - } else { + else RT_TRACE(COMP_FIRMWARE, "Download Firmware: Boot ready!\n"); - } return rt_status; -- 1.7.9.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: xillybus: Move out of staging
Hello Dan. I've just submitted the patches for the staging git tree (yourself Cc'ed). I didn't have any objections on your comments, so there isn't much to add -- except for thank you. :) Regards, Eli On 01/09/14 15:13, Dan Carpenter wrote: Pretty nice. This is very special purpose hardware and the UAPI for this is fine. The documentation seems good. I had some minor style comments but nothing major stands out. These days I quite like the --strict option for checkpatch.pl. for i in $(find drivers/staging/xillybus/ -name \*\.c) do ./scripts/checkpatch.pl --strict -f $i done ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: rtl8192u: fix brace style coding issue in r819xU_firmware.c
On Thu, 2014-09-04 at 20:41 +0530, Chaitra Ramaiah wrote: [] > diff --git a/drivers/staging/rtl8192u/r819xU_firmware.c > b/drivers/staging/rtl8192u/r819xU_firmware.c [] > @@ -153,11 +153,10 @@ static bool CPUcheck_maincodeok_turnonCPU(struct > net_device *dev) > break; > }while(check_bootOk_time--); > > - if (!(CPU_status&CPU_GEN_BOOT_RDY)) { > + if (!(CPU_status&CPU_GEN_BOOT_RDY)) > goto CPUCheckMainCodeOKAndTurnOnCPU_Fail; > - } else { > + else > RT_TRACE(COMP_FIRMWARE, "Download Firmware: Boot ready!\n"); > - } This would be better as: if (!(CPU_status & CPU_GEN_BOOT_RDY)) goto CPUCheckMainCodeOKandTurnOnCPU_Fail; RT_TRACE(etc...) It'd be nice to eliminate the StudlyCaps and rather long labels too. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging/lustre: Different prototypes between the declaration and the definition
Align the prototype of lprocfs_wr_uint() in the declaration with the one used in the definition. The prototype is: int lprocfs_wr_uint(struct file *file, const char __user *buffer, unsigned long count, void *data) In obdclass/lprocfs_status.c But in lustre/include/lprocfs_status.h, the __user annotation is missing for the attribute buffer. The correct prototype is the first one (the definition) since: - This function is eventually called by the write() function pointer of an instance of struct file_operations - In this function, buffer is a parameter of copy_from_user() - Before the commit 73bb1da692d0dc3e93b9c9e29084d6a5dcbc37a6, the declaration and the definition had the same prototype, but only the .c has been updated. Correcting this will remove a sparse error and add sparse warnings. This is a task of the Eudyptula challenge. Signed-off-by: Loïc Pellegrino --- drivers/staging/lustre/lustre/include/lprocfs_status.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h index 05b5285..ccb6cd4 100644 --- a/drivers/staging/lustre/lustre/include/lprocfs_status.h +++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h @@ -611,7 +611,7 @@ extern int lprocfs_rd_atomic(struct seq_file *m, void *data); extern int lprocfs_wr_atomic(struct file *file, const char __user *buffer, unsigned long count, void *data); extern int lprocfs_rd_uint(struct seq_file *m, void *data); -extern int lprocfs_wr_uint(struct file *file, const char *buffer, +extern int lprocfs_wr_uint(struct file *file, const char __user *buffer, unsigned long count, void *data); extern int lprocfs_rd_uuid(struct seq_file *m, void *data); extern int lprocfs_rd_name(struct seq_file *m, void *data); -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: rtl8192u: fix brace style coding issue in r819xU_firmware.c
On Thu, 2014-09-04 at 20:41 +0530, Chaitra Ramaiah wrote: > Signed-off-by: Chaitra Ramaiah Please put the commit log description from your cover letter into this patch submission and only send 1 email instead of than 2. Rather than add these one-line-at-a-time type changes, I'd just as soon see these all corrected at the same time using something like this below. It also allows git diff -w to be shown as empty in a commit log and this should be verified before and after as compilable with no changes using scripts/objdiff. $ ./scripts/checkpatch.pl --fix-inplace --types=spacing --strict -f drivers/staging/rtl8192u/r819xU_firmware.c $ git diff --stat -p drivers/staging/rtl8192u/r819xU_firmware.c drivers/staging/rtl8192u/r819xU_firmware.c | 52 +++--- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/staging/rtl8192u/r819xU_firmware.c b/drivers/staging/rtl8192u/r819xU_firmware.c index 671cbe6..8e116f8 100644 --- a/drivers/staging/rtl8192u/r819xU_firmware.c +++ b/drivers/staging/rtl8192u/r819xU_firmware.c @@ -51,7 +51,7 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, frag_threshold = pfirmware->cmdpacket_frag_thresold; do { if ((buffer_len - frag_offset) > frag_threshold) { - frag_length = frag_threshold ; + frag_length = frag_threshold; bLastIniPkt = 0; } else { @@ -66,7 +66,7 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, skb = dev_alloc_skb(USB_HWDESC_HEADER_LEN + frag_length + 4); if (!skb) return false; - memcpy((unsigned char *)(skb->cb),&dev,sizeof(dev)); + memcpy((unsigned char *)(skb->cb), &dev, sizeof(dev)); tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); tcb_desc->queue_index = TXCMD_QUEUE; tcb_desc->bCmdOrInit = DESC_PACKET_TYPE_INIT; @@ -78,19 +78,19 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, * Transform from little endian to big endian * and pending zero */ - for(i=0 ; i < frag_length; i+=4) { - *seg_ptr++ = ((i+0)txbuf_size= (u16)i; + tcb_desc->txbuf_size = (u16)i; skb_put(skb, i); - if (!priv->ieee80211->check_nic_enough_desc(dev,tcb_desc->queue_index)|| - (!skb_queue_empty(&priv->ieee80211->skb_waitQ[tcb_desc->queue_index]))||\ - (priv->ieee80211->queue_stop) ) { - RT_TRACE(COMP_FIRMWARE,"=> tx full!\n"); + if (!priv->ieee80211->check_nic_enough_desc(dev, tcb_desc->queue_index) || + (!skb_queue_empty(&priv->ieee80211->skb_waitQ[tcb_desc->queue_index])) || \ + (priv->ieee80211->queue_stop)) { + RT_TRACE(COMP_FIRMWARE, "=> tx full!\n"); skb_queue_tail(&priv->ieee80211->skb_waitQ[tcb_desc->queue_index], skb); } else { priv->ieee80211->softmac_hard_start_xmit(skb, dev); @@ -99,7 +99,7 @@ static bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, code_virtual_address += frag_length; frag_offset += frag_length; - }while(frag_offset < buffer_len); + } while (frag_offset < buffer_len); return rt_status; @@ -131,7 +131,7 @@ static bool CPUcheck_maincodeok_turnonCPU(struct net_device *dev) if (CPU_status&CPU_GEN_PUT_CODE_OK) break; - }while(check_putcodeOK_time--); + } while (check_putcodeOK_time--); if (!(CPU_status&CPU_GEN_PUT_CODE_OK)) { RT_TRACE(COMP_ERR, "Download Firmware: Put code fail!\n"); @@ -151,7 +151,7 @@ static bool CPUcheck_maincodeok_turnonCPU(struct net_device *dev) if (CPU_status&CPU_GEN_BOOT_RDY) break; - }while(check_bootOk_time--); + } while (check_bootOk_time--); if (!(CPU_status&CPU_GEN_BOOT_RDY)) { goto CPUCheckMainCodeOKAndTurnOnCPU_Fail; @@ -181,7 +181,7 @@ static bool CPUcheck_firmware_ready(struct net_device *dev) if (CPU_status&CPU_GEN_FIRM_RDY) break; - }while(check_time--); + } while (check_time--); if (!(CPU_status&CPU_GEN_FIRM_RDY)) goto CPUCheckFirmwareReady_Fail; @@ -217,17 +217,17 @@ bool init_firmware(struct net_device *dev) RT_TRACE(COMP_FIRMWARE, " PlatformInitFirmware()==>\n"); - if (pfirmware->firmware_status == FW_STATUS_0_INIT ) { + if (pfirmware->firmware_stat
Re: [PATCH v4] staging: unisys: uislib: uisqueue.c: rewrite of do_locked_client_insert
On Wed, Sep 03, 2014 at 12:59:50PM +0300, Dan Carpenter wrote: > On Wed, Sep 03, 2014 at 02:59:21PM +0530, Sudip Mukherjee wrote: > > 1) removed unused variables > > 2) fixed sparse warning of context imbalance in 'do_locked_client_insert' > > different lock contexts for basic block > > 3) removed the call to visor_signalqueue_empty() , this function is > >checking whether a signal queue is empty, but the return value > >of the function is not beeing used, so it is safe to remove. > > > > Signed-off-by: Sudip Mukherjee > > Looks good. Thanks! > > Reviewed-by: Dan Carpenter > > regards, > dan carpenter do i need to resend the patch after adding Reviewed-by to it ? thanks sudip > > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: iio: adc: mxs-lradc.c: sparse warning of incorrect type
fixed sparse warning : incorrect type in argument 1 (different address spaces) Signed-off-by: Sudip Mukherjee --- drivers/staging/iio/adc/mxs-lradc.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index 468327f..d8d1fe1 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c @@ -1545,9 +1545,12 @@ static int mxs_lradc_probe(struct platform_device *pdev) /* Grab the memory area */ iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); lradc->dev = &pdev->dev; - lradc->base = devm_ioremap_resource(dev, iores); - if (IS_ERR(lradc->base)) - return PTR_ERR(lradc->base); + void *tempptr; + + tempptr = devm_ioremap_resource(dev, iores); + if (IS_ERR(tempptr)) + return PTR_ERR(tempptr); + lradc->base = tempptr; lradc->clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(lradc->clk)) { -- 1.8.1.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: iio: adc: mxs-lradc.c: sparse warning of incorrect type
On 09/04/2014 06:45 PM, Sudip Mukherjee wrote: fixed sparse warning : incorrect type in argument 1 (different address spaces) Signed-off-by: Sudip Mukherjee --- drivers/staging/iio/adc/mxs-lradc.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index 468327f..d8d1fe1 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c @@ -1545,9 +1545,12 @@ static int mxs_lradc_probe(struct platform_device *pdev) /* Grab the memory area */ iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); lradc->dev = &pdev->dev; - lradc->base = devm_ioremap_resource(dev, iores); - if (IS_ERR(lradc->base)) - return PTR_ERR(lradc->base); + void *tempptr; + + tempptr = devm_ioremap_resource(dev, iores); + if (IS_ERR(tempptr)) + return PTR_ERR(tempptr); + lradc->base = tempptr; This makes no sense at all... devm_ioremap_resource() returns a iomem pointer lrdac->base is a iomem pointer. Please make sure that you have the latest version of sparse installed on your system. lradc->clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(lradc->clk)) { ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: iio: adc: mxs-lradc.c: sparse warning of incorrect type
please discard the patch. It generates additional sparse warning. sorry for it. thanks sudip ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: iio: adc: mxs-lradc.c: sparse warning of incorrect type
On Thu, Sep 04, 2014 at 06:50:05PM +0200, Lars-Peter Clausen wrote: > On 09/04/2014 06:45 PM, Sudip Mukherjee wrote: > >fixed sparse warning : incorrect type in argument 1 > >(different address spaces) > > > >Signed-off-by: Sudip Mukherjee > >--- > > drivers/staging/iio/adc/mxs-lradc.c | 9 ++--- > > 1 file changed, 6 insertions(+), 3 deletions(-) > > > >diff --git a/drivers/staging/iio/adc/mxs-lradc.c > >b/drivers/staging/iio/adc/mxs-lradc.c > >index 468327f..d8d1fe1 100644 > >--- a/drivers/staging/iio/adc/mxs-lradc.c > >+++ b/drivers/staging/iio/adc/mxs-lradc.c > >@@ -1545,9 +1545,12 @@ static int mxs_lradc_probe(struct platform_device > >*pdev) > > /* Grab the memory area */ > > iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); > > lradc->dev = &pdev->dev; > >-lradc->base = devm_ioremap_resource(dev, iores); > >-if (IS_ERR(lradc->base)) > >-return PTR_ERR(lradc->base); > >+void *tempptr; > >+ > >+tempptr = devm_ioremap_resource(dev, iores); > >+if (IS_ERR(tempptr)) > >+return PTR_ERR(tempptr); > >+lradc->base = tempptr; > > This makes no sense at all... devm_ioremap_resource() returns a > iomem pointer lrdac->base is a iomem pointer. sparse is giving warning for argument 1 of IS_ERR. > > Please make sure that you have the latest version of sparse > installed on your system. > > > > > lradc->clk = devm_clk_get(&pdev->dev, NULL); > > if (IS_ERR(lradc->clk)) { > > > thanks sudip ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] rtl8188eu: rtw_xmit: Replace rcu_dereference() with rcu_access_pointer()
The "br_port" local variables obtained through the rcu_dereference() calls are not dereferenced in the rest of their function. Therefore, it is recommended to use rcu_access_pointer() instead of rcu_dereference(). This patch makes the replacements. The first step to detect this was made with the following Coccinelle semantic patch: @@ identifier p; @@ * p = rcu_dereference(...) ... when any when != p ( * if( (<+...p...+>) ) { ... } | * while( (<+...p...+>) ) { ... } ) ... when != p After the analysis of the output, the change was made manually. Signed-off-by: Andreea-Cristina Bernat --- drivers/staging/rtl8188eu/core/rtw_xmit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c index 1413ec8..93228dc 100644 --- a/drivers/staging/rtl8188eu/core/rtw_xmit.c +++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c @@ -1684,7 +1684,7 @@ static int rtw_br_client_tx(struct adapter *padapter, struct sk_buff **pskb) void *br_port = NULL; rcu_read_lock(); - br_port = rcu_dereference(padapter->pnetdev->rx_handler_data); + br_port = rcu_access_pointer(padapter->pnetdev->rx_handler_data); rcu_read_unlock(); spin_lock_bh(&padapter->br_ext_lock); if (!(skb->data[0] & 1) && br_port && @@ -1868,7 +1868,7 @@ s32 rtw_xmit(struct adapter *padapter, struct sk_buff **ppkt) } rcu_read_lock(); - br_port = rcu_dereference(padapter->pnetdev->rx_handler_data); + br_port = rcu_access_pointer(padapter->pnetdev->rx_handler_data); rcu_read_unlock(); if (br_port && check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE)) { -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: iio: adc: mxs-lradc.c: sparse warning of incorrect type
On 09/04/2014 07:12 PM, Sudip Mukherjee wrote: On Thu, Sep 04, 2014 at 06:50:05PM +0200, Lars-Peter Clausen wrote: On 09/04/2014 06:45 PM, Sudip Mukherjee wrote: fixed sparse warning : incorrect type in argument 1 (different address spaces) Signed-off-by: Sudip Mukherjee --- drivers/staging/iio/adc/mxs-lradc.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index 468327f..d8d1fe1 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c @@ -1545,9 +1545,12 @@ static int mxs_lradc_probe(struct platform_device *pdev) /* Grab the memory area */ iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); lradc->dev = &pdev->dev; - lradc->base = devm_ioremap_resource(dev, iores); - if (IS_ERR(lradc->base)) - return PTR_ERR(lradc->base); + void *tempptr; + + tempptr = devm_ioremap_resource(dev, iores); + if (IS_ERR(tempptr)) + return PTR_ERR(tempptr); + lradc->base = tempptr; This makes no sense at all... devm_ioremap_resource() returns a iomem pointer lrdac->base is a iomem pointer. sparse is giving warning for argument 1 of IS_ERR. Not if you update to the latest version of sparse. Please make sure that you have the latest version of sparse installed on your system. lradc->clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(lradc->clk)) { thanks sudip ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 06/21] staging: comedi: adl_pci9118: remove 'n_aichanlist' boardinfo
This member of the boardinfo is the same for all entries. Remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 3abb255..e4c52b4 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -233,7 +233,6 @@ struct boardtype { int device_id; /* PCI device ID of card */ int n_aichan; /* num of A/D chans */ int n_aichand; /* num of A/D chans in diff mode */ - int n_aichanlist; /* len of chanlist */ int ai_maxdata; /* resolution of A/D */ const struct comedi_lrange *rangelist_ai; /* rangelist for A/D */ unsigned int ai_ns_min; /* max sample speed of card v ns */ @@ -249,7 +248,6 @@ static const struct boardtype boardtypes[] = { .device_id = 0x80d9, .n_aichan = 16, .n_aichand = 8, - .n_aichanlist = PCI9118_CHANLEN, .ai_maxdata = 0x0fff, .rangelist_ai = &range_pci9118dg_hr, .ai_ns_min = 3000, @@ -259,7 +257,6 @@ static const struct boardtype boardtypes[] = { .device_id = 0x80d9, .n_aichan = 16, .n_aichand = 8, - .n_aichanlist = PCI9118_CHANLEN, .ai_maxdata = 0x0fff, .rangelist_ai = &range_pci9118hg, .ai_ns_min = 3000, @@ -269,7 +266,6 @@ static const struct boardtype boardtypes[] = { .device_id = 0x80d9, .n_aichan = 16, .n_aichand = 8, - .n_aichanlist = PCI9118_CHANLEN, .ai_maxdata = 0x, .rangelist_ai = &range_pci9118dg_hr, .ai_ns_min = 1, @@ -1902,7 +1898,7 @@ static int pci9118_common_attach(struct comedi_device *dev, int disable_irq, if (dev->irq) { dev->read_subdev = s; s->subdev_flags |= SDF_CMD_READ; - s->len_chanlist = this_board->n_aichanlist; + s->len_chanlist = PCI9118_CHANLEN; s->do_cmdtest = pci9118_ai_cmdtest; s->do_cmd = pci9118_ai_cmd; s->cancel = pci9118_ai_cancel; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 03/21] staging: comedi: adl_pci9118: remove 'ao_maxdata' boardinfo
This member of the boardinfo is the same for all entries. Remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 9686a13..45fa701 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -234,7 +234,6 @@ struct boardtype { int n_aichanlist; /* len of chanlist */ int n_aochan; /* num of D/A chans */ int ai_maxdata; /* resolution of A/D */ - int ao_maxdata; /* resolution of D/A */ const struct comedi_lrange *rangelist_ai; /* rangelist for A/D */ unsigned int ai_ns_min; /* max sample speed of card v ns */ unsigned int ai_pacer_min; /* @@ -254,7 +253,6 @@ static const struct boardtype boardtypes[] = { .n_aichanlist = PCI9118_CHANLEN, .n_aochan = 2, .ai_maxdata = 0x0fff, - .ao_maxdata = 0x0fff, .rangelist_ai = &range_pci9118dg_hr, .ai_ns_min = 3000, .ai_pacer_min = 12, @@ -267,7 +265,6 @@ static const struct boardtype boardtypes[] = { .n_aichanlist = PCI9118_CHANLEN, .n_aochan = 2, .ai_maxdata = 0x0fff, - .ao_maxdata = 0x0fff, .rangelist_ai = &range_pci9118hg, .ai_ns_min = 3000, .ai_pacer_min = 12, @@ -280,7 +277,6 @@ static const struct boardtype boardtypes[] = { .n_aichanlist = PCI9118_CHANLEN, .n_aochan = 2, .ai_maxdata = 0x, - .ao_maxdata = 0x0fff, .rangelist_ai = &range_pci9118dg_hr, .ai_ns_min = 1, .ai_pacer_min = 40, @@ -1924,7 +1920,7 @@ static int pci9118_common_attach(struct comedi_device *dev, int disable_irq, s->type = COMEDI_SUBD_AO; s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON; s->n_chan = this_board->n_aochan; - s->maxdata = this_board->ao_maxdata; + s->maxdata = 0x0fff; s->len_chanlist = this_board->n_aochan; s->range_table = &range_bipolar10; s->insn_write = pci9118_insn_write_ao; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 05/21] staging: comedi: adl_pci9118: remove 'half_fifo_size' boardinfo
This member of the boardinfo is the same for all entries. Remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 558732c..3abb255 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -195,6 +195,8 @@ #define EXTTRG_AI 0 /* ext trg is used by AI */ +#define PCI9118_HALF_FIFO_SZ (1024 / 2) + static const struct comedi_lrange range_pci9118dg_hr = { 8, { BIP_RANGE(5), @@ -239,8 +241,6 @@ struct boardtype { * minimal pacer value * (c1*c2 or c1 in burst) */ - int half_fifo_size; /* size of FIFO/2 */ - }; static const struct boardtype boardtypes[] = { @@ -254,7 +254,6 @@ static const struct boardtype boardtypes[] = { .rangelist_ai = &range_pci9118dg_hr, .ai_ns_min = 3000, .ai_pacer_min = 12, - .half_fifo_size = 512, }, { .name = "pci9118hg", .device_id = 0x80d9, @@ -265,7 +264,6 @@ static const struct boardtype boardtypes[] = { .rangelist_ai = &range_pci9118hg, .ai_ns_min = 3000, .ai_pacer_min = 12, - .half_fifo_size = 512, }, { .name = "pci9118hr", .device_id = 0x80d9, @@ -276,7 +274,6 @@ static const struct boardtype boardtypes[] = { .rangelist_ai = &range_pci9118dg_hr, .ai_ns_min = 1, .ai_pacer_min = 40, - .half_fifo_size = 512, }, }; @@ -1355,12 +1352,12 @@ static int Compute_and_setup_dma(struct comedi_device *dev, devpriv->dmabuf_use_size[1] = dmalen1; #if 0 - if (cmd->scan_end_arg < this_board->half_fifo_size) { + if (cmd->scan_end_arg < PCI9118_HALF_FIFO_SZ) { devpriv->dmabuf_panic_size[0] = - (this_board->half_fifo_size / cmd->scan_end_arg + + (PCI9118_HALF_FIFO_SZ / cmd->scan_end_arg + 1) * cmd->scan_end_arg * sizeof(short); devpriv->dmabuf_panic_size[1] = - (this_board->half_fifo_size / cmd->scan_end_arg + + (PCI9118_HALF_FIFO_SZ / cmd->scan_end_arg + 1) * cmd->scan_end_arg * sizeof(short); } else { devpriv->dmabuf_panic_size[0] = -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 04/21] staging: comedi: adl_pci9118: remove 'n_aochan' boardinfo
This member of the boardinfo is the same for all entries. Remove it. Also, remove the initialization of the subdevice 'len_chanlist'. This member is only used if the subdevice supports async commands. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 45fa701..558732c 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -232,7 +232,6 @@ struct boardtype { int n_aichan; /* num of A/D chans */ int n_aichand; /* num of A/D chans in diff mode */ int n_aichanlist; /* len of chanlist */ - int n_aochan; /* num of D/A chans */ int ai_maxdata; /* resolution of A/D */ const struct comedi_lrange *rangelist_ai; /* rangelist for A/D */ unsigned int ai_ns_min; /* max sample speed of card v ns */ @@ -251,7 +250,6 @@ static const struct boardtype boardtypes[] = { .n_aichan = 16, .n_aichand = 8, .n_aichanlist = PCI9118_CHANLEN, - .n_aochan = 2, .ai_maxdata = 0x0fff, .rangelist_ai = &range_pci9118dg_hr, .ai_ns_min = 3000, @@ -263,7 +261,6 @@ static const struct boardtype boardtypes[] = { .n_aichan = 16, .n_aichand = 8, .n_aichanlist = PCI9118_CHANLEN, - .n_aochan = 2, .ai_maxdata = 0x0fff, .rangelist_ai = &range_pci9118hg, .ai_ns_min = 3000, @@ -275,7 +272,6 @@ static const struct boardtype boardtypes[] = { .n_aichan = 16, .n_aichand = 8, .n_aichanlist = PCI9118_CHANLEN, - .n_aochan = 2, .ai_maxdata = 0x, .rangelist_ai = &range_pci9118dg_hr, .ai_ns_min = 1, @@ -1919,9 +1915,8 @@ static int pci9118_common_attach(struct comedi_device *dev, int disable_irq, s = &dev->subdevices[1]; s->type = COMEDI_SUBD_AO; s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON; - s->n_chan = this_board->n_aochan; + s->n_chan = 2; s->maxdata = 0x0fff; - s->len_chanlist = this_board->n_aochan; s->range_table = &range_bipolar10; s->insn_write = pci9118_insn_write_ao; s->insn_read = pci9118_insn_read_ao; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 02/21] staging: comedi: adl_pci9118: remove 'rangelist_ao' boardinfo
This member of the boardinfo is the same for all entries. Remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 300d85e..9686a13 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -236,7 +236,6 @@ struct boardtype { int ai_maxdata; /* resolution of A/D */ int ao_maxdata; /* resolution of D/A */ const struct comedi_lrange *rangelist_ai; /* rangelist for A/D */ - const struct comedi_lrange *rangelist_ao; /* rangelist for D/A */ unsigned int ai_ns_min; /* max sample speed of card v ns */ unsigned int ai_pacer_min; /* * minimal pacer value @@ -257,7 +256,6 @@ static const struct boardtype boardtypes[] = { .ai_maxdata = 0x0fff, .ao_maxdata = 0x0fff, .rangelist_ai = &range_pci9118dg_hr, - .rangelist_ao = &range_bipolar10, .ai_ns_min = 3000, .ai_pacer_min = 12, .half_fifo_size = 512, @@ -271,7 +269,6 @@ static const struct boardtype boardtypes[] = { .ai_maxdata = 0x0fff, .ao_maxdata = 0x0fff, .rangelist_ai = &range_pci9118hg, - .rangelist_ao = &range_bipolar10, .ai_ns_min = 3000, .ai_pacer_min = 12, .half_fifo_size = 512, @@ -285,7 +282,6 @@ static const struct boardtype boardtypes[] = { .ai_maxdata = 0x, .ao_maxdata = 0x0fff, .rangelist_ai = &range_pci9118dg_hr, - .rangelist_ao = &range_bipolar10, .ai_ns_min = 1, .ai_pacer_min = 40, .half_fifo_size = 512, @@ -1930,7 +1926,7 @@ static int pci9118_common_attach(struct comedi_device *dev, int disable_irq, s->n_chan = this_board->n_aochan; s->maxdata = this_board->ao_maxdata; s->len_chanlist = this_board->n_aochan; - s->range_table = this_board->rangelist_ao; + s->range_table = &range_bipolar10; s->insn_write = pci9118_insn_write_ao; s->insn_read = pci9118_insn_read_ao; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 01/21] staging: comedi: adl_pci9118: remove unused boardinfo
Remove all the boardinfo members that are not used by the driver. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 15 --- 1 file changed, 15 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index b71b0cf..300d85e 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -229,14 +229,8 @@ static const struct comedi_lrange range_pci9118hg = { struct boardtype { const char *name; /* board name */ int device_id; /* PCI device ID of card */ - int iorange_amcc; /* iorange for own S5933 region */ - int iorange_9118; /* pass thru card region size */ int n_aichan; /* num of A/D chans */ int n_aichand; /* num of A/D chans in diff mode */ - int mux_aichan; /* -* num of A/D chans with -* external multiplexor -*/ int n_aichanlist; /* len of chanlist */ int n_aochan; /* num of D/A chans */ int ai_maxdata; /* resolution of A/D */ @@ -256,11 +250,8 @@ static const struct boardtype boardtypes[] = { { .name = "pci9118dg", .device_id = 0x80d9, - .iorange_amcc = AMCC_OP_REG_SIZE, - .iorange_9118 = IORANGE_9118, .n_aichan = 16, .n_aichand = 8, - .mux_aichan = 256, .n_aichanlist = PCI9118_CHANLEN, .n_aochan = 2, .ai_maxdata = 0x0fff, @@ -273,11 +264,8 @@ static const struct boardtype boardtypes[] = { }, { .name = "pci9118hg", .device_id = 0x80d9, - .iorange_amcc = AMCC_OP_REG_SIZE, - .iorange_9118 = IORANGE_9118, .n_aichan = 16, .n_aichand = 8, - .mux_aichan = 256, .n_aichanlist = PCI9118_CHANLEN, .n_aochan = 2, .ai_maxdata = 0x0fff, @@ -290,11 +278,8 @@ static const struct boardtype boardtypes[] = { }, { .name = "pci9118hr", .device_id = 0x80d9, - .iorange_amcc = AMCC_OP_REG_SIZE, - .iorange_9118 = IORANGE_9118, .n_aichan = 16, .n_aichand = 8, - .mux_aichan = 256, .n_aichanlist = PCI9118_CHANLEN, .n_aochan = 2, .ai_maxdata = 0x, -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 00/21] staging: comedi: adl_pci9118: cleanup the boardinfo and attach
Remove all the unused information in the boardinfo and tidy it up. Clenaup the attach of this driver a bit. H Hartley Sweeten (21): staging: comedi: adl_pci9118: remove unused boardinfo staging: comedi: adl_pci9118: remove 'rangelist_ao' boardinfo staging: comedi: adl_pci9118: remove 'ao_maxdata' boardinfo staging: comedi: adl_pci9118: remove 'n_aochan' boardinfo staging: comedi: adl_pci9118: remove 'half_fifo_size' boardinfo staging: comedi: adl_pci9118: remove 'n_aichanlist' boardinfo staging: comedi: adl_pci9118: remove 'n_aichand' boardinfo staging: comedi: adl_pci9118: remove 'n_aichan' boardinfo staging: comedi: adl_pci9118: remove 'ai_ns_min' from boardinfo staging: comedi: adl_pci9118: remove 'ai_pacer_min' from boardinfo staging: comedi: adl_pci9118: refactor 'rangelist_ai' in boardinfo staging: comedi: adl_pci9118: refactor 'ai_maxdata' in boardinfo staging: comedi: adl_pci9118: use 'context' in (*auto_attach) staging: comedi: adl_pci9118: remove 'device_id' from boardinfo staging: comedi: adl_pci9118: remove unnecessary dev->board_name initialization staging: comedi: adl_pci9118: rename boardinfo struct staging: comedi: adl_pci9118: allocate private data in pci9118_common_attach() staging: comedi: adl_pci9118: tidy up digital output subdevice init staging: comedi: adl_pci9118: tidy up digital input subdevice init staging: comedi: adl_pci9118: tidy up analog output subdevice init staging: comedi: adl_pci9118: tidy up analog input subdevice init drivers/staging/comedi/drivers/adl_pci9118.c | 287 +++ 1 file changed, 114 insertions(+), 173 deletions(-) -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 09/21] staging: comedi: adl_pci9118: remove 'ai_ns_min' from boardinfo
The minimum convert time 'ai_ns_min' is based on the sampling rate of the A/D converter. This driver supports boards that use different ADC chips for 16-bit and 12-bit analog inputs. These chips have different sampling rates. For aesthetics, move the 'ai_ns_min' member from the boardinfo to the private data. Initialize the member during the attach based on the 'maxdata' of the analog inputs. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 40 +--- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 3d25753..3e83b21 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -233,7 +233,6 @@ struct boardtype { int device_id; /* PCI device ID of card */ int ai_maxdata; /* resolution of A/D */ const struct comedi_lrange *rangelist_ai; /* rangelist for A/D */ - unsigned int ai_ns_min; /* max sample speed of card v ns */ unsigned int ai_pacer_min; /* * minimal pacer value * (c1*c2 or c1 in burst) @@ -246,21 +245,18 @@ static const struct boardtype boardtypes[] = { .device_id = 0x80d9, .ai_maxdata = 0x0fff, .rangelist_ai = &range_pci9118dg_hr, - .ai_ns_min = 3000, .ai_pacer_min = 12, }, { .name = "pci9118hg", .device_id = 0x80d9, .ai_maxdata = 0x0fff, .rangelist_ai = &range_pci9118hg, - .ai_ns_min = 3000, .ai_pacer_min = 12, }, { .name = "pci9118hr", .device_id = 0x80d9, .ai_maxdata = 0x, .rangelist_ai = &range_pci9118dg_hr, - .ai_ns_min = 1, .ai_pacer_min = 40, }, }; @@ -341,6 +337,7 @@ struct pci9118_private { */ unsigned int ai_maskerr;/* which warning was printed */ unsigned int ai_maskharderr;/* on which error bits stops */ + unsigned int ai_ns_min; }; static int check_channel_list(struct comedi_device *dev, @@ -709,20 +706,21 @@ static void pci9118_calc_divisors(char mode, struct comedi_device *dev, unsigned int chnsshfront) { const struct boardtype *this_board = comedi_board(dev); + struct pci9118_private *devpriv = dev->private; struct comedi_cmd *cmd = &s->async->cmd; switch (mode) { case 1: case 4: - if (*tim2 < this_board->ai_ns_min) - *tim2 = this_board->ai_ns_min; + if (*tim2 < devpriv->ai_ns_min) + *tim2 = devpriv->ai_ns_min; i8253_cascade_ns_to_timer(I8254_OSC_BASE_4MHZ, div1, div2, tim2, flags & CMDF_ROUND_NEAREST); break; case 2: - if (*tim2 < this_board->ai_ns_min) - *tim2 = this_board->ai_ns_min; + if (*tim2 < devpriv->ai_ns_min) + *tim2 = devpriv->ai_ns_min; *div1 = *tim2 / I8254_OSC_BASE_4MHZ; /* convert timer (burst) */ if (*div1 < this_board->ai_pacer_min) @@ -1072,7 +1070,6 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_cmd *cmd) { - const struct boardtype *this_board = comedi_board(dev); struct pci9118_private *devpriv = dev->private; int err = 0; unsigned int flags; @@ -1154,7 +1151,7 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev, if (cmd->scan_begin_src == TRIG_TIMER) err |= cfc_check_trigger_arg_min(&cmd->scan_begin_arg, -this_board->ai_ns_min); +devpriv->ai_ns_min); if (cmd->scan_begin_src == TRIG_EXT) if (cmd->scan_begin_arg) { @@ -1166,7 +1163,7 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev, if (cmd->convert_src & (TRIG_TIMER | TRIG_NOW)) err |= cfc_check_trigger_arg_min(&cmd->convert_arg, -this_board->ai_ns_min); +devpriv->ai_ns_min); if (cmd->convert_src == TRIG_EXT) err |= cfc_check_trigger_arg_is(&cmd->convert_arg, 0); @@
[PATCH 13/21] staging: comedi: adl_pci9118: use 'context' in (*auto_attach)
The pci_device_id 'driver_data' is passed as the 'context' when the (*auto_attach) mechanism is used to attach this driver. Add a boardid enum and index the boardinfo so that the "pci9118dg" boardinfo is automatically selected. This allow removing the pci9118_find_boardinfo() helper. Unfortunately all the boards supported by this driver have the same device id. Add commented out entries in the device table for them. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 50 +--- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 333c68f..dc0d0cb 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -228,6 +228,12 @@ static const struct comedi_lrange pci9118hg_ai_range = { * of BIP/UNI ranges */ +enum pci9118_boardid { + BOARD_PCI9118DG, + BOARD_PCI9118HG, + BOARD_PCI9118HR, +}; + struct boardtype { const char *name; /* board name */ int device_id; /* PCI device ID of card */ @@ -236,14 +242,16 @@ struct boardtype { }; static const struct boardtype boardtypes[] = { - { + [BOARD_PCI9118DG] = { .name = "pci9118dg", .device_id = 0x80d9, - }, { + }, + [BOARD_PCI9118HG] = { .name = "pci9118hg", .device_id = 0x80d9, .is_hg = 1, - }, { + }, + [BOARD_PCI9118HR] = { .name = "pci9118hr", .device_id = 0x80d9, .ai_is_16bit= 1, @@ -1732,20 +1740,6 @@ static int pci9118_reset(struct comedi_device *dev) return 0; } -/* - * FIXME - this is pretty ineffective because all the supported board types - * have the same device ID! - */ -static const struct boardtype *pci9118_find_boardinfo(struct pci_dev *pcidev) -{ - unsigned int i; - - for (i = 0; i < ARRAY_SIZE(boardtypes); i++) - if (pcidev->device == boardtypes[i].device_id) - return &boardtypes[i]; - return NULL; -} - static struct pci_dev *pci9118_find_pci(struct comedi_device *dev, struct comedi_devconfig *it) { @@ -1959,22 +1953,23 @@ static int pci9118_attach(struct comedi_device *dev, } static int pci9118_auto_attach(struct comedi_device *dev, -unsigned long context_unused) + unsigned long context) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); + const struct boardtype *board = NULL; struct pci9118_private *devpriv; + if (context < ARRAY_SIZE(boardtypes)) + board = &boardtypes[context]; + if (!board) + return -ENODEV; + dev->board_ptr = board; + dev->board_name = board->name; + devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv)); if (!devpriv) return -ENOMEM; - dev->board_ptr = pci9118_find_boardinfo(pcidev); - if (dev->board_ptr == NULL) { - dev_err(dev->class_dev, - "adl_pci9118: cannot determine board type for pci %s\n", - pci_name(pcidev)); - return -EINVAL; - } /* * Need to 'get' the PCI device to match the 'put' in pci9118_detach(). * (The 'put' also matches the implicit 'get' by pci9118_find_pci().) @@ -2023,8 +2018,11 @@ static int adl_pci9118_pci_probe(struct pci_dev *dev, id->driver_data); } +/* FIXME: All the supported board types have the same device ID! */ static const struct pci_device_id adl_pci9118_pci_table[] = { - { PCI_DEVICE(PCI_VENDOR_ID_AMCC, 0x80d9) }, + { PCI_VDEVICE(AMCC, 0x80d9), BOARD_PCI9118DG }, +/* { PCI_VDEVICE(AMCC, 0x80d9), BOARD_PCI9118HG }, */ +/* { PCI_VDEVICE(AMCC, 0x80d9), BOARD_PCI9118HR }, */ { 0 } }; MODULE_DEVICE_TABLE(pci, adl_pci9118_pci_table); -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 18/21] staging: comedi: adl_pci9118: tidy up digital output subdevice init
For aesthetics, add some whitespace to the digital output subdevice init. Remove the SDF_GROUND and SDF_COMMON subdev_flags. These flags only apply to analog subdevices. Remove the 'len_chanlist' init, this subdevice member is only used with subdevices that support async commands. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 8b086c2..d7af6f7 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -1907,14 +1907,14 @@ static int pci9118_common_attach(struct comedi_device *dev, int disable_irq, s->range_table = &range_digital; s->insn_bits = pci9118_insn_bits_di; + /* Digital Output subdevice */ s = &dev->subdevices[3]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON; - s->n_chan = 4; - s->maxdata = 1; - s->len_chanlist = 4; - s->range_table = &range_digital; - s->insn_bits = pci9118_insn_bits_do; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 4; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits= pci9118_insn_bits_do; devpriv->ai_maskharderr = 0x10a; /* default measure crash condition */ -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 20/21] staging: comedi: adl_pci9118: tidy up analog output subdevice init
For aesthetics, add some whitespace to the analog output subdevice init. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index f9598b0..2ff9bc7 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -1889,14 +1889,15 @@ static int pci9118_common_attach(struct comedi_device *dev, int disable_irq, devpriv->ai_ns_min = 3000; } + /* Analog Output subdevice */ s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON; - s->n_chan = 2; - s->maxdata = 0x0fff; - s->range_table = &range_bipolar10; - s->insn_write = pci9118_insn_write_ao; - s->insn_read = pci9118_insn_read_ao; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON; + s->n_chan = 2; + s->maxdata = 0x0fff; + s->range_table = &range_bipolar10; + s->insn_write = pci9118_insn_write_ao; + s->insn_read= pci9118_insn_read_ao; /* Digital Input subdevice */ s = &dev->subdevices[2]; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 17/21] staging: comedi: adl_pci9118: allocate private data in pci9118_common_attach()
The (*auto_attach) and legacy (*attach) both allocate the private data but don't use it. For aesthetics, move the allocation into the common attach code. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 16 +--- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 81ba59f..8b086c2 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -1767,12 +1767,16 @@ static int pci9118_common_attach(struct comedi_device *dev, int disable_irq, int hw_err_mask) { const struct pci9118_boardinfo *board = comedi_board(dev); - struct pci9118_private *devpriv = dev->private; struct pci_dev *pcidev = comedi_to_pci_dev(dev); + struct pci9118_private *devpriv; struct comedi_subdevice *s; int ret, pages, i; u16 u16w; + devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv)); + if (!devpriv) + return -ENOMEM; + ret = comedi_pci_enable(dev); if (ret) return ret; @@ -1923,7 +1927,6 @@ static int pci9118_common_attach(struct comedi_device *dev, int disable_irq, static int pci9118_attach(struct comedi_device *dev, struct comedi_devconfig *it) { - struct pci9118_private *devpriv; struct pci_dev *pcidev; int ext_mux, disable_irq, master, softsshdelay, hw_err_mask; @@ -1933,10 +1936,6 @@ static int pci9118_attach(struct comedi_device *dev, softsshdelay = it->options[4]; hw_err_mask = it->options[5]; - devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv)); - if (!devpriv) - return -ENOMEM; - pcidev = pci9118_find_pci(dev, it); if (!pcidev) return -EIO; @@ -1951,7 +1950,6 @@ static int pci9118_auto_attach(struct comedi_device *dev, { struct pci_dev *pcidev = comedi_to_pci_dev(dev); const struct pci9118_boardinfo *board = NULL; - struct pci9118_private *devpriv; if (context < ARRAY_SIZE(pci9118_boards)) board = &pci9118_boards[context]; @@ -1960,10 +1958,6 @@ static int pci9118_auto_attach(struct comedi_device *dev, dev->board_ptr = board; dev->board_name = board->name; - devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv)); - if (!devpriv) - return -ENOMEM; - /* * Need to 'get' the PCI device to match the 'put' in pci9118_detach(). * (The 'put' also matches the implicit 'get' by pci9118_find_pci().) -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 10/21] staging: comedi: adl_pci9118: remove 'ai_pacer_min' from boardinfo
This value can easily be calculated based on the minimum sampling rate, 'ai_ns_min', and the base clock speed of the timers. Do that instead and remove the boardinfo. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 14 -- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 3e83b21..8653e42 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -233,10 +233,6 @@ struct boardtype { int device_id; /* PCI device ID of card */ int ai_maxdata; /* resolution of A/D */ const struct comedi_lrange *rangelist_ai; /* rangelist for A/D */ - unsigned int ai_pacer_min; /* -* minimal pacer value -* (c1*c2 or c1 in burst) -*/ }; static const struct boardtype boardtypes[] = { @@ -245,19 +241,16 @@ static const struct boardtype boardtypes[] = { .device_id = 0x80d9, .ai_maxdata = 0x0fff, .rangelist_ai = &range_pci9118dg_hr, - .ai_pacer_min = 12, }, { .name = "pci9118hg", .device_id = 0x80d9, .ai_maxdata = 0x0fff, .rangelist_ai = &range_pci9118hg, - .ai_pacer_min = 12, }, { .name = "pci9118hr", .device_id = 0x80d9, .ai_maxdata = 0x, .rangelist_ai = &range_pci9118dg_hr, - .ai_pacer_min = 40, }, }; @@ -705,9 +698,9 @@ static void pci9118_calc_divisors(char mode, struct comedi_device *dev, unsigned int *div1, unsigned int *div2, unsigned int chnsshfront) { - const struct boardtype *this_board = comedi_board(dev); struct pci9118_private *devpriv = dev->private; struct comedi_cmd *cmd = &s->async->cmd; + unsigned int min_pacer; switch (mode) { case 1: @@ -723,8 +716,9 @@ static void pci9118_calc_divisors(char mode, struct comedi_device *dev, *tim2 = devpriv->ai_ns_min; *div1 = *tim2 / I8254_OSC_BASE_4MHZ; /* convert timer (burst) */ - if (*div1 < this_board->ai_pacer_min) - *div1 = this_board->ai_pacer_min; + min_pacer = devpriv->ai_ns_min / I8254_OSC_BASE_4MHZ; + if (*div1 < min_pacer) + *div1 = min_pacer; *div2 = *tim1 / I8254_OSC_BASE_4MHZ;/* scan timer */ *div2 = *div2 / *div1; /* major timer is c1*c2 */ if (*div2 < chans) -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 14/21] staging: comedi: adl_pci9118: remove 'device_id' from boardinfo
This member of the boardinfo is the same for all entries. Remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index dc0d0cb..6471f2c 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -236,7 +236,6 @@ enum pci9118_boardid { struct boardtype { const char *name; /* board name */ - int device_id; /* PCI device ID of card */ unsigned int ai_is_16bit:1; unsigned int is_hg:1; }; @@ -244,16 +243,13 @@ struct boardtype { static const struct boardtype boardtypes[] = { [BOARD_PCI9118DG] = { .name = "pci9118dg", - .device_id = 0x80d9, }, [BOARD_PCI9118HG] = { .name = "pci9118hg", - .device_id = 0x80d9, .is_hg = 1, }, [BOARD_PCI9118HR] = { .name = "pci9118hr", - .device_id = 0x80d9, .ai_is_16bit= 1, }, }; @@ -1743,7 +1739,6 @@ static int pci9118_reset(struct comedi_device *dev) static struct pci_dev *pci9118_find_pci(struct comedi_device *dev, struct comedi_devconfig *it) { - const struct boardtype *this_board = comedi_board(dev); struct pci_dev *pcidev = NULL; int bus = it->options[0]; int slot = it->options[1]; @@ -1751,7 +1746,7 @@ static struct pci_dev *pci9118_find_pci(struct comedi_device *dev, for_each_pci_dev(pcidev) { if (pcidev->vendor != PCI_VENDOR_ID_AMCC) continue; - if (pcidev->device != this_board->device_id) + if (pcidev->device != 0x80d9) continue; if (bus || slot) { /* requested particular bus/slot */ -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 16/21] staging: comedi: adl_pci9118: rename boardinfo struct
For aesthetics, rename the struct used for the boardinfo so it has namespace associated with the driver. Also, rename the local variable used for the boardinfo pointer to simply 'board'. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 26 +- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index c582301..81ba59f 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -234,13 +234,13 @@ enum pci9118_boardid { BOARD_PCI9118HR, }; -struct boardtype { - const char *name; /* board name */ +struct pci9118_boardinfo { + const char *name; unsigned int ai_is_16bit:1; unsigned int is_hg:1; }; -static const struct boardtype boardtypes[] = { +static const struct pci9118_boardinfo pci9118_boards[] = { [BOARD_PCI9118DG] = { .name = "pci9118dg", }, @@ -1766,7 +1766,7 @@ static int pci9118_common_attach(struct comedi_device *dev, int disable_irq, int master, int ext_mux, int softsshdelay, int hw_err_mask) { - const struct boardtype *this_board = comedi_board(dev); + const struct pci9118_boardinfo *board = comedi_board(dev); struct pci9118_private *devpriv = dev->private; struct pci_dev *pcidev = comedi_to_pci_dev(dev); struct comedi_subdevice *s; @@ -1857,9 +1857,9 @@ static int pci9118_common_attach(struct comedi_device *dev, int disable_irq, else s->n_chan = 16; - s->maxdata = this_board->ai_is_16bit ? 0x : 0x0fff; - s->range_table = this_board->is_hg ? &pci9118hg_ai_range - : &pci9118_ai_range; + s->maxdata = board->ai_is_16bit ? 0x : 0x0fff; + s->range_table = board->is_hg ? &pci9118hg_ai_range + : &pci9118_ai_range; s->insn_read = pci9118_insn_read_ai; if (dev->irq) { dev->read_subdev = s; @@ -1950,11 +1950,11 @@ static int pci9118_auto_attach(struct comedi_device *dev, unsigned long context) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); - const struct boardtype *board = NULL; + const struct pci9118_boardinfo *board = NULL; struct pci9118_private *devpriv; - if (context < ARRAY_SIZE(boardtypes)) - board = &boardtypes[context]; + if (context < ARRAY_SIZE(pci9118_boards)) + board = &pci9118_boards[context]; if (!board) return -ENODEV; dev->board_ptr = board; @@ -2000,9 +2000,9 @@ static struct comedi_driver adl_pci9118_driver = { .attach = pci9118_attach, .auto_attach= pci9118_auto_attach, .detach = pci9118_detach, - .num_names = ARRAY_SIZE(boardtypes), - .board_name = &boardtypes[0].name, - .offset = sizeof(struct boardtype), + .num_names = ARRAY_SIZE(pci9118_boards), + .board_name = &pci9118_boards[0].name, + .offset = sizeof(struct pci9118_boardinfo), }; static int adl_pci9118_pci_probe(struct pci_dev *dev, -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 11/21] staging: comedi: adl_pci9118: refactor 'rangelist_ai' in boardinfo
The boards supported by this driver either have "normal" or "high gain" analog input ranges. For aesthetics, replace the 'rangelist_ai' member in the boardinfo with a bit-field flag 'is_hg' to indicate the "high gain" range is used. Refactor the subdevice init to use the flag to set the correct range_table. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 8653e42..f821427 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -197,7 +197,7 @@ #define PCI9118_HALF_FIFO_SZ (1024 / 2) -static const struct comedi_lrange range_pci9118dg_hr = { +static const struct comedi_lrange pci9118_ai_range = { 8, { BIP_RANGE(5), BIP_RANGE(2.5), @@ -210,7 +210,7 @@ static const struct comedi_lrange range_pci9118dg_hr = { } }; -static const struct comedi_lrange range_pci9118hg = { +static const struct comedi_lrange pci9118hg_ai_range = { 8, { BIP_RANGE(5), BIP_RANGE(0.5), @@ -232,7 +232,7 @@ struct boardtype { const char *name; /* board name */ int device_id; /* PCI device ID of card */ int ai_maxdata; /* resolution of A/D */ - const struct comedi_lrange *rangelist_ai; /* rangelist for A/D */ + unsigned int is_hg:1; }; static const struct boardtype boardtypes[] = { @@ -240,17 +240,15 @@ static const struct boardtype boardtypes[] = { .name = "pci9118dg", .device_id = 0x80d9, .ai_maxdata = 0x0fff, - .rangelist_ai = &range_pci9118dg_hr, }, { .name = "pci9118hg", .device_id = 0x80d9, .ai_maxdata = 0x0fff, - .rangelist_ai = &range_pci9118hg, + .is_hg = 1, }, { .name = "pci9118hr", .device_id = 0x80d9, .ai_maxdata = 0x, - .rangelist_ai = &range_pci9118dg_hr, }, }; @@ -1874,7 +1872,8 @@ static int pci9118_common_attach(struct comedi_device *dev, int disable_irq, s->n_chan = 16; s->maxdata = this_board->ai_maxdata; - s->range_table = this_board->rangelist_ai; + s->range_table = this_board->is_hg ? &pci9118hg_ai_range + : &pci9118_ai_range; s->insn_read = pci9118_insn_read_ai; if (dev->irq) { dev->read_subdev = s; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 08/21] staging: comedi: adl_pci9118: remove 'n_aichan' boardinfo
This member of the boardinfo is the same for all entries. Remove it. Also, remove the initialization of the subdevice 'len_chanlist'. This member is only used if the subdevice supports async commands. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 392afb5..3d25753 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -231,7 +231,6 @@ static const struct comedi_lrange range_pci9118hg = { struct boardtype { const char *name; /* board name */ int device_id; /* PCI device ID of card */ - int n_aichan; /* num of A/D chans */ int ai_maxdata; /* resolution of A/D */ const struct comedi_lrange *rangelist_ai; /* rangelist for A/D */ unsigned int ai_ns_min; /* max sample speed of card v ns */ @@ -245,7 +244,6 @@ static const struct boardtype boardtypes[] = { { .name = "pci9118dg", .device_id = 0x80d9, - .n_aichan = 16, .ai_maxdata = 0x0fff, .rangelist_ai = &range_pci9118dg_hr, .ai_ns_min = 3000, @@ -253,7 +251,6 @@ static const struct boardtype boardtypes[] = { }, { .name = "pci9118hg", .device_id = 0x80d9, - .n_aichan = 16, .ai_maxdata = 0x0fff, .rangelist_ai = &range_pci9118hg, .ai_ns_min = 3000, @@ -261,7 +258,6 @@ static const struct boardtype boardtypes[] = { }, { .name = "pci9118hr", .device_id = 0x80d9, - .n_aichan = 16, .ai_maxdata = 0x, .rangelist_ai = &range_pci9118dg_hr, .ai_ns_min = 1, @@ -1885,7 +1881,7 @@ static int pci9118_common_attach(struct comedi_device *dev, int disable_irq, if (devpriv->usemux) s->n_chan = devpriv->usemux; else - s->n_chan = this_board->n_aichan; + s->n_chan = 16; s->maxdata = this_board->ai_maxdata; s->range_table = this_board->rangelist_ai; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 12/21] staging: comedi: adl_pci9118: refactor 'ai_maxdata' in boardinfo
The boards supported by this driver either have 12-bit or 16-bit analog inputs. For aesthetics, replace the 'ai_maxdata' member in the boardinfo with a bit-field flag, 'ai_is_16bit', and refactor the subdevice init to use the new member. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index f821427..333c68f 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -231,7 +231,7 @@ static const struct comedi_lrange pci9118hg_ai_range = { struct boardtype { const char *name; /* board name */ int device_id; /* PCI device ID of card */ - int ai_maxdata; /* resolution of A/D */ + unsigned int ai_is_16bit:1; unsigned int is_hg:1; }; @@ -239,16 +239,14 @@ static const struct boardtype boardtypes[] = { { .name = "pci9118dg", .device_id = 0x80d9, - .ai_maxdata = 0x0fff, }, { .name = "pci9118hg", .device_id = 0x80d9, - .ai_maxdata = 0x0fff, .is_hg = 1, }, { .name = "pci9118hr", .device_id = 0x80d9, - .ai_maxdata = 0x, + .ai_is_16bit= 1, }, }; @@ -1871,7 +1869,7 @@ static int pci9118_common_attach(struct comedi_device *dev, int disable_irq, else s->n_chan = 16; - s->maxdata = this_board->ai_maxdata; + s->maxdata = this_board->ai_is_16bit ? 0x : 0x0fff; s->range_table = this_board->is_hg ? &pci9118hg_ai_range : &pci9118_ai_range; s->insn_read = pci9118_insn_read_ai; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 07/21] staging: comedi: adl_pci9118: remove 'n_aichand' boardinfo
This member of the boardinfo is the same for all entries. It's also half the subdevice 'n_chan'. Use that instead and remove the boardinfo. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index e4c52b4..392afb5 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -232,7 +232,6 @@ struct boardtype { const char *name; /* board name */ int device_id; /* PCI device ID of card */ int n_aichan; /* num of A/D chans */ - int n_aichand; /* num of A/D chans in diff mode */ int ai_maxdata; /* resolution of A/D */ const struct comedi_lrange *rangelist_ai; /* rangelist for A/D */ unsigned int ai_ns_min; /* max sample speed of card v ns */ @@ -247,7 +246,6 @@ static const struct boardtype boardtypes[] = { .name = "pci9118dg", .device_id = 0x80d9, .n_aichan = 16, - .n_aichand = 8, .ai_maxdata = 0x0fff, .rangelist_ai = &range_pci9118dg_hr, .ai_ns_min = 3000, @@ -256,7 +254,6 @@ static const struct boardtype boardtypes[] = { .name = "pci9118hg", .device_id = 0x80d9, .n_aichan = 16, - .n_aichand = 8, .ai_maxdata = 0x0fff, .rangelist_ai = &range_pci9118hg, .ai_ns_min = 3000, @@ -265,7 +262,6 @@ static const struct boardtype boardtypes[] = { .name = "pci9118hr", .device_id = 0x80d9, .n_aichan = 16, - .n_aichand = 8, .ai_maxdata = 0x, .rangelist_ai = &range_pci9118dg_hr, .ai_ns_min = 1, @@ -355,7 +351,6 @@ static int check_channel_list(struct comedi_device *dev, struct comedi_subdevice *s, int n_chan, unsigned int *chanlist, int frontadd, int backadd) { - const struct boardtype *this_board = comedi_board(dev); struct pci9118_private *devpriv = dev->private; unsigned int i, differencial = 0, bipolar = 0; @@ -389,7 +384,7 @@ static int check_channel_list(struct comedi_device *dev, return 0; } if (!devpriv->usemux && differencial && - (CR_CHAN(chanlist[i]) >= this_board->n_aichand)) { + (CR_CHAN(chanlist[i]) >= (s->n_chan / 2))) { dev_err(dev->class_dev, "AREF_DIFF is only available for the first 8 channels!\n"); return 0; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 19/21] staging: comedi: adl_pci9118: tidy up digital input subdevice init
For aesthetics, add some whitespace to the digital input subdevice init. Remove the SDF_GROUND and SDF_COMMON subdev_flags. These flags only apply to analog subdevices. Remove the 'len_chanlist' init, this subdevice member is only used with subdevices that support async commands. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index d7af6f7..f9598b0 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -1898,14 +1898,14 @@ static int pci9118_common_attach(struct comedi_device *dev, int disable_irq, s->insn_write = pci9118_insn_write_ao; s->insn_read = pci9118_insn_read_ao; + /* Digital Input subdevice */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_COMMON; - s->n_chan = 4; - s->maxdata = 1; - s->len_chanlist = 4; - s->range_table = &range_digital; - s->insn_bits = pci9118_insn_bits_di; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 4; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits= pci9118_insn_bits_di; /* Digital Output subdevice */ s = &dev->subdevices[3]; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 21/21] staging: comedi: adl_pci9118: tidy up analog input subdevice init
For aesthetics, add some whitespace to the analog input subdevice init. Tidy up the subdevice n_chan initialization. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 31 +--- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 2ff9bc7..225c046 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -1853,26 +1853,23 @@ static int pci9118_common_attach(struct comedi_device *dev, int disable_irq, if (ret) return ret; + /* Analog Input subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_GROUND | SDF_DIFF; - if (devpriv->usemux) - s->n_chan = devpriv->usemux; - else - s->n_chan = 16; - - s->maxdata = board->ai_is_16bit ? 0x : 0x0fff; - s->range_table = board->is_hg ? &pci9118hg_ai_range - : &pci9118_ai_range; - s->insn_read = pci9118_insn_read_ai; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_GROUND | SDF_DIFF; + s->n_chan = (devpriv->usemux) ? devpriv->usemux : 16; + s->maxdata = board->ai_is_16bit ? 0x : 0x0fff; + s->range_table = board->is_hg ? &pci9118hg_ai_range + : &pci9118_ai_range; + s->insn_read= pci9118_insn_read_ai; if (dev->irq) { dev->read_subdev = s; - s->subdev_flags |= SDF_CMD_READ; - s->len_chanlist = PCI9118_CHANLEN; - s->do_cmdtest = pci9118_ai_cmdtest; - s->do_cmd = pci9118_ai_cmd; - s->cancel = pci9118_ai_cancel; - s->munge = pci9118_ai_munge; + s->subdev_flags |= SDF_CMD_READ; + s->len_chanlist = PCI9118_CHANLEN; + s->do_cmdtest = pci9118_ai_cmdtest; + s->do_cmd = pci9118_ai_cmd; + s->cancel = pci9118_ai_cancel; + s->munge= pci9118_ai_munge; } if (s->maxdata == 0x) { -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 15/21] staging: comedi: adl_pci9118: remove unnecessary dev->board_name initialization
The (*auto_attach) in this driver will set the dev->board_name and the comedi core will set it when using the legacy (*attach). Remove the unnecessary initialization in pci9118_common_attach(). Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 6471f2c..c582301 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -1773,7 +1773,6 @@ static int pci9118_common_attach(struct comedi_device *dev, int disable_irq, int ret, pages, i; u16 u16w; - dev->board_name = this_board->name; ret = comedi_pci_enable(dev); if (ret) return ret; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] staging/lustre: Different prototypes between the declaration and the definition
Align the prototype of lprocfs_wr_uint() in the declaration with the one used in the definition. The prototype is: int lprocfs_wr_uint(struct file *file, const char __user *buffer, unsigned long count, void *data) In obdclass/lprocfs_status.c But in lustre/include/lprocfs_status.h, the __user annotation is missing for the attribute buffer. The correct prototype is the first one (the definition) since: - This function is eventually called by the write() function pointer of an instance of struct file_operations - In this function, buffer is a parameter of copy_from_user() - Before the commit 73bb1da692d0dc3e93b9c9e29084d6a5dcbc37a6, the declaration and the definition had the same prototype, but only the .c has been updated. Correcting this will remove a sparse error and add sparse warnings. This is a task of the Eudyptula challenge. Signed-off-by: Loïc Pellegrino --- My previous email was not formatted correctly sorry. drivers/staging/lustre/lustre/include/lprocfs_status.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h index 05b5285..ccb6cd4 100644 --- a/drivers/staging/lustre/lustre/include/lprocfs_status.h +++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h @@ -611,7 +611,7 @@ extern int lprocfs_rd_atomic(struct seq_file *m, void *data); extern int lprocfs_wr_atomic(struct file *file, const char __user *buffer, unsigned long count, void *data); extern int lprocfs_rd_uint(struct seq_file *m, void *data); -extern int lprocfs_wr_uint(struct file *file, const char *buffer, +extern int lprocfs_wr_uint(struct file *file, const char __user *buffer, unsigned long count, void *data); extern int lprocfs_rd_uuid(struct seq_file *m, void *data); extern int lprocfs_rd_name(struct seq_file *m, void *data); -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 01/19] staging: comedi: adl_pci9118: all registers are 32-bit
According to the PCI-9118 User's Manual, all registers are 32-bit. Fix a couple of read/write operations that use 16-bit access. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 225c046..0a59e3d 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -512,7 +512,7 @@ static int pci9118_insn_read_ai(struct comedi_device *dev, outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ for (n = 0; n < insn->n; n++) { - outw(0, dev->iobase + PCI9118_SOFTTRG); /* start conversion */ + outl(0, dev->iobase + PCI9118_SOFTTRG); /* start conversion */ udelay(2); ret = comedi_timeout(dev, s, insn, pci9118_ai_eoc, 0); @@ -527,7 +527,7 @@ static int pci9118_insn_read_ai(struct comedi_device *dev, PCI9118_AD_DATA) & 0x) ^ 0x8000; } else { data[n] = - (inw(dev->iobase + PCI9118_AD_DATA) >> 4) & 0xfff; + (inl(dev->iobase + PCI9118_AD_DATA) >> 4) & 0xfff; } } @@ -871,7 +871,7 @@ static void interrupt_pci9118_ai_onesample(struct comedi_device *dev, if (pci9118_decode_error_status(dev, s, int_adstat)) return; - sampl = inw(dev->iobase + PCI9118_AD_DATA); + sampl = inl(dev->iobase + PCI9118_AD_DATA); #ifdef PCI9118_PARANOIDCHECK if (s->maxdata != 0x) { @@ -999,7 +999,7 @@ static irqreturn_t pci9118_interrupt(int irq, void *d) outl(intcsr | 0x00ff, devpriv->iobase_a + AMCC_OP_REG_INTCSR); - adstat = inw(dev->iobase + PCI9118_ADSTAT) & 0x1ff; + adstat = inl(dev->iobase + PCI9118_ADSTAT) & 0x1ff; if (!devpriv->ai_do) return IRQ_HANDLED; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 00/19] staging: comedi: adl_pci9118: tidy up register map
Rename the register map defines and remove all the CamelCase. This series applies after: [PATCH 00/21] staging: comedi: adl_pci9118: cleanup the boardinfo and attach H Hartley Sweeten (19): staging: comedi: adl_pci9118: all registers are 32-bit staging: comedi: adl_pci9118: introduce pci9118_timer_write() staging: comedi: adl_pci9118: introduce pci9118_timer_set_mode() staging: comedi: adl_pci9118: tidy up analog input fifo register define staging: comedi: adl_pci9118: tidy up analog output register defines staging: comedi: adl_pci9118: rename PCI9118_ADSTAT define staging: comedi: adl_pci9118: tidy up the ai status register bit defines staging: comedi: adl_pci9118: rename PCI9118_ADCNTRL define staging: comedi: adl_pci9118: tidy up the ai control register bit defines staging: comedi: adl_pci9118: clarify the digital I/O register staging: comedi: adl_pci9118: introduce pci9118_ai_start_conv() staging: comedi: adl_pci9118: rename PCI9118_GAIN define staging: comedi: adl_pci9118: rename PCI9118_BURST define staging: comedi: adl_pci9118: rename PCI9118_SCANMOD define staging: comedi: adl_pci9118: rename PCI9118_ADFUNC define staging: comedi: adl_pci9118: tidy up the ai config register bit defines staging: comedi: adl_pci9118: introduce pci9118_ai_reset_fifo() staging: comedi: adl_pci9118: tidy up the interrupt control/status register staging: comedi: adl_pci9118: tidy up the interrupt control/status bit defines drivers/staging/comedi/drivers/adl_pci9118.c | 479 +-- 1 file changed, 236 insertions(+), 243 deletions(-) -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 10/19] staging: comedi: adl_pci9118: clarify the digital I/O register
The same register is used for both the digital inputs and outputs. Reading the register returns the state of the 4 digtial input channels and the 4 digital output channels. Writing to the register updates the digital outputs. Add some comments to clarify this and use a single define for the register. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 23 +-- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 4e08315..6fb46cb 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -129,9 +129,8 @@ #define PCI9118_AI_CTRL_TMRTR (1 << 2) /* 1=8254 is trigger source */ #define PCI9118_AI_CTRL_INT(1 << 1) /* 1=enable interrupt */ #define PCI9118_AI_CTRL_DMA(1 << 0) /* 1=enable DMA */ +#define PCI9118_DIO_REG0x1c -#define PCI9118_DI 0x1c/* R: digi input register */ -#define PCI9118_DO 0x1c/* W: digi output register */ #define PCI9118_SOFTTRG0x20/* W: soft trigger for A/D */ #define PCI9118_GAIN 0x24/* W: A/D gain/channel register */ #define PCI9118_BURST 0x28/* W: A/D burst number register */ @@ -565,9 +564,15 @@ static int pci9118_insn_read_ao(struct comedi_device *dev, static int pci9118_insn_bits_di(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) + struct comedi_insn *insn, + unsigned int *data) { - data[1] = inl(dev->iobase + PCI9118_DI) & 0xf; + /* +* The digital inputs and outputs share the read register. +* bits [7:4] are the digital outputs +* bits [3:0] are the digital inputs +*/ + data[1] = inl(dev->iobase + PCI9118_DIO_REG) & 0xf; return insn->n; } @@ -577,8 +582,14 @@ static int pci9118_insn_bits_do(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { + /* +* The digital outputs are set with the same register that +* the digital inputs and outputs are read from. But the +* outputs are set with bits [3:0] so we can simply write +* the s->state to set them. +*/ if (comedi_dio_update_state(s, data)) - outl(s->state & 0x0f, dev->iobase + PCI9118_DO); + outl(s->state, dev->iobase + PCI9118_DIO_REG); data[1] = s->state; @@ -1695,7 +1706,7 @@ static int pci9118_reset(struct comedi_device *dev) outl(devpriv->ao_data[0], dev->iobase + PCI9118_AO_REG(0)); outl(devpriv->ao_data[1], dev->iobase + PCI9118_AO_REG(1)); - outl(0, dev->iobase + PCI9118_DO); /* reset digi outs to L */ + outl(0, dev->iobase + PCI9118_DIO_REG); /* reset digi outs to L */ udelay(10); inl(dev->iobase + PCI9118_AI_FIFO_REG); outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 08/19] staging: comedi: adl_pci9118: rename PCI9118_ADCNTRL define
For aesthetics, rename this define used for the analog input control register. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 350df46..ad7aee0 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -120,8 +120,8 @@ #define PCI9118_AI_STATUS_ADOS (1 << 2) /* 1=A/D over speed (warn) */ #define PCI9118_AI_STATUS_ADOR (1 << 1) /* 1=A/D overrun (fatal) */ #define PCI9118_AI_STATUS_ADRDY(1 << 0) /* 1=A/D ready */ +#define PCI9118_AI_CTRL_REG0x18 -#define PCI9118_ADCNTRL0x18/* W: A/D control register */ #define PCI9118_DI 0x1c/* R: digi input register */ #define PCI9118_DO 0x1c/* W: digi output register */ #define PCI9118_SOFTTRG0x20/* W: soft trigger for A/D */ @@ -133,7 +133,7 @@ #define PCI9118_INTSRC 0x38/* R: interrupt reason register */ #define PCI9118_INTCTRL0x38/* W: interrupt control register */ -/* bits from A/D control register (PCI9118_ADCNTRL) */ +/* bits from A/D control register (PCI9118_AI_CTRL_REG) */ #define AdControl_UniP 0x80/* 1=bipolar, 0=unipolar */ #define AdControl_Diff 0x40/* 1=differential, 0= single end inputs */ #define AdControl_SoftG0x20/* 1=8254 counter works, 0=counter stops */ @@ -434,7 +434,7 @@ static int setup_channel_list(struct comedi_device *dev, /* set single ended inputs */ } - outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); + outl(devpriv->AdControlReg, dev->iobase + PCI9118_AI_CTRL_REG); /* setup mode */ outl(2, dev->iobase + PCI9118_SCANMOD); @@ -777,7 +777,7 @@ static int pci9118_ai_cancel(struct comedi_device *dev, * no about trigger, trigger stop */ devpriv->AdControlReg = 0x00; - outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); + outl(devpriv->AdControlReg, dev->iobase + PCI9118_AI_CTRL_REG); /* * bipolar, S.E., use 8254, stop 8354, * internal trigger, soft trigger, @@ -1018,7 +1018,7 @@ static irqreturn_t pci9118_interrupt(int irq, void *d) /* start pacer */ pci9118_start_pacer(dev, devpriv->ai_do); outl(devpriv->AdControlReg, -dev->iobase + PCI9118_ADCNTRL); +dev->iobase + PCI9118_AI_CTRL_REG); } else if (devpriv->ai12_startstop & STOP_AI_EXT) { /* deactivate EXT trigger */ devpriv->ai12_startstop &= ~STOP_AI_EXT; @@ -1057,7 +1057,7 @@ static int pci9118_ai_inttrig(struct comedi_device *dev, pci9118_start_pacer(dev, devpriv->ai_do); devpriv->AdControlReg |= AdControl_SoftG; } - outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); + outl(devpriv->AdControlReg, dev->iobase + PCI9118_AI_CTRL_REG); return 1; } @@ -1473,7 +1473,7 @@ static int pci9118_ai_docmd_dma(struct comedi_device *dev, pci9118_start_pacer(dev, devpriv->ai_do); devpriv->AdControlReg |= AdControl_SoftG; } - outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); + outl(devpriv->AdControlReg, dev->iobase + PCI9118_AI_CTRL_REG); } return 0; @@ -1648,7 +1648,7 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) * internal trigger, soft trigger, * disable DMA */ - outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); + outl(devpriv->AdControlReg, dev->iobase + PCI9118_AI_CTRL_REG); devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg; /* * positive triggers, no S&H, no burst, @@ -1687,7 +1687,7 @@ static int pci9118_reset(struct comedi_device *dev) pci9118_timer_set_mode(dev, 0, I8254_MODE0); pci9118_start_pacer(dev, 0);/* stop 8254 counters */ devpriv->AdControlReg = 0; - outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); + outl(devpriv->AdControlReg, dev->iobase + PCI9118_AI_CTRL_REG);
[PATCH 05/19] staging: comedi: adl_pci9118: tidy up analog output register defines
Replace the current defines with a macro that calculates the correct register offset based on the channel. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 24 +--- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 7c2385b..5c9bb73 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -109,9 +109,8 @@ #define PCI9118_TIMER_REG(x) (0x00 + ((x) * 4)) #define PCI9118_TIMER_CTRL_REG 0x0c #define PCI9118_AI_FIFO_REG0x10 +#define PCI9118_AO_REG(x) (0x10 + ((x) * 4)) -#define PCI9118_DA10x10/* W: D/A registers */ -#define PCI9118_DA20x14 #define PCI9118_ADSTAT 0x18/* R: A/D status register */ #define PCI9118_ADCNTRL0x18/* W: A/D control register */ #define PCI9118_DI 0x1c/* R: digi input register */ @@ -559,18 +558,12 @@ static int pci9118_insn_write_ao(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { struct pci9118_private *devpriv = dev->private; - int n, chanreg, ch; - - ch = CR_CHAN(insn->chanspec); - if (ch) - chanreg = PCI9118_DA2; - else - chanreg = PCI9118_DA1; - + unsigned int chan = CR_CHAN(insn->chanspec); + int n; for (n = 0; n < insn->n; n++) { - outl(data[n], dev->iobase + chanreg); - devpriv->ao_data[ch] = data[n]; + outl(data[n], dev->iobase + PCI9118_AO_REG(chan)); + devpriv->ao_data[chan] = data[n]; } return n; @@ -1717,11 +1710,12 @@ static int pci9118_reset(struct comedi_device *dev) * trigger stop */ + /* reset analog outputs to 0V */ devpriv->ao_data[0] = 2047; devpriv->ao_data[1] = 2047; - outl(devpriv->ao_data[0], dev->iobase + PCI9118_DA1); - /* reset A/D outs to 0V */ - outl(devpriv->ao_data[1], dev->iobase + PCI9118_DA2); + outl(devpriv->ao_data[0], dev->iobase + PCI9118_AO_REG(0)); + outl(devpriv->ao_data[1], dev->iobase + PCI9118_AO_REG(1)); + outl(0, dev->iobase + PCI9118_DO); /* reset digi outs to L */ udelay(10); inl(dev->iobase + PCI9118_AI_FIFO_REG); -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 02/19] staging: comedi: adl_pci9118: introduce pci9118_timer_write()
This driver uses 32-bit instructions to write the 8254 timers so we can't use the helper functions provided by 8253.h. To clarify the code introduce a helper function to write to the timers. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 34 ++-- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 0a59e3d..eb1bfcb 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -103,9 +103,11 @@ * but reality looks like 255 :-( */ -#define PCI9118_CNT0 0x00/* R/W: 8254 counter 0 */ -#define PCI9118_CNT1 0x04/* R/W: 8254 counter 0 */ -#define PCI9118_CNT2 0x08/* R/W: 8254 counter 0 */ +/* + * PCI BAR2 Register map (dev->iobase) + */ +#define PCI9118_TIMER_REG(x) (0x00 + ((x) * 4)) + #define PCI9118_CNTCTRL0x0c/* W: 8254 counter control */ #define PCI9118_AD_DATA0x10/* R: A/D data */ #define PCI9118_DA10x10/* W: D/A registers */ @@ -333,6 +335,13 @@ struct pci9118_private { unsigned int ai_ns_min; }; +static void pci9118_timer_write(struct comedi_device *dev, + unsigned int timer, unsigned int val) +{ + outl(val & 0xff, dev->iobase + PCI9118_TIMER_REG(timer)); + outl((val >> 8) & 0xff, dev->iobase + PCI9118_TIMER_REG(timer)); +} + static int check_channel_list(struct comedi_device *dev, struct comedi_subdevice *s, int n_chan, unsigned int *chanlist, int frontadd, int backadd) @@ -602,10 +611,8 @@ static void interrupt_pci9118_ai_mode4_switch(struct comedi_device *dev) AdFunction_PDTrg | AdFunction_PETrg | AdFunction_AM; outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); outl(0x30, dev->iobase + PCI9118_CNTCTRL); - outl((devpriv->dmabuf_hw[1 - devpriv->dma_actbuf] >> 1) & 0xff, -dev->iobase + PCI9118_CNT0); - outl((devpriv->dmabuf_hw[1 - devpriv->dma_actbuf] >> 9) & 0xff, -dev->iobase + PCI9118_CNT0); + pci9118_timer_write(dev, 0, + devpriv->dmabuf_hw[1 - devpriv->dma_actbuf] >> 1); devpriv->AdFunctionReg |= AdFunction_Start; outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); } @@ -740,8 +747,6 @@ static void pci9118_calc_divisors(char mode, struct comedi_device *dev, static void pci9118_start_pacer(struct comedi_device *dev, int mode) { struct pci9118_private *devpriv = dev->private; - unsigned int divisor1 = devpriv->ai_divisor1; - unsigned int divisor2 = devpriv->ai_divisor2; outl(0x74, dev->iobase + PCI9118_CNTCTRL); outl(0xb4, dev->iobase + PCI9118_CNTCTRL); @@ -749,10 +754,8 @@ static void pci9118_start_pacer(struct comedi_device *dev, int mode) udelay(1); if ((mode == 1) || (mode == 2) || (mode == 4)) { - outl(divisor2 & 0xff, dev->iobase + PCI9118_CNT2); - outl((divisor2 >> 8) & 0xff, dev->iobase + PCI9118_CNT2); - outl(divisor1 & 0xff, dev->iobase + PCI9118_CNT1); - outl((divisor1 >> 8) & 0xff, dev->iobase + PCI9118_CNT1); + pci9118_timer_write(dev, 2, devpriv->ai_divisor2); + pci9118_timer_write(dev, 1, devpriv->ai_divisor1); } } @@ -1448,10 +1451,7 @@ static int pci9118_ai_docmd_dma(struct comedi_device *dev, AdFunction_PDTrg | AdFunction_PETrg | AdFunction_AM; outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); outl(0x30, dev->iobase + PCI9118_CNTCTRL); - outl((devpriv->dmabuf_hw[0] >> 1) & 0xff, -dev->iobase + PCI9118_CNT0); - outl((devpriv->dmabuf_hw[0] >> 9) & 0xff, -dev->iobase + PCI9118_CNT0); + pci9118_timer_write(dev, 0, devpriv->dmabuf_hw[0] >> 1); devpriv->AdFunctionReg |= AdFunction_Start; break; default: -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 04/19] staging: comedi: adl_pci9118: tidy up analog input fifo register define
For aesthetics, rename the define used for the analog input fifo register and tidy up its use in the driver. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 20 +--- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index c1e6cce..7c2385b 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -108,8 +108,8 @@ */ #define PCI9118_TIMER_REG(x) (0x00 + ((x) * 4)) #define PCI9118_TIMER_CTRL_REG 0x0c +#define PCI9118_AI_FIFO_REG0x10 -#define PCI9118_AD_DATA0x10/* R: A/D data */ #define PCI9118_DA10x10/* W: D/A registers */ #define PCI9118_DA20x14 #define PCI9118_ADSTAT 0x18/* R: A/D status register */ @@ -512,6 +512,7 @@ static int pci9118_insn_read_ai(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { struct pci9118_private *devpriv = dev->private; + unsigned int val; int ret; int n; @@ -541,14 +542,11 @@ static int pci9118_insn_read_ai(struct comedi_device *dev, return ret; } - if (s->maxdata == 0x) { - data[n] = - (inl(dev->iobase + -PCI9118_AD_DATA) & 0x) ^ 0x8000; - } else { - data[n] = - (inl(dev->iobase + PCI9118_AD_DATA) >> 4) & 0xfff; - } + val = inl(dev->iobase + PCI9118_AI_FIFO_REG); + if (s->maxdata == 0x) + data[n] = (val & 0x) ^ 0x8000; + else + data[n] = (val >> 4) & 0xfff; } outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ @@ -884,7 +882,7 @@ static void interrupt_pci9118_ai_onesample(struct comedi_device *dev, if (pci9118_decode_error_status(dev, s, int_adstat)) return; - sampl = inl(dev->iobase + PCI9118_AD_DATA); + sampl = inl(dev->iobase + PCI9118_AI_FIFO_REG); #ifdef PCI9118_PARANOIDCHECK if (s->maxdata != 0x) { @@ -1726,7 +1724,7 @@ static int pci9118_reset(struct comedi_device *dev) outl(devpriv->ao_data[1], dev->iobase + PCI9118_DA2); outl(0, dev->iobase + PCI9118_DO); /* reset digi outs to L */ udelay(10); - inl(dev->iobase + PCI9118_AD_DATA); + inl(dev->iobase + PCI9118_AI_FIFO_REG); outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ outl(0, dev->iobase + PCI9118_INTSRC); /* remove INT requests */ inl(dev->iobase + PCI9118_ADSTAT); /* flush A/D status register */ -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 13/19] staging: comedi: adl_pci9118: rename PCI9118_BURST define
For aesthetics, rename this define used for the analog input burst number register. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 19a2353..d832cb3 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -132,8 +132,8 @@ #define PCI9118_DIO_REG0x1c #define PCI9118_SOFTTRG_REG0x20 #define PCI9118_AI_CHANLIST_REG0x24 +#define PCI9118_AI_BURST_NUM_REG 0x28 -#define PCI9118_BURST 0x28/* W: A/D burst number register */ #define PCI9118_SCANMOD0x2c/* W: A/D auto scan mode */ #define PCI9118_ADFUNC 0x30/* W: A/D function register */ #define PCI9118_DELFIFO0x34/* W: A/D data FIFO reset */ @@ -783,7 +783,7 @@ static int pci9118_ai_cancel(struct comedi_device *dev, * internal trigger, soft trigger, * disable INT and DMA */ - outl(0, dev->iobase + PCI9118_BURST); + outl(0, dev->iobase + PCI9118_AI_BURST_NUM_REG); outl(1, dev->iobase + PCI9118_SCANMOD); outl(2, dev->iobase + PCI9118_SCANMOD); /* reset scan queue */ outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ @@ -1436,7 +1436,8 @@ static int pci9118_ai_docmd_dma(struct comedi_device *dev, AdFunction_BS; if (cmd->convert_src == TRIG_NOW && !devpriv->softsshdelay) devpriv->AdFunctionReg |= AdFunction_BSSH; - outl(devpriv->ai_n_realscanlen, dev->iobase + PCI9118_BURST); + outl(devpriv->ai_n_realscanlen, +dev->iobase + PCI9118_AI_BURST_NUM_REG); break; case 3: devpriv->AdControlReg |= PCI9118_AI_CTRL_EXTM | @@ -1694,7 +1695,7 @@ static int pci9118_reset(struct comedi_device *dev) * soft trigger, * disable INT and DMA */ - outl(0, dev->iobase + PCI9118_BURST); + outl(0, dev->iobase + PCI9118_AI_BURST_NUM_REG); outl(1, dev->iobase + PCI9118_SCANMOD); outl(2, dev->iobase + PCI9118_SCANMOD); /* reset scan queue */ devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 07/19] staging: comedi: adl_pci9118: tidy up the ai status register bit defines
Rename the CamelCase defines used for the analog input status register bits and convert them to bit shifts. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 24 +++- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 484518c..350df46 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -111,6 +111,15 @@ #define PCI9118_AI_FIFO_REG0x10 #define PCI9118_AO_REG(x) (0x10 + ((x) * 4)) #define PCI9118_AI_STATUS_REG 0x18 +#define PCI9118_AI_STATUS_NFULL(1 << 8) /* 0=FIFO full (fatal) */ +#define PCI9118_AI_STATUS_NHFULL (1 << 7) /* 0=FIFO half full */ +#define PCI9118_AI_STATUS_NEPTY(1 << 6) /* 0=FIFO empty */ +#define PCI9118_AI_STATUS_ACMP (1 << 5) /* 1=about trigger complete */ +#define PCI9118_AI_STATUS_DTH (1 << 4) /* 1=ext. digital trigger */ +#define PCI9118_AI_STATUS_BOVER(1 << 3) /* 1=burst overrun (fatal) */ +#define PCI9118_AI_STATUS_ADOS (1 << 2) /* 1=A/D over speed (warn) */ +#define PCI9118_AI_STATUS_ADOR (1 << 1) /* 1=A/D overrun (fatal) */ +#define PCI9118_AI_STATUS_ADRDY(1 << 0) /* 1=A/D ready */ #define PCI9118_ADCNTRL0x18/* W: A/D control register */ #define PCI9118_DI 0x1c/* R: digi input register */ @@ -171,17 +180,6 @@ */ #define AdFunction_Start 0x01/* 1=trigger start, 0=trigger stop */ -/* bits from A/D status register (PCI9118_AI_STATUS_REG) */ -#define AdStatus_nFull 0x100 /* 0=FIFO full (fatal), 1=not full */ -#define AdStatus_nHfull0x080 /* 0=FIFO half full, 1=FIFO not half full */ -#define AdStatus_nEpty 0x040 /* 0=FIFO empty, 1=FIFO not empty */ -#define AdStatus_Acmp 0x020 /* */ -#define AdStatus_DTH 0x010 /* 1=external digital trigger */ -#define AdStatus_Bover 0x008 /* 1=burst mode overrun (fatal) */ -#define AdStatus_ADOS 0x004 /* 1=A/D over speed (warning) */ -#define AdStatus_ADOR 0x002 /* 1=A/D overrun (fatal) */ -#define AdStatus_ADrdy 0x001 /* 1=A/D already ready, 0=not ready */ - /* bits for interrupt reason and control (PCI9118_INTSRC, PCI9118_INTCTRL) */ /* 1=interrupt occur, enable source, 0=interrupt not occur, disable source */ #define Int_Timer 0x08/* timer interrupt */ @@ -501,7 +499,7 @@ static int pci9118_ai_eoc(struct comedi_device *dev, unsigned int status; status = inl(dev->iobase + PCI9118_AI_STATUS_REG); - if (status & AdStatus_ADrdy) + if (status & PCI9118_AI_STATUS_ADRDY) return 0; return -EBUSY; } @@ -1009,7 +1007,7 @@ static irqreturn_t pci9118_interrupt(int irq, void *d) return IRQ_HANDLED; if (devpriv->ai12_startstop) { - if ((adstat & AdStatus_DTH) && (intsrc & Int_DTrg)) { + if ((adstat & PCI9118_AI_STATUS_DTH) && (intsrc & Int_DTrg)) { /* start/stop of measure */ if (devpriv->ai12_startstop & START_AI_EXT) { /* deactivate EXT trigger */ -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 06/19] staging: comedi: adl_pci9118: rename PCI9118_ADSTAT define
For aesthetics, rename this define used for the analog input status register. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 5c9bb73..484518c 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -110,8 +110,8 @@ #define PCI9118_TIMER_CTRL_REG 0x0c #define PCI9118_AI_FIFO_REG0x10 #define PCI9118_AO_REG(x) (0x10 + ((x) * 4)) +#define PCI9118_AI_STATUS_REG 0x18 -#define PCI9118_ADSTAT 0x18/* R: A/D status register */ #define PCI9118_ADCNTRL0x18/* W: A/D control register */ #define PCI9118_DI 0x1c/* R: digi input register */ #define PCI9118_DO 0x1c/* W: digi output register */ @@ -171,7 +171,7 @@ */ #define AdFunction_Start 0x01/* 1=trigger start, 0=trigger stop */ -/* bits from A/D status register (PCI9118_ADSTAT) */ +/* bits from A/D status register (PCI9118_AI_STATUS_REG) */ #define AdStatus_nFull 0x100 /* 0=FIFO full (fatal), 1=not full */ #define AdStatus_nHfull0x080 /* 0=FIFO half full, 1=FIFO not half full */ #define AdStatus_nEpty 0x040 /* 0=FIFO empty, 1=FIFO not empty */ @@ -500,7 +500,7 @@ static int pci9118_ai_eoc(struct comedi_device *dev, { unsigned int status; - status = inl(dev->iobase + PCI9118_ADSTAT); + status = inl(dev->iobase + PCI9118_AI_STATUS_REG); if (status & AdStatus_ADrdy) return 0; return -EBUSY; @@ -1003,7 +1003,7 @@ static irqreturn_t pci9118_interrupt(int irq, void *d) outl(intcsr | 0x00ff, devpriv->iobase_a + AMCC_OP_REG_INTCSR); - adstat = inl(dev->iobase + PCI9118_ADSTAT) & 0x1ff; + adstat = inl(dev->iobase + PCI9118_AI_STATUS_REG) & 0x1ff; if (!devpriv->ai_do) return IRQ_HANDLED; @@ -1660,10 +1660,9 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); udelay(1); outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ - inl(dev->iobase + PCI9118_ADSTAT); /* -* flush A/D and INT -* status register -*/ + + /* clear A/D and INT status registers */ + inl(dev->iobase + PCI9118_AI_STATUS_REG); inl(dev->iobase + PCI9118_INTSRC); devpriv->ai_act_scan = 0; @@ -1721,8 +1720,9 @@ static int pci9118_reset(struct comedi_device *dev) inl(dev->iobase + PCI9118_AI_FIFO_REG); outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ outl(0, dev->iobase + PCI9118_INTSRC); /* remove INT requests */ - inl(dev->iobase + PCI9118_ADSTAT); /* flush A/D status register */ - inl(dev->iobase + PCI9118_INTSRC); /* flush INT requests */ + /* clear A/D and INT status registers */ + inl(dev->iobase + PCI9118_AI_STATUS_REG); + inl(dev->iobase + PCI9118_INTSRC); devpriv->AdControlReg = 0; outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); /* -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 16/19] staging: comedi: adl_pci9118: tidy up the ai config register bit defines
Rename the CamelCase defines used for the analog input config register bits and convert them to bit shifts. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 68 +++- 1 file changed, 26 insertions(+), 42 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 308a793..dfac797 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -135,38 +135,19 @@ #define PCI9118_AI_BURST_NUM_REG 0x28 #define PCI9118_AI_AUTOSCAN_MODE_REG 0x2c #define PCI9118_AI_CFG_REG 0x30 +#define PCI9118_AI_CFG_PDTRG (1 << 7) /* 1=positive trigger */ +#define PCI9118_AI_CFG_PETRG (1 << 6) /* 1=positive ext. trigger */ +#define PCI9118_AI_CFG_BSSH(1 << 5) /* 1=with sample & hold */ +#define PCI9118_AI_CFG_BM (1 << 4) /* 1=burst mode */ +#define PCI9118_AI_CFG_BS (1 << 3) /* 1=burst mode start */ +#define PCI9118_AI_CFG_PM (1 << 2) /* 1=post trigger */ +#define PCI9118_AI_CFG_AM (1 << 1) /* 1=about trigger */ +#define PCI9118_AI_CFG_START (1 << 0) /* 1=trigger start */ #define PCI9118_DELFIFO0x34/* W: A/D data FIFO reset */ #define PCI9118_INTSRC 0x38/* R: interrupt reason register */ #define PCI9118_INTCTRL0x38/* W: interrupt control register */ -/* bits from A/D function register (PCI9118_AI_CFG_REG) */ -#define AdFunction_PDTrg 0x80/* -* 1=positive, -* 0=negative digital trigger -* (only positive is correct) -*/ -#define AdFunction_PETrg 0x40/* -* 1=positive, -* 0=negative external trigger -* (only positive is correct) -*/ -#define AdFunction_BSSH0x20/* 1=with sample&hold, 0=without */ -#define AdFunction_BM 0x10/* 1=burst mode, 0=normal mode */ -#define AdFunction_BS 0x08/* -* 1=burst mode start, -* 0=burst mode stop -*/ -#define AdFunction_PM 0x04/* -* 1=post trigger mode, -* 0=not post trigger -*/ -#define AdFunction_AM 0x02/* -* 1=about trigger mode, -* 0=not about trigger -*/ -#define AdFunction_Start 0x01/* 1=trigger start, 0=trigger stop */ - /* bits for interrupt reason and control (PCI9118_INTSRC, PCI9118_INTCTRL) */ /* 1=interrupt occur, enable source, 0=interrupt not occur, disable source */ #define Int_Timer 0x08/* timer interrupt */ @@ -503,7 +484,7 @@ static int pci9118_insn_read_ai(struct comedi_device *dev, int n; devpriv->AdControlReg = PCI9118_AI_CTRL_INT; - devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg; + devpriv->AdFunctionReg = PCI9118_AI_CFG_PDTRG | PCI9118_AI_CFG_PETRG; outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_AI_CFG_REG); /* * positive triggers, no S&H, @@ -607,13 +588,13 @@ static void interrupt_pci9118_ai_mode4_switch(struct comedi_device *dev) { struct pci9118_private *devpriv = dev->private; - devpriv->AdFunctionReg = - AdFunction_PDTrg | AdFunction_PETrg | AdFunction_AM; + devpriv->AdFunctionReg = PCI9118_AI_CFG_PDTRG | PCI9118_AI_CFG_PETRG | +PCI9118_AI_CFG_AM; outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_AI_CFG_REG); pci9118_timer_set_mode(dev, 0, I8254_MODE0); pci9118_timer_write(dev, 0, devpriv->dmabuf_hw[1 - devpriv->dma_actbuf] >> 1); - devpriv->AdFunctionReg |= AdFunction_Start; + devpriv->AdFunctionReg |= PCI9118_AI_CFG_START; outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_AI_CFG_REG); } @@ -769,7 +750,7 @@ static int pci9118_ai_cancel(struct comedi_device *dev, devpriv->iobase_a + AMCC_OP_REG_MCSR); /* stop DMA */ pci9118_exttrg_del(dev, EXTTRG_AI); pci9118_start_pacer(dev, 0);/* stop 8254 counters */ - devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg; + devpriv->AdFunctionReg = PCI9118_AI_CFG_PDTRG | PCI9118_AI_CFG_PETRG; outl(devpriv->AdFunctionReg
[PATCH 03/19] staging: comedi: adl_pci9118: introduce pci9118_timer_set_mode()
This driver uses 32-bit instructions to write the 8254 timers so we can't use the helper functions provided by 8253.h. To clarify the code introduce a helper function to set the timer mode. Remove the unnecessary commented out timer mode programming. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 25 + 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index eb1bfcb..c1e6cce 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -107,8 +107,8 @@ * PCI BAR2 Register map (dev->iobase) */ #define PCI9118_TIMER_REG(x) (0x00 + ((x) * 4)) +#define PCI9118_TIMER_CTRL_REG 0x0c -#define PCI9118_CNTCTRL0x0c/* W: 8254 counter control */ #define PCI9118_AD_DATA0x10/* R: A/D data */ #define PCI9118_DA10x10/* W: D/A registers */ #define PCI9118_DA20x14 @@ -342,6 +342,17 @@ static void pci9118_timer_write(struct comedi_device *dev, outl((val >> 8) & 0xff, dev->iobase + PCI9118_TIMER_REG(timer)); } +static void pci9118_timer_set_mode(struct comedi_device *dev, + unsigned int timer, unsigned int mode) +{ + unsigned int val; + + val = timer << 6; /* select timer */ + val |= 0x30;/* load low then high byte */ + val |= mode;/* set timer mode and BCD|binary */ + outl(val, dev->iobase + PCI9118_TIMER_CTRL_REG); +} + static int check_channel_list(struct comedi_device *dev, struct comedi_subdevice *s, int n_chan, unsigned int *chanlist, int frontadd, int backadd) @@ -610,7 +621,7 @@ static void interrupt_pci9118_ai_mode4_switch(struct comedi_device *dev) devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg | AdFunction_AM; outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); - outl(0x30, dev->iobase + PCI9118_CNTCTRL); + pci9118_timer_set_mode(dev, 0, I8254_MODE0); pci9118_timer_write(dev, 0, devpriv->dmabuf_hw[1 - devpriv->dma_actbuf] >> 1); devpriv->AdFunctionReg |= AdFunction_Start; @@ -748,9 +759,8 @@ static void pci9118_start_pacer(struct comedi_device *dev, int mode) { struct pci9118_private *devpriv = dev->private; - outl(0x74, dev->iobase + PCI9118_CNTCTRL); - outl(0xb4, dev->iobase + PCI9118_CNTCTRL); -/* outl(0x30, dev->iobase + PCI9118_CNTCTRL); */ + pci9118_timer_set_mode(dev, 1, I8254_MODE2); + pci9118_timer_set_mode(dev, 2, I8254_MODE2); udelay(1); if ((mode == 1) || (mode == 2) || (mode == 4)) { @@ -1450,7 +1460,7 @@ static int pci9118_ai_docmd_dma(struct comedi_device *dev, devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg | AdFunction_AM; outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); - outl(0x30, dev->iobase + PCI9118_CNTCTRL); + pci9118_timer_set_mode(dev, 0, I8254_MODE0); pci9118_timer_write(dev, 0, devpriv->dmabuf_hw[0] >> 1); devpriv->AdFunctionReg |= AdFunction_Start; break; @@ -1686,8 +1696,7 @@ static int pci9118_reset(struct comedi_device *dev) inl(dev->iobase + PCI9118_INTCTRL); outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL); /* disable interrupts source */ - outl(0x30, dev->iobase + PCI9118_CNTCTRL); -/* outl(0xb4, dev->iobase + PCI9118_CNTCTRL); */ + pci9118_timer_set_mode(dev, 0, I8254_MODE0); pci9118_start_pacer(dev, 0);/* stop 8254 counters */ devpriv->AdControlReg = 0; outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 12/19] staging: comedi: adl_pci9118: rename PCI9118_GAIN define
For aesthetics, rename this define used for the analog input chanlist programming register. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 5eca67f..19a2353 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -131,8 +131,8 @@ #define PCI9118_AI_CTRL_DMA(1 << 0) /* 1=enable DMA */ #define PCI9118_DIO_REG0x1c #define PCI9118_SOFTTRG_REG0x20 +#define PCI9118_AI_CHANLIST_REG0x24 -#define PCI9118_GAIN 0x24/* W: A/D gain/channel register */ #define PCI9118_BURST 0x28/* W: A/D burst number register */ #define PCI9118_SCANMOD0x2c/* W: A/D auto scan mode */ #define PCI9118_ADFUNC 0x30/* W: A/D function register */ @@ -438,7 +438,8 @@ static int setup_channel_list(struct comedi_device *dev, gain = CR_RANGE(chanlist[0]); /* get gain number */ scanquad |= ((gain & 0x03) << 8); - outl(scanquad | ssh, dev->iobase + PCI9118_GAIN); + outl(scanquad | ssh, +dev->iobase + PCI9118_AI_CHANLIST_REG); ssh = devpriv->softsshhold; } } @@ -450,7 +451,7 @@ static int setup_channel_list(struct comedi_device *dev, #endif gain = CR_RANGE(chanlist[i]); /* get gain number */ scanquad |= ((gain & 0x03) << 8); - outl(scanquad | ssh, dev->iobase + PCI9118_GAIN); + outl(scanquad | ssh, dev->iobase + PCI9118_AI_CHANLIST_REG); } if (backadd) { /* insert channels for fit onto 32bit DMA */ @@ -459,7 +460,8 @@ static int setup_channel_list(struct comedi_device *dev, /* get channel number */ gain = CR_RANGE(chanlist[0]); /* get gain number */ scanquad |= ((gain & 0x03) << 8); - outl(scanquad | ssh, dev->iobase + PCI9118_GAIN); + outl(scanquad | ssh, +dev->iobase + PCI9118_AI_CHANLIST_REG); } } #ifdef PCI9118_PARANOIDCHECK -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 09/19] staging: comedi: adl_pci9118: tidy up the ai control register bit defines
Rename the CamelCase defines used for the analog input control register bits and convert them to bit shifts. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 80 +++- 1 file changed, 31 insertions(+), 49 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index ad7aee0..4e08315 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -121,6 +121,14 @@ #define PCI9118_AI_STATUS_ADOR (1 << 1) /* 1=A/D overrun (fatal) */ #define PCI9118_AI_STATUS_ADRDY(1 << 0) /* 1=A/D ready */ #define PCI9118_AI_CTRL_REG0x18 +#define PCI9118_AI_CTRL_UNIP (1 << 7) /* 1=unipolar */ +#define PCI9118_AI_CTRL_DIFF (1 << 6) /* 1=differential inputs */ +#define PCI9118_AI_CTRL_SOFTG (1 << 5) /* 1=8254 software gate */ +#define PCI9118_AI_CTRL_EXTG (1 << 4) /* 1=8254 TGIN(pin 46) gate */ +#define PCI9118_AI_CTRL_EXTM (1 << 3) /* 1=ext. trigger (pin 44) */ +#define PCI9118_AI_CTRL_TMRTR (1 << 2) /* 1=8254 is trigger source */ +#define PCI9118_AI_CTRL_INT(1 << 1) /* 1=enable interrupt */ +#define PCI9118_AI_CTRL_DMA(1 << 0) /* 1=enable DMA */ #define PCI9118_DI 0x1c/* R: digi input register */ #define PCI9118_DO 0x1c/* W: digi output register */ @@ -133,26 +141,6 @@ #define PCI9118_INTSRC 0x38/* R: interrupt reason register */ #define PCI9118_INTCTRL0x38/* W: interrupt control register */ -/* bits from A/D control register (PCI9118_AI_CTRL_REG) */ -#define AdControl_UniP 0x80/* 1=bipolar, 0=unipolar */ -#define AdControl_Diff 0x40/* 1=differential, 0= single end inputs */ -#define AdControl_SoftG0x20/* 1=8254 counter works, 0=counter stops */ -#defineAdControl_ExtG 0x10/* -* 1=8254 countrol controlled by TGIN(pin 46), -* 0=controlled by SoftG -*/ -#define AdControl_ExtM 0x08/* -* 1=external hardware trigger (pin 44), -* 0=internal trigger -*/ -#define AdControl_TmrTr0x04/* -* 1=8254 is iternal trigger source, -* 0=software trigger is source -* (register PCI9118_SOFTTRG) -*/ -#define AdControl_Int 0x02/* 1=enable INT, 0=disable */ -#define AdControl_Dma 0x01/* 1=enable DMA, 0=disable */ - /* bits from A/D function register (PCI9118_ADFUNC) */ #define AdFunction_PDTrg 0x80/* * 1=positive, @@ -418,21 +406,15 @@ static int setup_channel_list(struct comedi_device *dev, /* All is ok, so we can setup channel/range list */ - if (!bipolar) { - devpriv->AdControlReg |= AdControl_UniP; - /* set unibipolar */ - } else { - devpriv->AdControlReg &= ((~AdControl_UniP) & 0xff); - /* enable bipolar */ - } + if (!bipolar) + devpriv->AdControlReg |= PCI9118_AI_CTRL_UNIP; + else + devpriv->AdControlReg &= ~PCI9118_AI_CTRL_UNIP; - if (differencial) { - devpriv->AdControlReg |= AdControl_Diff; - /* enable diff inputs */ - } else { - devpriv->AdControlReg &= ((~AdControl_Diff) & 0xff); - /* set single ended inputs */ - } + if (differencial) + devpriv->AdControlReg |= PCI9118_AI_CTRL_DIFF; + else + devpriv->AdControlReg &= ~PCI9118_AI_CTRL_DIFF; outl(devpriv->AdControlReg, dev->iobase + PCI9118_AI_CTRL_REG); /* setup mode */ @@ -513,7 +495,7 @@ static int pci9118_insn_read_ai(struct comedi_device *dev, int ret; int n; - devpriv->AdControlReg = AdControl_Int & 0xff; + devpriv->AdControlReg = PCI9118_AI_CTRL_INT; devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg; outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); /* @@ -1055,7 +1037,7 @@ static int pci9118_ai_inttrig(struct comedi_device *dev, outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); if (devpriv->ai_do != 3) { pci9118_start_pacer(dev, devpriv->ai_do); - devpriv->AdControlReg |= AdControl_SoftG; + devpriv->AdControlReg |= PCI9118_AI_CTRL_SOFT
[PATCH 14/19] staging: comedi: adl_pci9118: rename PCI9118_SCANMOD define
For aesthetics, rename this define used for the analog input auto scan mode register. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 24 +--- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index d832cb3..68cecb5 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -133,8 +133,8 @@ #define PCI9118_SOFTTRG_REG0x20 #define PCI9118_AI_CHANLIST_REG0x24 #define PCI9118_AI_BURST_NUM_REG 0x28 +#define PCI9118_AI_AUTOSCAN_MODE_REG 0x2c -#define PCI9118_SCANMOD0x2c/* W: A/D auto scan mode */ #define PCI9118_ADFUNC 0x30/* W: A/D function register */ #define PCI9118_DELFIFO0x34/* W: A/D data FIFO reset */ #define PCI9118_INTSRC 0x38/* R: interrupt reason register */ @@ -417,11 +417,10 @@ static int setup_channel_list(struct comedi_device *dev, outl(devpriv->AdControlReg, dev->iobase + PCI9118_AI_CTRL_REG); /* setup mode */ - - outl(2, dev->iobase + PCI9118_SCANMOD); - /* gods know why this sequence! */ - outl(0, dev->iobase + PCI9118_SCANMOD); - outl(1, dev->iobase + PCI9118_SCANMOD); + /* gods know why this sequence! */ + outl(2, dev->iobase + PCI9118_AI_AUTOSCAN_MODE_REG); + outl(0, dev->iobase + PCI9118_AI_AUTOSCAN_MODE_REG); + outl(1, dev->iobase + PCI9118_AI_AUTOSCAN_MODE_REG); #ifdef PCI9118_PARANOIDCHECK devpriv->chanlistlen = n_chan; @@ -468,7 +467,8 @@ static int setup_channel_list(struct comedi_device *dev, devpriv->chanlist[n_chan ^ usedma] = devpriv->chanlist[0 ^ usedma]; /* for 32bit operations */ #endif - outl(0, dev->iobase + PCI9118_SCANMOD); /* close scan queue */ + /* close scan queue */ + outl(0, dev->iobase + PCI9118_AI_AUTOSCAN_MODE_REG); /* udelay(100); important delay, or first sample will be crippled */ return 1; /* we can serve this with scan logic */ @@ -784,8 +784,9 @@ static int pci9118_ai_cancel(struct comedi_device *dev, * disable INT and DMA */ outl(0, dev->iobase + PCI9118_AI_BURST_NUM_REG); - outl(1, dev->iobase + PCI9118_SCANMOD); - outl(2, dev->iobase + PCI9118_SCANMOD); /* reset scan queue */ + /* reset scan queue */ + outl(1, dev->iobase + PCI9118_AI_AUTOSCAN_MODE_REG); + outl(2, dev->iobase + PCI9118_AI_AUTOSCAN_MODE_REG); outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ devpriv->ai_do = 0; @@ -1696,8 +1697,9 @@ static int pci9118_reset(struct comedi_device *dev) * disable INT and DMA */ outl(0, dev->iobase + PCI9118_AI_BURST_NUM_REG); - outl(1, dev->iobase + PCI9118_SCANMOD); - outl(2, dev->iobase + PCI9118_SCANMOD); /* reset scan queue */ + /* reset scan queue */ + outl(1, dev->iobase + PCI9118_AI_AUTOSCAN_MODE_REG); + outl(2, dev->iobase + PCI9118_AI_AUTOSCAN_MODE_REG); devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg; outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); /* -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 11/19] staging: comedi: adl_pci9118: introduce pci9118_ai_start_conv()
Writing any value to the "software trigger" register generates a trigger pulse to start an A/D conversion. Introduce a helper function to clarify this. For aesthetics, rename the define used for the register. According to the datasheet the extra delay is not needed after starting the conversion. Remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 6fb46cb..5eca67f 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -130,8 +130,8 @@ #define PCI9118_AI_CTRL_INT(1 << 1) /* 1=enable interrupt */ #define PCI9118_AI_CTRL_DMA(1 << 0) /* 1=enable DMA */ #define PCI9118_DIO_REG0x1c +#define PCI9118_SOFTTRG_REG0x20 -#define PCI9118_SOFTTRG0x20/* W: soft trigger for A/D */ #define PCI9118_GAIN 0x24/* W: A/D gain/channel register */ #define PCI9118_BURST 0x28/* W: A/D burst number register */ #define PCI9118_SCANMOD0x2c/* W: A/D auto scan mode */ @@ -485,6 +485,12 @@ static int pci9118_ai_eoc(struct comedi_device *dev, return -EBUSY; } +static void pci9118_ai_start_conv(struct comedi_device *dev) +{ + /* writing any value triggers an A/D conversion */ + outl(0, dev->iobase + PCI9118_SOFTTRG_REG); +} + static int pci9118_insn_read_ai(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) @@ -511,8 +517,7 @@ static int pci9118_insn_read_ai(struct comedi_device *dev, outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ for (n = 0; n < insn->n; n++) { - outl(0, dev->iobase + PCI9118_SOFTTRG); /* start conversion */ - udelay(2); + pci9118_ai_start_conv(dev); ret = comedi_timeout(dev, s, insn, pci9118_ai_eoc, 0); if (ret) { -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 18/19] staging: comedi: adl_pci9118: tidy up the interrupt control/status register
The register at offset 0x38 is the "interrupt control" register when written and the "interrupt status" register when read. Both registers use the same bit defines. For aesthetics, use a common define for this register. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 37 +++- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 266eb3f..dd7faed 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -144,11 +144,9 @@ #define PCI9118_AI_CFG_AM (1 << 1) /* 1=about trigger */ #define PCI9118_AI_CFG_START (1 << 0) /* 1=trigger start */ #define PCI9118_FIFO_RESET_REG 0x34 +#define PCI9118_INT_CTRL_REG 0x38 -#define PCI9118_INTSRC 0x38/* R: interrupt reason register */ -#define PCI9118_INTCTRL0x38/* W: interrupt control register */ - -/* bits for interrupt reason and control (PCI9118_INTSRC, PCI9118_INTCTRL) */ +/* bits for interrupt reason and control (PCI9118_INT_CTRL_REG) */ /* 1=interrupt occur, enable source, 0=interrupt not occur, disable source */ #define Int_Timer 0x08/* timer interrupt */ #define Int_About 0x04/* about trigger complete */ @@ -659,7 +657,7 @@ static int pci9118_exttrg_add(struct comedi_device *dev, unsigned char source) return -1; /* incorrect source */ devpriv->exttrg_users |= (1 << source); devpriv->IntControlReg |= Int_DTrg; - outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL); + outl(devpriv->IntControlReg, dev->iobase + PCI9118_INT_CTRL_REG); outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | 0x1f00, devpriv->iobase_a + AMCC_OP_REG_INTCSR); /* allow INT in AMCC */ @@ -680,7 +678,8 @@ static int pci9118_exttrg_del(struct comedi_device *dev, unsigned char source) (~0x1f00), devpriv->iobase_a + AMCC_OP_REG_INTCSR); /* disable int in AMCC */ - outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL); + outl(devpriv->IntControlReg, +dev->iobase + PCI9118_INT_CTRL_REG); } return 0; } @@ -981,7 +980,7 @@ static irqreturn_t pci9118_interrupt(int irq, void *d) if (!dev->attached) return IRQ_NONE; - intsrc = inl(dev->iobase + PCI9118_INTSRC) & 0xf; + intsrc = inl(dev->iobase + PCI9118_INT_CTRL_REG) & 0xf; intcsr = inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR); if (!intsrc && !(intcsr & ANY_S593X_INT)) @@ -1039,7 +1038,7 @@ static int pci9118_ai_inttrig(struct comedi_device *dev, devpriv->ai12_startstop &= ~START_AI_INT; s->async->inttrig = NULL; - outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL); + outl(devpriv->IntControlReg, dev->iobase + PCI9118_INT_CTRL_REG); outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_AI_CFG_REG); if (devpriv->ai_do != 3) { pci9118_start_pacer(dev, devpriv->ai_do); @@ -1391,13 +1390,15 @@ static int pci9118_ai_docmd_sampl(struct comedi_device *dev, /* allow INT in AMCC */ if (!(devpriv->ai12_startstop & (START_AI_EXT | START_AI_INT))) { - outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL); + outl(devpriv->IntControlReg, +dev->iobase + PCI9118_INT_CTRL_REG); outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_AI_CFG_REG); if (devpriv->ai_do != 3) { pci9118_start_pacer(dev, devpriv->ai_do); devpriv->AdControlReg |= PCI9118_AI_CTRL_SOFTG; } - outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL); + outl(devpriv->IntControlReg, +dev->iobase + PCI9118_INT_CTRL_REG); } return 0; @@ -1460,7 +1461,8 @@ static int pci9118_ai_docmd_dma(struct comedi_device *dev, if (!(devpriv->ai12_startstop & (START_AI_EXT | START_AI_INT))) { outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_AI_CFG_REG); - outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL); + outl(devpriv->IntControlReg, +dev->iobase + PCI9118_INT_CTRL_REG); if (devpriv->ai_do != 3) { pci9118_start_pacer(dev, devpriv->ai_do); devpriv->AdControlReg |= PCI9118_AI_CTRL_SOFTG; @@ -1653,7 +1655,7 @@ static int pci9118_ai_cmd(struct comedi_
[PATCH 15/19] staging: comedi: adl_pci9118: rename PCI9118_ADFUNC define
For aesthetics, rename this define used for the analog input function config register. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 68cecb5..308a793 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -134,13 +134,13 @@ #define PCI9118_AI_CHANLIST_REG0x24 #define PCI9118_AI_BURST_NUM_REG 0x28 #define PCI9118_AI_AUTOSCAN_MODE_REG 0x2c +#define PCI9118_AI_CFG_REG 0x30 -#define PCI9118_ADFUNC 0x30/* W: A/D function register */ #define PCI9118_DELFIFO0x34/* W: A/D data FIFO reset */ #define PCI9118_INTSRC 0x38/* R: interrupt reason register */ #define PCI9118_INTCTRL0x38/* W: interrupt control register */ -/* bits from A/D function register (PCI9118_ADFUNC) */ +/* bits from A/D function register (PCI9118_AI_CFG_REG) */ #define AdFunction_PDTrg 0x80/* * 1=positive, * 0=negative digital trigger @@ -504,7 +504,7 @@ static int pci9118_insn_read_ai(struct comedi_device *dev, devpriv->AdControlReg = PCI9118_AI_CTRL_INT; devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg; - outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); + outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_AI_CFG_REG); /* * positive triggers, no S&H, * no burst, burst stop, @@ -609,12 +609,12 @@ static void interrupt_pci9118_ai_mode4_switch(struct comedi_device *dev) devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg | AdFunction_AM; - outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); + outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_AI_CFG_REG); pci9118_timer_set_mode(dev, 0, I8254_MODE0); pci9118_timer_write(dev, 0, devpriv->dmabuf_hw[1 - devpriv->dma_actbuf] >> 1); devpriv->AdFunctionReg |= AdFunction_Start; - outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); + outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_AI_CFG_REG); } static unsigned int defragment_dma_buffer(struct comedi_device *dev, @@ -770,7 +770,7 @@ static int pci9118_ai_cancel(struct comedi_device *dev, pci9118_exttrg_del(dev, EXTTRG_AI); pci9118_start_pacer(dev, 0);/* stop 8254 counters */ devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg; - outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); + outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_AI_CFG_REG); /* * positive triggers, no S&H, no burst, * burst stop, no post trigger, @@ -1053,7 +1053,7 @@ static int pci9118_ai_inttrig(struct comedi_device *dev, s->async->inttrig = NULL; outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL); - outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); + outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_AI_CFG_REG); if (devpriv->ai_do != 3) { pci9118_start_pacer(dev, devpriv->ai_do); devpriv->AdControlReg |= PCI9118_AI_CTRL_SOFTG; @@ -1405,7 +1405,7 @@ static int pci9118_ai_docmd_sampl(struct comedi_device *dev, if (!(devpriv->ai12_startstop & (START_AI_EXT | START_AI_INT))) { outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL); - outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); + outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_AI_CFG_REG); if (devpriv->ai_do != 3) { pci9118_start_pacer(dev, devpriv->ai_do); devpriv->AdControlReg |= PCI9118_AI_CTRL_SOFTG; @@ -1450,7 +1450,7 @@ static int pci9118_ai_docmd_dma(struct comedi_device *dev, PCI9118_AI_CTRL_DMA; devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg | AdFunction_AM; - outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); + outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_AI_CFG_REG); pci9118_timer_set_mode(dev, 0, I8254_MODE0); pci9118_timer_write(dev, 0, devpriv->dmabuf_hw[0] >> 1); devpriv->AdFunctionReg |= AdFunction_Start; @@ -1469,7 +1469,7 @@ static int pci9118_ai_docmd_dma(struct comedi_device *dev, devpriv->iobase_a + AMC
[PATCH 19/19] staging: comedi: adl_pci9118: tidy up the interrupt control/status bit defines
Rename the CamelCase defines used for the interrupt control/status register bits and convert them to bit shifts. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 20 +--- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index dd7faed..03ca818 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -145,13 +145,10 @@ #define PCI9118_AI_CFG_START (1 << 0) /* 1=trigger start */ #define PCI9118_FIFO_RESET_REG 0x34 #define PCI9118_INT_CTRL_REG 0x38 - -/* bits for interrupt reason and control (PCI9118_INT_CTRL_REG) */ -/* 1=interrupt occur, enable source, 0=interrupt not occur, disable source */ -#define Int_Timer 0x08/* timer interrupt */ -#define Int_About 0x04/* about trigger complete */ -#define Int_Hfull 0x02/* A/D FIFO hlaf full */ -#define Int_DTrg 0x01/* external digital trigger */ +#define PCI9118_INT_CTRL_TIMER (1 << 3) /* timer interrupt */ +#define PCI9118_INT_CTRL_ABOUT (1 << 2) /* about trigger complete */ +#define PCI9118_INT_CTRL_HFULL (1 << 1) /* A/D FIFO half full */ +#define PCI9118_INT_CTRL_DTRG (1 << 0) /* ext. digital trigger */ #define START_AI_EXT 0x01/* start measure on external trigger */ #define STOP_AI_EXT0x02/* stop measure on external trigger */ @@ -656,7 +653,7 @@ static int pci9118_exttrg_add(struct comedi_device *dev, unsigned char source) if (source > 3) return -1; /* incorrect source */ devpriv->exttrg_users |= (1 << source); - devpriv->IntControlReg |= Int_DTrg; + devpriv->IntControlReg |= PCI9118_INT_CTRL_DTRG; outl(devpriv->IntControlReg, dev->iobase + PCI9118_INT_CTRL_REG); outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | 0x1f00, devpriv->iobase_a + AMCC_OP_REG_INTCSR); @@ -672,7 +669,7 @@ static int pci9118_exttrg_del(struct comedi_device *dev, unsigned char source) return -1; /* incorrect source */ devpriv->exttrg_users &= ~(1 << source); if (!devpriv->exttrg_users) { /* shutdown ext trg intterrupts */ - devpriv->IntControlReg &= ~Int_DTrg; + devpriv->IntControlReg &= ~PCI9118_INT_CTRL_DTRG; if (!devpriv->IntControlReg)/* all IRQ disabled */ outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) & (~0x1f00), @@ -994,7 +991,8 @@ static irqreturn_t pci9118_interrupt(int irq, void *d) return IRQ_HANDLED; if (devpriv->ai12_startstop) { - if ((adstat & PCI9118_AI_STATUS_DTH) && (intsrc & Int_DTrg)) { + if ((adstat & PCI9118_AI_STATUS_DTH) && + (intsrc & PCI9118_INT_CTRL_DTRG)) { /* start/stop of measure */ if (devpriv->ai12_startstop & START_AI_EXT) { /* deactivate EXT trigger */ @@ -1381,7 +1379,7 @@ static int pci9118_ai_docmd_sampl(struct comedi_device *dev, /* activate EXT trigger */ if ((devpriv->ai_do == 1) || (devpriv->ai_do == 2)) - devpriv->IntControlReg |= Int_Timer; + devpriv->IntControlReg |= PCI9118_INT_CTRL_TIMER; devpriv->AdControlReg |= PCI9118_AI_CTRL_INT; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 17/19] staging: comedi: adl_pci9118: introduce pci9118_ai_reset_fifo()
Introduce a helper function to reset the analog input FIFO. For aesthetics, rename the register used to reset the FIFO. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/adl_pci9118.c | 20 +--- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index dfac797..266eb3f 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -143,8 +143,8 @@ #define PCI9118_AI_CFG_PM (1 << 2) /* 1=post trigger */ #define PCI9118_AI_CFG_AM (1 << 1) /* 1=about trigger */ #define PCI9118_AI_CFG_START (1 << 0) /* 1=trigger start */ +#define PCI9118_FIFO_RESET_REG 0x34 -#define PCI9118_DELFIFO0x34/* W: A/D data FIFO reset */ #define PCI9118_INTSRC 0x38/* R: interrupt reason register */ #define PCI9118_INTCTRL0x38/* W: interrupt control register */ @@ -318,6 +318,12 @@ static void pci9118_timer_set_mode(struct comedi_device *dev, outl(val, dev->iobase + PCI9118_TIMER_CTRL_REG); } +static void pci9118_ai_reset_fifo(struct comedi_device *dev) +{ + /* writing any value resets the A/D FIFO */ + outl(0, dev->iobase + PCI9118_FIFO_RESET_REG); +} + static int check_channel_list(struct comedi_device *dev, struct comedi_subdevice *s, int n_chan, unsigned int *chanlist, int frontadd, int backadd) @@ -497,14 +503,14 @@ static int pci9118_insn_read_ai(struct comedi_device *dev, if (!setup_channel_list(dev, s, 1, &insn->chanspec, 0, 0, 0, 0)) return -EINVAL; - outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ + pci9118_ai_reset_fifo(dev); for (n = 0; n < insn->n; n++) { pci9118_ai_start_conv(dev); ret = comedi_timeout(dev, s, insn, pci9118_ai_eoc, 0); if (ret) { - outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ + pci9118_ai_reset_fifo(dev); return ret; } @@ -515,7 +521,7 @@ static int pci9118_insn_read_ai(struct comedi_device *dev, data[n] = (val >> 4) & 0xfff; } - outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ + pci9118_ai_reset_fifo(dev); return n; } @@ -768,7 +774,7 @@ static int pci9118_ai_cancel(struct comedi_device *dev, /* reset scan queue */ outl(1, dev->iobase + PCI9118_AI_AUTOSCAN_MODE_REG); outl(2, dev->iobase + PCI9118_AI_AUTOSCAN_MODE_REG); - outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ + pci9118_ai_reset_fifo(dev); devpriv->ai_do = 0; devpriv->usedma = 0; @@ -1643,7 +1649,7 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) */ outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_AI_CFG_REG); udelay(1); - outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ + pci9118_ai_reset_fifo(dev); /* clear A/D and INT status registers */ inl(dev->iobase + PCI9118_AI_STATUS_REG); @@ -1703,7 +1709,7 @@ static int pci9118_reset(struct comedi_device *dev) outl(0, dev->iobase + PCI9118_DIO_REG); /* reset digi outs to L */ udelay(10); inl(dev->iobase + PCI9118_AI_FIFO_REG); - outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ + pci9118_ai_reset_fifo(dev); outl(0, dev->iobase + PCI9118_INTSRC); /* remove INT requests */ /* clear A/D and INT status registers */ inl(dev->iobase + PCI9118_AI_STATUS_REG); -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: gs_fpgaboot: remove unnecessary return statements
This fixes "void function return statements are not generally useful" warnings from checkpatch.pl. Signed-off-by: Michał Bartoszkiewicz --- drivers/staging/gs_fpgaboot/io.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/staging/gs_fpgaboot/io.c b/drivers/staging/gs_fpgaboot/io.c index 23c12f4..f5cd33b 100644 --- a/drivers/staging/gs_fpgaboot/io.c +++ b/drivers/staging/gs_fpgaboot/io.c @@ -251,17 +251,14 @@ int xl_init_io(void) void xl_program_b(int32_t i) { - return; } void xl_rdwr_b(int32_t i) { - return; } void xl_csi_b(int32_t i) { - return; } int xl_get_init_b(void) @@ -276,17 +273,14 @@ int xl_get_done_b(void) static inline void byte0_out(unsigned char data) { - return; } static inline void byte1_out(unsigned char data) { - return; } static inline void xl_cclk_b(int32_t i) { - return; } /* -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v4] staging: unisys: uislib: uisqueue.c: rewrite of do_locked_client_insert
On Thu, Sep 04, 2014 at 10:11:16PM +0530, Sudip Mukherjee wrote: > On Wed, Sep 03, 2014 at 12:59:50PM +0300, Dan Carpenter wrote: > > On Wed, Sep 03, 2014 at 02:59:21PM +0530, Sudip Mukherjee wrote: > > > 1) removed unused variables > > > 2) fixed sparse warning of context imbalance in 'do_locked_client_insert' > > > different lock contexts for basic block > > > 3) removed the call to visor_signalqueue_empty() , this function is > > >checking whether a signal queue is empty, but the return value > > >of the function is not beeing used, so it is safe to remove. > > > > > > Signed-off-by: Sudip Mukherjee > > > > Looks good. Thanks! > > > > Reviewed-by: Dan Carpenter > > > > regards, > > dan carpenter > > do i need to resend the patch after adding Reviewed-by to it ? > No. Greg will reply (perhaps an automated message) when he gets to the patch. Otherwise your job is done. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] drivers: staging: rtl8192u: Fix "space required before that '*'" errors
Fix checkpatch.pl "space required before that '*'" errors Signed-off-by: Greg Donald --- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 6 +++--- drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h | 2 +- drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h | 8 drivers/staging/rtl8192u/r8192U_hw.h | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h index 125c5ab..3a96a9c 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h @@ -1211,7 +1211,7 @@ typedef union _frameqos { u16 reserved:1; u16 txop:8; }field; -}frameqos,*pframeqos; +} frameqos, *pframeqos; /* SWEEP TABLE ENTRIES NUMBER*/ #define MAX_SWEEP_TAB_ENTRIES42 @@ -1648,7 +1648,7 @@ typedef struct _bandwidth_autoswitch { longthreshold_40Mhzto20Mhz; bool bforced_tx20Mhz; bool bautoswitch_enable; -}bandwidth_autoswitch,*pbandwidth_autoswitch; +} bandwidth_autoswitch, *pbandwidth_autoswitch; //added by amy for order @@ -1745,7 +1745,7 @@ typedef struct _RT_POWER_SAVE_CONTROL { // boolbLeisurePs; -}RT_POWER_SAVE_CONTROL,*PRT_POWER_SAVE_CONTROL; +} RT_POWER_SAVE_CONTROL, *PRT_POWER_SAVE_CONTROL; typedef u32 RT_RF_CHANGE_SOURCE; #define RF_CHANGE_BY_SW BIT31 diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h b/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h index 2b82835..c3aabba 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h @@ -53,7 +53,7 @@ typedef enum _HT_MCS_RATE{ HT_MCS14 = 0x4000, HT_MCS15 = 0x8000, // Do not define MCS32 here although 8190 support MCS32 -}HT_MCS_RATE,*PHT_MCS_RATE; +} HT_MCS_RATE, *PHT_MCS_RATE; // // Represent Channel Width in HT Capabilities diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h b/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h index f2d52ca..9fbce91 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h @@ -66,7 +66,7 @@ typedef u32 QOS_MODE, *PQOS_MODE; typedefenum _ACK_POLICY{ eAckPlc0_ACK= 0x00, eAckPlc1_NoACK = 0x01, -}ACK_POLICY,*PACK_POLICY; +} ACK_POLICY, *PACK_POLICY; #define WMM_PARAM_ELEMENT_SIZE (8+(4*AC_PARAM_SIZE)) @@ -276,7 +276,7 @@ typedef union _AC_PARAM{ typedefenum _QOS_ELE_SUBTYPE{ QOSELE_TYPE_INFO= 0x00, // 0x00: Information element QOSELE_TYPE_PARAM = 0x01, // 0x01: parameter element -}QOS_ELE_SUBTYPE,*PQOS_ELE_SUBTYPE; +} QOS_ELE_SUBTYPE, *PQOS_ELE_SUBTYPE; // @@ -288,7 +288,7 @@ typedef enum _DIRECTION_VALUE{ DIR_DOWN= 1,// 0x01 // DownLink DIR_DIRECT = 2,// 0x10 // DirectLink DIR_BI_DIR = 3,// 0x11 // Bi-Direction -}DIRECTION_VALUE,*PDIRECTION_VALUE; +} DIRECTION_VALUE, *PDIRECTION_VALUE; // @@ -363,7 +363,7 @@ typedef enum _ACM_METHOD{ eAcmWay0_SwAndHw= 0,// By SW and HW. eAcmWay1_HW = 1,// By HW. eAcmWay2_SW = 2,// By SW. -}ACM_METHOD,*PACM_METHOD; +} ACM_METHOD, *PACM_METHOD; typedef struct _ACM{ diff --git a/drivers/staging/rtl8192u/r8192U_hw.h b/drivers/staging/rtl8192u/r8192U_hw.h index dd07a73..a93694f 100644 --- a/drivers/staging/rtl8192u/r8192U_hw.h +++ b/drivers/staging/rtl8192u/r8192U_hw.h @@ -24,7 +24,7 @@ typedef enum _VERSION_819xU{ VERSION_819xU_A, // A-cut VERSION_819xU_B, // B-cut VERSION_819xU_C,// C-cut -}VERSION_819xU,*PVERSION_819xU; +} VERSION_819xU, *PVERSION_819xU; //added for different RF type typedef enum _RT_RF_TYPE_DEF { -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] rtl8188eu: Replace rcu_dereference() with rcu_access_pointer()
Hello, I cloned this: git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git and after moved to staging-next branch, but in both cases, in those files I don't find any use of rcu_dereference() call (the call which I am looking for to modify). Thank you, Andreea 2014-08-30 23:42 GMT+03:00 Greg KH : > On Sun, Aug 17, 2014 at 02:43:37PM +0300, Andreea-Cristina Bernat wrote: >> The "rcu_dereference()" call is used directly in a condition. >> Since its return value is never dereferenced it is recommended to use >> "rcu_access_pointer()" instead of "rcu_dereference()". >> Therefore, this patch makes the replacement. >> >> The following Coccinelle semantic patch was used: >> @@ >> @@ >> >> ( >> if( >> (<+... >> - rcu_dereference >> + rcu_access_pointer >> (...) >> ...+>)) {...} >> | >> while( >> (<+... >> - rcu_dereference >> + rcu_access_pointer >> (...) >> ...+>)) {...} >> ) >> >> Signed-off-by: Andreea-Cristina Bernat >> --- >> drivers/staging/rtl8188eu/core/rtw_mlme.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) > > This patch fails to apply to my tree, can you refresh it against the > staging-next branch of the staging.git tree on kernel.org and resend? > > thanks, > > greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] drivers: staging: rtl8821ae: Fix "space required before that '*'" errors
Fix checkpatch.pl "space required before that '*'" errors Signed-off-by: Greg Donald --- drivers/staging/rtl8821ae/btcoexist/HalBtc8812a1Ant.h | 6 +++--- drivers/staging/rtl8821ae/btcoexist/habtc8723a1ant.h | 6 +++--- drivers/staging/rtl8821ae/btcoexist/halbtc8192e1ant.h | 8 drivers/staging/rtl8821ae/btcoexist/halbtc8723a2ant.h | 6 +++--- drivers/staging/rtl8821ae/btcoexist/halbtc8723b1ant.h | 8 drivers/staging/rtl8821ae/btcoexist/halbtc8723b2ant.h | 6 +++--- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/drivers/staging/rtl8821ae/btcoexist/HalBtc8812a1Ant.h b/drivers/staging/rtl8821ae/btcoexist/HalBtc8812a1Ant.h index 37bdab5..446fd68 100644 --- a/drivers/staging/rtl8821ae/btcoexist/HalBtc8812a1Ant.h +++ b/drivers/staging/rtl8821ae/btcoexist/HalBtc8812a1Ant.h @@ -23,7 +23,7 @@ typedef enum _BT_INFO_SRC_8812A_1ANT{ BT_INFO_SRC_8812A_1ANT_BT_RSP = 0x1, BT_INFO_SRC_8812A_1ANT_BT_ACTIVE_SEND = 0x2, BT_INFO_SRC_8812A_1ANT_MAX -}BT_INFO_SRC_8812A_1ANT,*PBT_INFO_SRC_8812A_1ANT; +} BT_INFO_SRC_8812A_1ANT, *PBT_INFO_SRC_8812A_1ANT; typedef enum _BT_8812A_1ANT_BT_STATUS{ BT_8812A_1ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0, @@ -33,7 +33,7 @@ typedef enum _BT_8812A_1ANT_BT_STATUS{ BT_8812A_1ANT_BT_STATUS_SCO_BUSY= 0x4, BT_8812A_1ANT_BT_STATUS_ACL_SCO_BUSY= 0x5, BT_8812A_1ANT_BT_STATUS_MAX -}BT_8812A_1ANT_BT_STATUS,*PBT_8812A_1ANT_BT_STATUS; +} BT_8812A_1ANT_BT_STATUS, *PBT_8812A_1ANT_BT_STATUS; typedef enum _BT_8812A_1ANT_COEX_ALGO{ BT_8812A_1ANT_COEX_ALGO_UNDEFINED = 0x0, @@ -48,7 +48,7 @@ typedef enum _BT_8812A_1ANT_COEX_ALGO{ BT_8812A_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9, BT_8812A_1ANT_COEX_ALGO_HID_A2DP= 0xa, BT_8812A_1ANT_COEX_ALGO_MAX = 0xb, -}BT_8812A_1ANT_COEX_ALGO,*PBT_8812A_1ANT_COEX_ALGO; +} BT_8812A_1ANT_COEX_ALGO, *PBT_8812A_1ANT_COEX_ALGO; typedef struct _COEX_DM_8812A_1ANT{ // fw mechanism diff --git a/drivers/staging/rtl8821ae/btcoexist/habtc8723a1ant.h b/drivers/staging/rtl8821ae/btcoexist/habtc8723a1ant.h index 60992f5..ffd9ac8 100644 --- a/drivers/staging/rtl8821ae/btcoexist/habtc8723a1ant.h +++ b/drivers/staging/rtl8821ae/btcoexist/habtc8723a1ant.h @@ -30,14 +30,14 @@ typedef enum _BT_INFO_SRC_8723A_1ANT{ BT_INFO_SRC_8723A_1ANT_BT_RSP = 0x1, BT_INFO_SRC_8723A_1ANT_BT_ACTIVE_SEND = 0x2, BT_INFO_SRC_8723A_1ANT_MAX -}BT_INFO_SRC_8723A_1ANT,*PBT_INFO_SRC_8723A_1ANT; +} BT_INFO_SRC_8723A_1ANT, *PBT_INFO_SRC_8723A_1ANT; typedef enum _BT_8723A_1ANT_BT_STATUS{ BT_8723A_1ANT_BT_STATUS_IDLE= 0x0, BT_8723A_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1, BT_8723A_1ANT_BT_STATUS_NON_IDLE= 0x2, BT_8723A_1ANT_BT_STATUS_MAX -}BT_8723A_1ANT_BT_STATUS,*PBT_8723A_1ANT_BT_STATUS; +} BT_8723A_1ANT_BT_STATUS, *PBT_8723A_1ANT_BT_STATUS; typedef enum _BT_8723A_1ANT_COEX_ALGO{ BT_8723A_1ANT_COEX_ALGO_UNDEFINED = 0x0, @@ -51,7 +51,7 @@ typedef enum _BT_8723A_1ANT_COEX_ALGO{ BT_8723A_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x8, BT_8723A_1ANT_COEX_ALGO_HID_A2DP= 0x9, BT_8723A_1ANT_COEX_ALGO_MAX -}BT_8723A_1ANT_COEX_ALGO,*PBT_8723A_1ANT_COEX_ALGO; +} BT_8723A_1ANT_COEX_ALGO, *PBT_8723A_1ANT_COEX_ALGO; typedef struct _COEX_DM_8723A_1ANT{ // fw mechanism diff --git a/drivers/staging/rtl8821ae/btcoexist/halbtc8192e1ant.h b/drivers/staging/rtl8821ae/btcoexist/halbtc8192e1ant.h index a759b75..37a782f 100644 --- a/drivers/staging/rtl8821ae/btcoexist/halbtc8192e1ant.h +++ b/drivers/staging/rtl8821ae/btcoexist/halbtc8192e1ant.h @@ -22,7 +22,7 @@ typedef enum _BT_INFO_SRC_8192E_1ANT{ BT_INFO_SRC_8192E_1ANT_BT_RSP = 0x1, BT_INFO_SRC_8192E_1ANT_BT_ACTIVE_SEND = 0x2, BT_INFO_SRC_8192E_1ANT_MAX -}BT_INFO_SRC_8192E_1ANT,*PBT_INFO_SRC_8192E_1ANT; +} BT_INFO_SRC_8192E_1ANT, *PBT_INFO_SRC_8192E_1ANT; typedef enum _BT_8192E_1ANT_BT_STATUS{ BT_8192E_1ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0, @@ -32,7 +32,7 @@ typedef enum _BT_8192E_1ANT_BT_STATUS{ BT_8192E_1ANT_BT_STATUS_SCO_BUSY= 0x4, BT_8192E_1ANT_BT_STATUS_ACL_SCO_BUSY= 0x5, BT_8192E_1ANT_BT_STATUS_MAX -}BT_8192E_1ANT_BT_STATUS,*PBT_8192E_1ANT_BT_STATUS; +} BT_8192E_1ANT_BT_STATUS, *PBT_8192E_1ANT_BT_STATUS; typedef enum _BT_8192E_1ANT_WIFI_STATUS{ BT_8192E_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE = 0x0, @@ -42,7 +42,7 @@ typedef enum _BT_8192E_1ANT_WIFI_STATUS{ BT_8192E_1ANT_WIFI_STATUS_CONNECTED_IDLE = 0x4, BT_8192E_1ANT_WIF
Re: [PATCH] staging: gs_fpgaboot: remove unnecessary return statements
Okay, thank you. Reviewed-by: Insop Song On Thu, Sep 04, 2014 at 10:05:36PM +0200, Michał Bartoszkiewicz wrote: > This fixes "void function return statements are not generally useful" > warnings from checkpatch.pl. > > Signed-off-by: Michał Bartoszkiewicz > --- > drivers/staging/gs_fpgaboot/io.c | 6 -- > 1 file changed, 6 deletions(-) > > diff --git a/drivers/staging/gs_fpgaboot/io.c > b/drivers/staging/gs_fpgaboot/io.c > index 23c12f4..f5cd33b 100644 > --- a/drivers/staging/gs_fpgaboot/io.c > +++ b/drivers/staging/gs_fpgaboot/io.c > @@ -251,17 +251,14 @@ int xl_init_io(void) > > void xl_program_b(int32_t i) > { > - return; > } > > void xl_rdwr_b(int32_t i) > { > - return; > } > > void xl_csi_b(int32_t i) > { > - return; > } > > int xl_get_init_b(void) > @@ -276,17 +273,14 @@ int xl_get_done_b(void) > > static inline void byte0_out(unsigned char data) > { > - return; > } > > static inline void byte1_out(unsigned char data) > { > - return; > } > > static inline void xl_cclk_b(int32_t i) > { > - return; > } > > /* > -- > 2.1.0 > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] rtl8188eu: Replace rcu_dereference() with rcu_access_pointer()
On 09/04/2014 03:58 PM, Andreea Bernat wrote: Hello, I cloned this: git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git and after moved to staging-next branch, but in both cases, in those files I don't find any use of rcu_dereference() call (the call which I am looking for to modify). The rcu_dereference() call in core/rtw_mlme.c is no longer there in mainline 3.17, thus it was removed some time ago. There is a similar reference in os_dep/recv_linux.c. Perhaps it should be removed. This problem shows the importance of working with the latest pull of the staging repo when working with staging code. Even then patches may suffer mid-air collisions if multiple devs are working on a particular piece of code. Larry ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] rtl8188eu: Replace rcu_dereference() with rcu_access_pointer()
On Thu, Sep 04, 2014 at 11:58:36PM +0300, Andreea Bernat wrote: > Hello, > > I cloned this: > git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git > > and after moved to staging-next branch, but in both cases, in > those files I don't find any use of rcu_dereference() call (the call > which I am looking for to modify). Then there's nothing left to be done here, right? :) thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [GIT PULL] Staging driver patches for 3.15-rc1
On Wed, 2014-04-02 at 16:08 -0700, Greg KH wrote: > On Wed, Apr 02, 2014 at 08:52:18PM +, Insop Song wrote: > > On Wed, April 02, 2014 1:04 PM, Greg KH wrote: > > > On Wed, Apr 02, 2014 at 10:24:03AM +0200, Paul Bolle wrote: > > > > On Tue, 2014-04-01 at 11:48 -0700, Greg KH wrote: > > > > > Staging driver pull request for 3.15-rc1 > > > > > > > > > > Here's the huge drivers/staging/ update for 3.15-rc1. > > > > > > > > > > Loads of cleanup fixes, a few drivers removed, and some new ones > > > added. > > > > > > > > > > All have been in linux-next for a while. > > > > > > > > > >[...] > > > > > > > > > > Insop Song (1): > > > > > staging: fpgaboot: Xilinx FPGA firmware download driver > > > > > > > > This commit adds checks for CONFIG_B4860G100. Is a patch to add a > > > > Kconfig symbol B4860G100 perhaps queued somewhere? > > > > > > Insop, I thought this config option was coming from some other place, > > > right? > > > > > > > Paul, > > I didn't include CONFIG_B4860G100 in Kconfig in original patch set, > > since programming FPGA method can vary in different system, and this > > was discussed during the review with Greg as well. > > > > However, actual fpga programming method is well contained in io.c with > > ifdef-ed CONFIG_B4860G100, now I think I might better to update > > Kconfig to include CONFIG_B4860G100. > > > > Greg, what do you think? Any harm to add custom board CONFIG* to > > staging Kconfig? Let me know. > > Let's see what it would look like and we can go from there. Nothing appears to have changed: there are still checks for CONFIG_B4860G100 in next-20140904. Should I submit the trivial patch to remove those checks and the code they hide? Paul Bolle ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [GIT PULL] Staging driver patches for 3.15-rc1
On Fri, Sep 05, 2014 at 01:13:55AM +0200, Paul Bolle wrote: > On Wed, 2014-04-02 at 16:08 -0700, Greg KH wrote: > > On Wed, Apr 02, 2014 at 08:52:18PM +, Insop Song wrote: > > > On Wed, April 02, 2014 1:04 PM, Greg KH wrote: > > > > On Wed, Apr 02, 2014 at 10:24:03AM +0200, Paul Bolle wrote: > > > > > On Tue, 2014-04-01 at 11:48 -0700, Greg KH wrote: > > > > > > Staging driver pull request for 3.15-rc1 > > > > > > > > > > > > Here's the huge drivers/staging/ update for 3.15-rc1. > > > > > > > > > > > > Loads of cleanup fixes, a few drivers removed, and some new ones > > > > added. > > > > > > > > > > > > All have been in linux-next for a while. > > > > > > > > > > > >[...] > > > > > > > > > > > > Insop Song (1): > > > > > > staging: fpgaboot: Xilinx FPGA firmware download driver > > > > > > > > > > This commit adds checks for CONFIG_B4860G100. Is a patch to add a > > > > > Kconfig symbol B4860G100 perhaps queued somewhere? > > > > > > > > Insop, I thought this config option was coming from some other place, > > > > right? > > > > > > > > > > Paul, > > > I didn't include CONFIG_B4860G100 in Kconfig in original patch set, > > > since programming FPGA method can vary in different system, and this > > > was discussed during the review with Greg as well. > > > > > > However, actual fpga programming method is well contained in io.c with > > > ifdef-ed CONFIG_B4860G100, now I think I might better to update > > > Kconfig to include CONFIG_B4860G100. > > > > > > Greg, what do you think? Any harm to add custom board CONFIG* to > > > staging Kconfig? Let me know. > > > > Let's see what it would look like and we can go from there. > > Nothing appears to have changed: there are still checks for > CONFIG_B4860G100 in next-20140904. Should I submit the trivial patch to > remove those checks and the code they hide? Yes, please do. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/1] Drivers: scsi: storvsc: Get rid of warning messages
Looks good to me. Olaf, Hannes - can I get another review for this (and the older hyperv scanning patch set)? ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: iio: adc: mxs-lradc.c: sparse warning of incorrect type
On Thu, Sep 04, 2014 at 07:16:11PM +0200, Lars-Peter Clausen wrote: > On 09/04/2014 07:12 PM, Sudip Mukherjee wrote: > >On Thu, Sep 04, 2014 at 06:50:05PM +0200, Lars-Peter Clausen wrote: > >>On 09/04/2014 06:45 PM, Sudip Mukherjee wrote: > >>>fixed sparse warning : incorrect type in argument 1 > >>> (different address spaces) > >>> > >>>Signed-off-by: Sudip Mukherjee > >>>--- > >>> drivers/staging/iio/adc/mxs-lradc.c | 9 ++--- > >>> 1 file changed, 6 insertions(+), 3 deletions(-) > >>> > >>>diff --git a/drivers/staging/iio/adc/mxs-lradc.c > >>>b/drivers/staging/iio/adc/mxs-lradc.c > >>>index 468327f..d8d1fe1 100644 > >>>--- a/drivers/staging/iio/adc/mxs-lradc.c > >>>+++ b/drivers/staging/iio/adc/mxs-lradc.c > >>>@@ -1545,9 +1545,12 @@ static int mxs_lradc_probe(struct platform_device > >>>*pdev) > >>> /* Grab the memory area */ > >>> iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); > >>> lradc->dev = &pdev->dev; > >>>- lradc->base = devm_ioremap_resource(dev, iores); > >>>- if (IS_ERR(lradc->base)) > >>>- return PTR_ERR(lradc->base); > >>>+ void *tempptr; > >>>+ > >>>+ tempptr = devm_ioremap_resource(dev, iores); > >>>+ if (IS_ERR(tempptr)) > >>>+ return PTR_ERR(tempptr); > >>>+ lradc->base = tempptr; > >> > >>This makes no sense at all... devm_ioremap_resource() returns a > >>iomem pointer lrdac->base is a iomem pointer. > > > >sparse is giving warning for argument 1 of IS_ERR. > > Not if you update to the latest version of sparse. > yes , looks like ubuntu repository is having version 0.4.3 , whereas the latest version is 0.5.0. and with this one there no warning for iio. sorry for the noise. thanks sudip > > > >> > >>Please make sure that you have the latest version of sparse > >>installed on your system. > >> > >>> > >>> lradc->clk = devm_clk_get(&pdev->dev, NULL); > >>> if (IS_ERR(lradc->clk)) { > >>> > >> > > > >thanks > >sudip > > > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel