[PATCH] staging: media: atomisp: use kvmalloc/kvzalloc
Use kvmalloc()/kvzalloc() instead of atomisp_kernel_malloc() /atomisp_kernel_zalloc(). Signed-off-by: Geliang Tang --- .../media/atomisp/pci/atomisp2/atomisp_cmd.c | 31 +- .../media/atomisp/pci/atomisp2/atomisp_cmd.h | 2 -- .../atomisp/pci/atomisp2/atomisp_compat_css20.c| 4 +-- .../media/atomisp/pci/atomisp2/atomisp_internal.h | 2 -- 4 files changed, 3 insertions(+), 36 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c index 7bf5dcd..f48bf45 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c @@ -83,35 +83,6 @@ union host { }; /* - * atomisp_kernel_malloc: chooses whether kmalloc() or vmalloc() is preferable. - * - * It is also a wrap functions to pass into css framework. - */ -void *atomisp_kernel_malloc(size_t bytes) -{ - /* vmalloc() is preferable if allocating more than 1 page */ - if (bytes > PAGE_SIZE) - return vmalloc(bytes); - - return kmalloc(bytes, GFP_KERNEL); -} - -/* - * atomisp_kernel_zalloc: chooses whether set 0 to the allocated memory. - * - * It is also a wrap functions to pass into css framework. - */ -void *atomisp_kernel_zalloc(size_t bytes, bool zero_mem) -{ - void *ptr = atomisp_kernel_malloc(bytes); - - if (ptr && zero_mem) - memset(ptr, 0, bytes); - - return ptr; -} - -/* * get sensor:dis71430/ov2720 related info from v4l2_subdev->priv data field. * subdev->priv is set in mrst.c */ @@ -4316,7 +4287,7 @@ int atomisp_set_parameters(struct video_device *vdev, * are ready, the parameters will be set to CSS. * per-frame setting only works for the main output frame. */ - param = atomisp_kernel_zalloc(sizeof(*param), true); + param = kvzalloc(sizeof(*param), GFP_KERNEL); if (!param) { dev_err(asd->isp->dev, "%s: failed to alloc params buffer\n", __func__); diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.h b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.h index 1ccd911..31ba4e6 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.h @@ -78,8 +78,6 @@ static inline void __iomem *atomisp_get_io_virt_addr(unsigned int address) return ret; } */ -void *atomisp_kernel_malloc(size_t bytes); -void *atomisp_kernel_zalloc(size_t bytes, bool zero_mem); /* * Interrupt functions diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c index 36f934d..05897b7 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c @@ -1671,9 +1671,9 @@ int atomisp_alloc_metadata_output_buf(struct atomisp_sub_device *asd) /* We allocate the cpu-side buffer used for communication with user * space */ for (i = 0; i < ATOMISP_METADATA_TYPE_NUM; i++) { - asd->params.metadata_user[i] = atomisp_kernel_malloc( + asd->params.metadata_user[i] = kvmalloc( asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL]. - stream_info.metadata_info.size); + stream_info.metadata_info.size, GFP_KERNEL); if (!asd->params.metadata_user[i]) { while (--i >= 0) { kvfree(asd->params.metadata_user[i]); diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h index 4b03f28..7542a72f 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h @@ -301,8 +301,6 @@ struct atomisp_device { extern struct device *atomisp_dev; -extern void *atomisp_kernel_malloc(size_t bytes); - #define atomisp_is_wdt_running(a) timer_pending(&(a)->wdt) #ifdef ISP2401 extern void atomisp_wdt_refresh_pipe(struct atomisp_video_pipe *pipe, -- 2.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: comedi: use memdup_user
Use memdup_user() helper instead of open-coding to simplify the code. Signed-off-by: Geliang Tang --- drivers/staging/comedi/comedi_fops.c | 22 +++--- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index f191c2a..4797c8f 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -1450,22 +1450,14 @@ static int do_insnlist_ioctl(struct comedi_device *dev, return -EFAULT; data = kmalloc_array(MAX_SAMPLES, sizeof(unsigned int), GFP_KERNEL); - if (!data) { - ret = -ENOMEM; - goto error; - } - - insns = kcalloc(insnlist.n_insns, sizeof(*insns), GFP_KERNEL); - if (!insns) { - ret = -ENOMEM; - goto error; - } + if (!data) + return -ENOMEM; - if (copy_from_user(insns, insnlist.insns, - sizeof(*insns) * insnlist.n_insns)) { - dev_dbg(dev->class_dev, "copy_from_user failed\n"); - ret = -EFAULT; - goto error; + insns = memdup_user(insnlist.insns, sizeof(*insns) * insnlist.n_insns); + if (IS_ERR(insns)) { + dev_dbg(dev->class_dev, "memdup_user failed\n"); + kfree(data); + return PTR_ERR(insns); } for (i = 0; i < insnlist.n_insns; i++) { -- 2.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: media: atomisp: fix build error
Fix the following build error: CC drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.o drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c:52:2: error: excess elements in array initializer [-Werror] "i", /* ion */ ^~~ drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c:52:2: note: (near initialization for ‘hmm_bo_type_strings’) cc1: all warnings being treated as errors scripts/Makefile.build:294: recipe for target 'drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.o' failed Signed-off-by: Geliang Tang --- drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c index a362b49..e78f02f 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c @@ -49,7 +49,9 @@ const char *hmm_bo_type_strings[HMM_BO_LAST] = { "p", /* private */ "s", /* shared */ "u", /* user */ +#ifdef CONFIG_ION "i", /* ion */ +#endif }; static ssize_t bo_show(struct device *dev, struct device_attribute *attr, -- 2.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: media: atomisp: use kvmalloc and kvfree
Use kvmalloc() and kvfree() instead of open-coding. Signed-off-by: Geliang Tang --- drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c index 94bc793..c7b9320 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c @@ -90,10 +90,7 @@ union host { void *atomisp_kernel_malloc(size_t bytes) { /* vmalloc() is preferable if allocating more than 1 page */ - if (bytes > PAGE_SIZE) - return vmalloc(bytes); - - return kmalloc(bytes, GFP_KERNEL); + return kvmalloc(bytes, GFP_KERNEL); } /* @@ -118,10 +115,7 @@ void *atomisp_kernel_zalloc(size_t bytes, bool zero_mem) void atomisp_kernel_free(void *ptr) { /* Verify if buffer was allocated by vmalloc() or kmalloc() */ - if (is_vmalloc_addr(ptr)) - vfree(ptr); - else - kfree(ptr); + kvfree(ptr); } /* -- 2.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: lustre: use i_blocksize()
Since i_blocksize() helper has been defined in fs.h, use it instead of open-coding. Signed-off-by: Geliang Tang --- drivers/staging/lustre/lustre/llite/file.c| 2 +- drivers/staging/lustre/lustre/obdclass/obdo.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index d93f06a..3ee546f 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -2967,7 +2967,7 @@ int ll_getattr(struct vfsmount *mnt, struct dentry *de, struct kstat *stat) stat->atime = inode->i_atime; stat->mtime = inode->i_mtime; stat->ctime = inode->i_ctime; - stat->blksize = 1 << inode->i_blkbits; + stat->blksize = i_blocksize(inode); stat->nlink = inode->i_nlink; stat->size = i_size_read(inode); diff --git a/drivers/staging/lustre/lustre/obdclass/obdo.c b/drivers/staging/lustre/lustre/obdclass/obdo.c index b1dfa16..b9be7db 100644 --- a/drivers/staging/lustre/lustre/obdclass/obdo.c +++ b/drivers/staging/lustre/lustre/obdclass/obdo.c @@ -84,7 +84,7 @@ void obdo_from_inode(struct obdo *dst, struct inode *src, u32 valid) newvalid |= OBD_MD_FLBLOCKS; } if (valid & OBD_MD_FLBLKSZ) { /* optimal block size */ - dst->o_blksize = 1 << src->i_blkbits; + dst->o_blksize = i_blocksize(src); newvalid |= OBD_MD_FLBLKSZ; } if (valid & OBD_MD_FLTYPE) { -- 2.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: lustre: osc: use rb_entry_safe
Use rb_entry_safe() instead of container_of() to simplify the code. Signed-off-by: Geliang Tang --- drivers/staging/lustre/lustre/osc/osc_cache.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index b0f030c..6048df9 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -142,10 +142,7 @@ static const char *oes_strings[] = { static inline struct osc_extent *rb_extent(struct rb_node *n) { - if (!n) - return NULL; - - return container_of(n, struct osc_extent, oe_node); + return rb_entry_safe(n, struct osc_extent, oe_node); } static inline struct osc_extent *next_extent(struct osc_extent *ext) -- 2.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rtl8712: use container_of() instead of LIST_CONTAINOR()
This patch drops the local definition of LIST_CONTAINOR(), and uses container_of() instead of it. Signed-off-by: Geliang Tang --- drivers/staging/rtl8712/osdep_service.h | 3 --- drivers/staging/rtl8712/rtl8712_recv.c| 10 +- drivers/staging/rtl8712/rtl8712_xmit.c| 8 drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 12 ++-- drivers/staging/rtl8712/rtl871x_mlme.c| 12 ++-- drivers/staging/rtl8712/rtl871x_recv.c| 2 +- drivers/staging/rtl8712/rtl871x_sta_mgt.c | 6 +++--- drivers/staging/rtl8712/rtl871x_xmit.c| 2 +- 8 files changed, 26 insertions(+), 29 deletions(-) diff --git a/drivers/staging/rtl8712/osdep_service.h b/drivers/staging/rtl8712/osdep_service.h index 076d508..ad041c9 100644 --- a/drivers/staging/rtl8712/osdep_service.h +++ b/drivers/staging/rtl8712/osdep_service.h @@ -57,9 +57,6 @@ struct__queue { spin_lock_init(&((pqueue)->lock)); \ } while (0) -#define LIST_CONTAINOR(ptr, type, member) \ - ((type *)((char *)(ptr)-(SIZE_T)(&((type *)0)->member))) - static inline u32 _down_sema(struct semaphore *sema) { if (down_interruptible(sema)) diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c index d187508..f25b34c 100644 --- a/drivers/staging/rtl8712/rtl8712_recv.c +++ b/drivers/staging/rtl8712/rtl8712_recv.c @@ -204,7 +204,7 @@ static union recv_frame *recvframe_defrag(struct _adapter *adapter, pfree_recv_queue = &adapter->recvpriv.free_recv_queue; phead = &defrag_q->queue; plist = phead->next; - prframe = LIST_CONTAINOR(plist, union recv_frame, u); + prframe = container_of(plist, union recv_frame, u.list); list_del_init(&prframe->u.list); pfhdr = &prframe->u.hdr; curfragnum = 0; @@ -219,7 +219,7 @@ static union recv_frame *recvframe_defrag(struct _adapter *adapter, plist = &defrag_q->queue; plist = plist->next; while (!end_of_queue_search(phead, plist)) { - pnextrframe = LIST_CONTAINOR(plist, union recv_frame, u); + pnextrframe = container_of(plist, union recv_frame, u.list); pnfhdr = &pnextrframe->u.hdr; /*check the fragment sequence (2nd ~n fragment frame) */ if (curfragnum != pnfhdr->attrib.frag_num) { @@ -492,7 +492,7 @@ static int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, phead = &ppending_recvframe_queue->queue; plist = phead->next; while (!end_of_queue_search(phead, plist)) { - pnextrframe = LIST_CONTAINOR(plist, union recv_frame, u); + pnextrframe = container_of(plist, union recv_frame, u.list); pnextattrib = &pnextrframe->u.hdr.attrib; if (SN_LESS(pnextattrib->seq_num, pattrib->seq_num)) plist = plist->next; @@ -525,14 +525,14 @@ int r8712_recv_indicatepkts_in_order(struct _adapter *padapter, if (list_empty(phead)) return true; - prframe = LIST_CONTAINOR(plist, union recv_frame, u); + prframe = container_of(plist, union recv_frame, u.list); pattrib = &prframe->u.hdr.attrib; preorder_ctrl->indicate_seq = pattrib->seq_num; } /* Prepare indication list and indication. * Check if there is any packet need indicate. */ while (!list_empty(phead)) { - prframe = LIST_CONTAINOR(plist, union recv_frame, u); + prframe = container_of(plist, union recv_frame, u.list); pattrib = &prframe->u.hdr.attrib; if (!SN_LESS(preorder_ctrl->indicate_seq, pattrib->seq_num)) { plist = plist->next; diff --git a/drivers/staging/rtl8712/rtl8712_xmit.c b/drivers/staging/rtl8712/rtl8712_xmit.c index b21a60e..7e0b945 100644 --- a/drivers/staging/rtl8712/rtl8712_xmit.c +++ b/drivers/staging/rtl8712/rtl8712_xmit.c @@ -169,8 +169,8 @@ static struct xmit_frame *dequeue_one_xmitframe(struct xmit_priv *pxmitpriv, xmitframe_phead = &pframe_queue->queue; xmitframe_plist = xmitframe_phead->next; if (!end_of_queue_search(xmitframe_phead, xmitframe_plist)) { - pxmitframe = LIST_CONTAINOR(xmitframe_plist, -struct xmit_frame, list); + pxmitframe = container_of(xmitframe_plist, + struct xmit_frame, list); list_del_init(&pxmitframe->list); ptxservq->qcnt--; phwxmit->txcmdcnt++; @@ -209,8 +209,8 @@ static struct xmit_frame *dequeue_xframe_ex(struct xmit_priv *pxmitpriv, sta_phead = &phwxmit->sta_queue->
[PATCH v2 0/3] staging: rtl8723au: use list_first_entry*
On Mon, Feb 22, 2016 at 09:39:15PM -0500, Jes Sorensen wrote: > Geliang Tang writes: > > Use list_first_entry*() instead of container_of() to simplify the code. > > > > Signed-off-by: Geliang Tang > > --- > > drivers/staging/rtl8723au/core/rtw_recv.c | 49 > > +-- > > drivers/staging/rtl8723au/core/rtw_xmit.c | 26 +--- > > 2 files changed, 22 insertions(+), 53 deletions(-) > > This looks fine to me. When these changes gets large, it may be better > to break them down into multiple patches as it's easier to debug if > there is a bug somewhere. > Changes in v2: - split it into three patches. Geliang Tang (3): staging: rtl8723au: core: rtw_recv: use list_first_entry_or_null() staging: rtl8723au: core: rtw_xmit: use list_first_entry_or_null() staging: rtl8723au: core: rtw_recv: use list_first_entry() drivers/staging/rtl8723au/core/rtw_recv.c | 47 +-- drivers/staging/rtl8723au/core/rtw_xmit.c | 26 ++--- 2 files changed, 21 insertions(+), 52 deletions(-) -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 3/3] staging: rtl8723au: core: rtw_recv: use list_first_entry()
Use list_first_entry() instead of container_of() to simplify the code. Signed-off-by: Geliang Tang Acked-by: Jes Sorensen --- drivers/staging/rtl8723au/core/rtw_recv.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c index a4dacc3..ceb4a07 100644 --- a/drivers/staging/rtl8723au/core/rtw_recv.c +++ b/drivers/staging/rtl8723au/core/rtw_recv.c @@ -1522,7 +1522,7 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter, struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter, struct rtw_queue *defrag_q) { - struct list_head *plist, *phead; + struct list_head *phead; u8 wlanhdr_offset; u8 curfragnum; struct recv_frame *pnfhdr, *ptmp; @@ -1534,8 +1534,7 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter, pfree_recv_queue = &adapter->recvpriv.free_recv_queue; phead = get_list_head(defrag_q); - plist = phead->next; - prframe = container_of(plist, struct recv_frame, list); + prframe = list_first_entry(phead, struct recv_frame, list); list_del_init(&prframe->list); skb = prframe->pkt; -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 1/3] staging: rtl8723au: core: rtw_recv: use list_first_entry_or_null()
Use list_first_entry_or_null() instead of list_empty() + container_of() to simplify the code. Signed-off-by: Geliang Tang Acked-by: Jes Sorensen --- drivers/staging/rtl8723au/core/rtw_recv.c | 42 --- 1 file changed, 11 insertions(+), 31 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c index 0a7741c..a4dacc3 100644 --- a/drivers/staging/rtl8723au/core/rtw_recv.c +++ b/drivers/staging/rtl8723au/core/rtw_recv.c @@ -104,21 +104,14 @@ void _rtw_free_recv_priv23a(struct recv_priv *precvpriv) struct recv_frame *rtw_alloc_recvframe23a(struct rtw_queue *pfree_recv_queue) { struct recv_frame *pframe; - struct list_head *plist, *phead; struct rtw_adapter *padapter; struct recv_priv *precvpriv; spin_lock_bh(&pfree_recv_queue->lock); - if (list_empty(&pfree_recv_queue->queue)) - pframe = NULL; - else { - phead = get_list_head(pfree_recv_queue); - - plist = phead->next; - - pframe = container_of(plist, struct recv_frame, list); - + pframe = list_first_entry_or_null(&pfree_recv_queue->queue, + struct recv_frame, list); + if (pframe) { list_del_init(&pframe->list); padapter = pframe->adapter; if (padapter) { @@ -247,21 +240,13 @@ struct recv_buf *rtw_dequeue_recvbuf23a (struct rtw_queue *queue) { unsigned long irqL; struct recv_buf *precvbuf; - struct list_head *plist, *phead; spin_lock_irqsave(&queue->lock, irqL); - if (list_empty(&queue->queue)) { - precvbuf = NULL; - } else { - phead = get_list_head(queue); - - plist = phead->next; - - precvbuf = container_of(plist, struct recv_buf, list); - + precvbuf = list_first_entry_or_null(&queue->queue, + struct recv_buf, list); + if (precvbuf) list_del_init(&precvbuf->list); - } spin_unlock_irqrestore(&queue->lock, irqL); @@ -1079,22 +1064,17 @@ static int validate_recv_ctrl_frame(struct rtw_adapter *padapter, if ((psta->state & WIFI_SLEEP_STATE) && (pstapriv->sta_dz_bitmap & CHKBIT(psta->aid))) { - struct list_head *xmitframe_plist, *xmitframe_phead; + struct list_head *xmitframe_phead; struct xmit_frame *pxmitframe; struct xmit_priv *pxmitpriv = &padapter->xmitpriv; spin_lock_bh(&pxmitpriv->lock); xmitframe_phead = get_list_head(&psta->sleep_q); - xmitframe_plist = xmitframe_phead->next; - - if (!list_empty(xmitframe_phead)) { - pxmitframe = container_of(xmitframe_plist, - struct xmit_frame, - list); - - xmitframe_plist = xmitframe_plist->next; - + pxmitframe = list_first_entry_or_null(xmitframe_phead, + struct xmit_frame, + list); + if (pxmitframe) { list_del_init(&pxmitframe->list); psta->sleepq_len--; -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 2/3] staging: rtl8723au: core: rtw_xmit: use list_first_entry_or_null()
Use list_first_entry_or_null() instead of list_empty() + container_of() to simplify the code. Signed-off-by: Geliang Tang Acked-by: Jes Sorensen --- drivers/staging/rtl8723au/core/rtw_xmit.c | 26 -- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_xmit.c b/drivers/staging/rtl8723au/core/rtw_xmit.c index b82b182..3de40cf 100644 --- a/drivers/staging/rtl8723au/core/rtw_xmit.c +++ b/drivers/staging/rtl8723au/core/rtw_xmit.c @@ -1443,24 +1443,18 @@ Must be very very cautious... */ static struct xmit_frame *rtw_alloc_xmitframe(struct xmit_priv *pxmitpriv) { - struct xmit_frame *pxframe = NULL; - struct list_head *plist, *phead; + struct xmit_frame *pxframe; struct rtw_queue *pfree_xmit_queue = &pxmitpriv->free_xmit_queue; spin_lock_bh(&pfree_xmit_queue->lock); - if (list_empty(&pfree_xmit_queue->queue)) { + pxframe = list_first_entry_or_null(&pfree_xmit_queue->queue, + struct xmit_frame, list); + if (!pxframe) { RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, "rtw_alloc_xmitframe:%d\n", pxmitpriv->free_xmitframe_cnt); - pxframe = NULL; } else { - phead = get_list_head(pfree_xmit_queue); - - plist = phead->next; - - pxframe = container_of(plist, struct xmit_frame, list); - list_del_init(&pxframe->list); pxmitpriv->free_xmitframe_cnt--; RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, @@ -1477,22 +1471,18 @@ static struct xmit_frame *rtw_alloc_xmitframe(struct xmit_priv *pxmitpriv) struct xmit_frame *rtw_alloc_xmitframe23a_ext(struct xmit_priv *pxmitpriv) { - struct xmit_frame *pxframe = NULL; - struct list_head *plist, *phead; + struct xmit_frame *pxframe; struct rtw_queue *queue = &pxmitpriv->free_xframe_ext_queue; spin_lock_bh(&queue->lock); - if (list_empty(&queue->queue)) { + pxframe = list_first_entry_or_null(&queue->queue, + struct xmit_frame, list); + if (!pxframe) { RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, "rtw_alloc_xmitframe23a_ext:%d\n", pxmitpriv->free_xframe_ext_cnt); - pxframe = NULL; } else { - phead = get_list_head(queue); - plist = phead->next; - pxframe = container_of(plist, struct xmit_frame, list); - list_del_init(&pxframe->list); pxmitpriv->free_xframe_ext_cnt--; RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rtl8723au: fix static checker warning
Fix the following static checker warning: drivers/staging/rtl8723au/core/rtw_sta_mgt.c:365 rtw_get_stainfo23a() error: potential NULL dereference 'psta'. Fixes: e280d71("staging: rtl8723au: use list_for_each_entry*()") Signed-off-by: Geliang Tang --- drivers/staging/rtl8723au/core/rtw_sta_mgt.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_sta_mgt.c b/drivers/staging/rtl8723au/core/rtw_sta_mgt.c index 22d857b..5f85ee0 100644 --- a/drivers/staging/rtl8723au/core/rtw_sta_mgt.c +++ b/drivers/staging/rtl8723au/core/rtw_sta_mgt.c @@ -346,7 +346,7 @@ void rtw_free_all_stainfo23a(struct rtw_adapter *padapter) struct sta_info *rtw_get_stainfo23a(struct sta_priv *pstapriv, const u8 *hwaddr) { struct list_head *phead; - struct sta_info *psta = NULL; + struct sta_info *pos, *psta = NULL; u32 index; const u8 *addr; @@ -362,7 +362,9 @@ struct sta_info *rtw_get_stainfo23a(struct sta_priv *pstapriv, const u8 *hwaddr) spin_lock_bh(&pstapriv->sta_hash_lock); phead = &pstapriv->sta_hash[index]; - list_for_each_entry(psta, phead, hash_list) { + list_for_each_entry(pos, phead, hash_list) { + psta = pos; + /* if found the matched address */ if (ether_addr_equal(psta->hwaddr, addr)) break; -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 4/4] staging: rtl8192u: r8192U_core: use kmalloc_array instead of kmalloc
On Sun, Feb 07, 2016 at 07:55:09PM -0800, Greg Kroah-Hartman wrote: > On Sun, Nov 08, 2015 at 10:17:54PM +0800, Geliang Tang wrote: > > Use kmalloc_array instead of kmalloc to allocate memory for an array. > > > > Signed-off-by: Geliang Tang > > --- > > drivers/staging/rtl8192u/r8192U_core.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/staging/rtl8192u/r8192U_core.c > > b/drivers/staging/rtl8192u/r8192U_core.c > > index e06864f..07a1447 100644 > > --- a/drivers/staging/rtl8192u/r8192U_core.c > > +++ b/drivers/staging/rtl8192u/r8192U_core.c > > @@ -1725,8 +1725,8 @@ static short rtl8192_usb_initendpoints(struct > > net_device *dev) > > { > > struct r8192_priv *priv = ieee80211_priv(dev); > > > > - priv->rx_urb = kmalloc(sizeof(struct urb *) * (MAX_RX_URB + 1), > > - GFP_KERNEL); > > + priv->rx_urb = kmalloc_array(MAX_RX_URB + 1, sizeof(struct urb *), > > +GFP_KERNEL); > > I don't see the benefit here with this change, do you? It is highly likely that there is a checkpatch warning "kmalloc with multiplies" here. But the checkpatch script does not report this warning, I think it is because MAX_RX_URB is a macro, and there is a '+1' after it. Therefore although it passes,I think it still should be deemed as a warning. So to use kmalloc_array here seems better. Thanks. - Geliang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rtl8723au: use list_first_entry*
Use list_first_entry*() instead of container_of() to simplify the code. Signed-off-by: Geliang Tang --- drivers/staging/rtl8723au/core/rtw_recv.c | 49 +-- drivers/staging/rtl8723au/core/rtw_xmit.c | 26 +--- 2 files changed, 22 insertions(+), 53 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c index 0a7741c..b095d09 100644 --- a/drivers/staging/rtl8723au/core/rtw_recv.c +++ b/drivers/staging/rtl8723au/core/rtw_recv.c @@ -104,21 +104,14 @@ void _rtw_free_recv_priv23a(struct recv_priv *precvpriv) struct recv_frame *rtw_alloc_recvframe23a(struct rtw_queue *pfree_recv_queue) { struct recv_frame *pframe; - struct list_head *plist, *phead; struct rtw_adapter *padapter; struct recv_priv *precvpriv; spin_lock_bh(&pfree_recv_queue->lock); - if (list_empty(&pfree_recv_queue->queue)) - pframe = NULL; - else { - phead = get_list_head(pfree_recv_queue); - - plist = phead->next; - - pframe = container_of(plist, struct recv_frame, list); - + pframe = list_first_entry_or_null(&pfree_recv_queue->queue, + struct recv_frame, list); + if (pframe) { list_del_init(&pframe->list); padapter = pframe->adapter; if (padapter) { @@ -243,25 +236,17 @@ int rtw_enqueue_recvbuf23a(struct recv_buf *precvbuf, struct rtw_queue *queue) return _SUCCESS; } -struct recv_buf *rtw_dequeue_recvbuf23a (struct rtw_queue *queue) +struct recv_buf *rtw_dequeue_recvbuf23a(struct rtw_queue *queue) { unsigned long irqL; struct recv_buf *precvbuf; - struct list_head *plist, *phead; spin_lock_irqsave(&queue->lock, irqL); - if (list_empty(&queue->queue)) { - precvbuf = NULL; - } else { - phead = get_list_head(queue); - - plist = phead->next; - - precvbuf = container_of(plist, struct recv_buf, list); - + precvbuf = list_first_entry_or_null(&queue->queue, + struct recv_buf, list); + if (precvbuf) list_del_init(&precvbuf->list); - } spin_unlock_irqrestore(&queue->lock, irqL); @@ -1079,22 +1064,17 @@ static int validate_recv_ctrl_frame(struct rtw_adapter *padapter, if ((psta->state & WIFI_SLEEP_STATE) && (pstapriv->sta_dz_bitmap & CHKBIT(psta->aid))) { - struct list_head *xmitframe_plist, *xmitframe_phead; + struct list_head *xmitframe_phead; struct xmit_frame *pxmitframe; struct xmit_priv *pxmitpriv = &padapter->xmitpriv; spin_lock_bh(&pxmitpriv->lock); xmitframe_phead = get_list_head(&psta->sleep_q); - xmitframe_plist = xmitframe_phead->next; - - if (!list_empty(xmitframe_phead)) { - pxmitframe = container_of(xmitframe_plist, - struct xmit_frame, - list); - - xmitframe_plist = xmitframe_plist->next; - + pxmitframe = list_first_entry_or_null(xmitframe_phead, + struct xmit_frame, + list); + if (pxmitframe) { list_del_init(&pxmitframe->list); psta->sleepq_len--; @@ -1542,7 +1522,7 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter, struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter, struct rtw_queue *defrag_q) { - struct list_head *plist, *phead; + struct list_head *phead; u8 wlanhdr_offset; u8 curfragnum; struct recv_frame *pnfhdr, *ptmp; @@ -1554,8 +1534,7 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter, pfree_recv_queue = &adapter->recvpriv.free_recv_queue; phead = get_list_head(defrag_q); - plist = phead->next; - prframe = container_of(plist, struct recv_frame, list); + prframe = list_first_entry(phead, struct recv_frame, list); list_del_init(&prframe->list); skb = prframe->pkt; diff --git a/drivers/staging/rtl8723au/core/rtw_xmit.c b/drivers/staging/rtl8723au/core/rtw_xmit.c index b82b182..3de40cf 100644 --- a/drivers/staging/rtl8723au/core/rtw_xmit.c +++ b/drivers/staging/rtl8723au/core/rtw_xmit
[PATCH v5 3/3] staging: rtl8723au: whitespace and blank line cleaning
This patch cleans whitespaces and blank lines involved with previous two patchs in this patch set. Signed-off-by: Geliang Tang --- drivers/staging/rtl8723au/core/rtw_ap.c | 33 +-- drivers/staging/rtl8723au/core/rtw_mlme.c | 10 --- drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 3 +-- drivers/staging/rtl8723au/core/rtw_recv.c | 15 +++ drivers/staging/rtl8723au/core/rtw_sta_mgt.c | 11 +--- drivers/staging/rtl8723au/core/rtw_xmit.c | 26 -- drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 8 -- 7 files changed, 12 insertions(+), 94 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_ap.c b/drivers/staging/rtl8723au/core/rtw_ap.c index 4ab3631..ce4b589 100644 --- a/drivers/staging/rtl8723au/core/rtw_ap.c +++ b/drivers/staging/rtl8723au/core/rtw_ap.c @@ -171,7 +171,7 @@ static u8 chk_sta_is_alive(struct sta_info *psta) return ret; } -void expire_timeout_chk23a(struct rtw_adapter *padapter) +void expire_timeout_chk23a(struct rtw_adapter *padapter) { struct list_head *phead; u8 updated = 0; @@ -182,12 +182,9 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter) int i; spin_lock_bh(&pstapriv->auth_list_lock); - phead = &pstapriv->auth_list; - /* check auth_queue */ list_for_each_entry_safe(psta, ptmp, phead, auth_list) { - if (psta->expire_to > 0) { psta->expire_to--; if (psta->expire_to == 0) { @@ -205,18 +202,13 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter) spin_lock_bh(&pstapriv->auth_list_lock); } } - } - spin_unlock_bh(&pstapriv->auth_list_lock); spin_lock_bh(&pstapriv->asoc_list_lock); - phead = &pstapriv->asoc_list; - /* check asoc_queue */ list_for_each_entry_safe(psta, ptmp, phead, asoc_list) { - if (chk_sta_is_alive(psta) || !psta->expire_to) { psta->expire_to = pstapriv->expire_to; psta->keep_alive_trycnt = 0; @@ -281,7 +273,6 @@ voidexpire_timeout_chk23a(struct rtw_adapter *padapter) } } } - spin_unlock_bh(&pstapriv->asoc_list_lock); if (chk_alive_num) { @@ -1071,11 +1062,8 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr) return -1; spin_lock_bh(&pacl_node_q->lock); - phead = get_list_head(pacl_node_q); - list_for_each_entry(paclnode, phead, list) { - if (!memcmp(paclnode->addr, addr, ETH_ALEN)) { if (paclnode->valid == true) { added = true; @@ -1084,7 +1072,6 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr) } } } - spin_unlock_bh(&pacl_node_q->lock); if (added) @@ -1127,11 +1114,8 @@ int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr) DBG_8723A("%s(acl_num =%d) = %pM\n", __func__, pacl_list->num, addr); spin_lock_bh(&pacl_node_q->lock); - phead = get_list_head(pacl_node_q); - list_for_each_entry_safe(paclnode, ptmp, phead, list) { - if (!memcmp(paclnode->addr, addr, ETH_ALEN)) { if (paclnode->valid) { paclnode->valid = false; @@ -1142,7 +1126,6 @@ int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr) } } } - spin_unlock_bh(&pacl_node_q->lock); DBG_8723A("%s, acl_num =%d\n", __func__, pacl_list->num); @@ -1355,12 +1338,9 @@ void associated_clients_update23a(struct rtw_adapter *padapter, u8 updated) struct sta_priv *pstapriv = &padapter->stapriv; spin_lock_bh(&pstapriv->asoc_list_lock); - phead = &pstapriv->asoc_list; - list_for_each_entry_safe(psta, ptmp, phead, asoc_list) VCS_update23a(padapter, psta); - spin_unlock_bh(&pstapriv->asoc_list_lock); } } @@ -1635,9 +1615,7 @@ int rtw_ap_inform_ch_switch23a(struct rtw_adapter *padapter, u8 new_ch, u8 ch_of spin_lock_bh(&pstapriv->asoc_list_lock); phead = &pstapriv->asoc_list; - list_for_each_entry(psta, phead, asoc_list) { - issue_action_spct_ch_switch23a(padapter, psta->hwaddr, new_ch, ch_offset); psta->expire_to = ((pstapriv->expire_to * 2) > 5) ? 5 : (pstapriv->expire_to * 2); } @@ -1667,9 +1645,7 @@ int
[PATCH v5 2/3] staging: rtl8723au: core: rtw_recv: remove useless codes
There are some useless codes in rtw_free_recvframe23a_queue() and recvframe_defrag(), so remove them. Signed-off-by: Geliang Tang Acked-by: Jes Sorensen --- drivers/staging/rtl8723au/core/rtw_recv.c | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c index 0b4593c..d1e0f65 100644 --- a/drivers/staging/rtl8723au/core/rtw_recv.c +++ b/drivers/staging/rtl8723au/core/rtw_recv.c @@ -195,12 +195,11 @@ using spinlock to protect static void rtw_free_recvframe23a_queue(struct rtw_queue *pframequeue) { struct recv_frame *hdr, *ptmp; - struct list_head *plist, *phead; + struct list_head *phead; spin_lock(&pframequeue->lock); phead = get_list_head(pframequeue); - plist = phead->next; list_for_each_entry_safe(hdr, ptmp, phead, list) rtw_free_recvframe23a(hdr); @@ -1547,7 +1546,7 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter, struct rtw_queue *defrag_q) { struct list_head *plist, *phead; - u8 *data, wlanhdr_offset; + u8 wlanhdr_offset; u8 curfragnum; struct recv_frame *pnfhdr, *ptmp; struct recv_frame *prframe, *pnextrframe; @@ -1576,10 +1575,6 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter, curfragnum++; - phead = get_list_head(defrag_q); - - data = prframe->pkt->data; - list_for_each_entry_safe(pnfhdr, ptmp, phead, list) { pnextrframe = (struct recv_frame *)pnfhdr; /* check the fragment sequence (2nd ~n fragment frame) */ -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v5 1/3] staging: rtl8723au: use list_for_each_entry*()
Use list_for_each_entry*() instead of list_for_each*() to simplify the code. Signed-off-by: Geliang Tang --- drivers/staging/rtl8723au/core/rtw_ap.c | 59 drivers/staging/rtl8723au/core/rtw_mlme.c | 28 -- drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 10 ++-- drivers/staging/rtl8723au/core/rtw_recv.c | 22 drivers/staging/rtl8723au/core/rtw_sta_mgt.c | 25 - drivers/staging/rtl8723au/core/rtw_xmit.c | 66 ++- drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 14 +++-- drivers/staging/rtl8723au/os_dep/usb_ops_linux.c | 9 ++-- 8 files changed, 95 insertions(+), 138 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_ap.c b/drivers/staging/rtl8723au/core/rtw_ap.c index 1aa9b26..4ab3631 100644 --- a/drivers/staging/rtl8723au/core/rtw_ap.c +++ b/drivers/staging/rtl8723au/core/rtw_ap.c @@ -173,9 +173,9 @@ static u8 chk_sta_is_alive(struct sta_info *psta) void expire_timeout_chk23a(struct rtw_adapter *padapter) { - struct list_head *phead, *plist, *ptmp; + struct list_head *phead; u8 updated = 0; - struct sta_info *psta; + struct sta_info *psta, *ptmp; struct sta_priv *pstapriv = &padapter->stapriv; u8 chk_alive_num = 0; struct sta_info *chk_alive_list[NUM_STA]; @@ -186,8 +186,7 @@ voidexpire_timeout_chk23a(struct rtw_adapter *padapter) phead = &pstapriv->auth_list; /* check auth_queue */ - list_for_each_safe(plist, ptmp, phead) { - psta = container_of(plist, struct sta_info, auth_list); + list_for_each_entry_safe(psta, ptmp, phead, auth_list) { if (psta->expire_to > 0) { psta->expire_to--; @@ -216,8 +215,7 @@ voidexpire_timeout_chk23a(struct rtw_adapter *padapter) phead = &pstapriv->asoc_list; /* check asoc_queue */ - list_for_each_safe(plist, ptmp, phead) { - psta = container_of(plist, struct sta_info, asoc_list); + list_for_each_entry_safe(psta, ptmp, phead, asoc_list) { if (chk_sta_is_alive(psta) || !psta->expire_to) { psta->expire_to = pstapriv->expire_to; @@ -1059,7 +1057,7 @@ void rtw_set_macaddr_acl23a(struct rtw_adapter *padapter, int mode) int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr) { - struct list_head *plist, *phead; + struct list_head *phead; u8 added = false; int i, ret = 0; struct rtw_wlan_acl_node *paclnode; @@ -1076,8 +1074,7 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr) phead = get_list_head(pacl_node_q); - list_for_each(plist, phead) { - paclnode = container_of(plist, struct rtw_wlan_acl_node, list); + list_for_each_entry(paclnode, phead, list) { if (!memcmp(paclnode->addr, addr, ETH_ALEN)) { if (paclnode->valid == true) { @@ -1121,8 +1118,8 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr) int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr) { - struct list_head *plist, *phead, *ptmp; - struct rtw_wlan_acl_node *paclnode; + struct list_head *phead; + struct rtw_wlan_acl_node *paclnode, *ptmp; struct sta_priv *pstapriv = &padapter->stapriv; struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; struct rtw_queue *pacl_node_q = &pacl_list->acl_node_q; @@ -1133,8 +1130,7 @@ int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr) phead = get_list_head(pacl_node_q); - list_for_each_safe(plist, ptmp, phead) { - paclnode = container_of(plist, struct rtw_wlan_acl_node, list); + list_for_each_entry_safe(paclnode, ptmp, phead, list) { if (!memcmp(paclnode->addr, addr, ETH_ALEN)) { if (paclnode->valid) { @@ -1354,19 +1350,16 @@ void associated_clients_update23a(struct rtw_adapter *padapter, u8 updated) { /* update associated stations cap. */ if (updated == true) { - struct list_head *phead, *plist, *ptmp; - struct sta_info *psta; + struct list_head *phead; + struct sta_info *psta, *ptmp; struct sta_priv *pstapriv = &padapter->stapriv; spin_lock_bh(&pstapriv->asoc_list_lock); phead = &pstapriv->asoc_list; - list_for_each_safe(plist, ptmp, phead) { - psta = container_of(plist, struct sta_info, asoc_list); - + list_for_each_entry_safe(psta, ptmp, phead, asoc_list) VCS_update23a(padapter, psta); - } spin_unlock_bh(&pstapriv->asoc_list_lock); } @@ -1627,7
[PATCH v5 0/3] staging: rtl8723au: use list_for_each_entry*() and cleaning
On Wed, Feb 17, 2016 at 12:28:33PM -0500, Jes Sorensen wrote: > kbuild test robot writes: > > Hi Geliang, > > > > [auto build test ERROR on staging/staging-testing] > > [also build test ERROR on v4.5-rc4 next-20160217] > > [if your patch is applied to the wrong git tree, please drop us a note to > > help improving the system] > > > > url: > > https://github.com/0day-ci/linux/commits/Geliang-Tang/staging-rtl8723au-use-list_for_each_entry/20160217-220638 > > config: i386-randconfig-s1-201607 (attached as .config) > > reproduce: > > # save the attached .config to linux build tree > > make ARCH=i386 > > > > Note: the > > linux-review/Geliang-Tang/staging-rtl8723au-use-list_for_each_entry/20160217-220638 > > HEAD 495811a52aba181af76c3baf57da3d81a79c2fe8 builds fine. > > It only hurts bisectibility. > > > > All errors (new ones prefixed by >>): > > > >drivers/staging/rtl8723au/core/rtw_recv.c: In function > > 'rtw_free_recvframe23a_queue': > >>> drivers/staging/rtl8723au/core/rtw_recv.c:203:2: error: 'plist' > >>> undeclared (first use in this function) > > plist = phead->next; > > ^ > > This doesn't work, you cannot break interim builds. Your patch 2 needs > to go before patch 1, and you must always check that they compile for > each patch you apply. > > NACK Sorry for the trouble caused. I updated my patchs to fix this problem. - Geliang This patch set uses list_for_each_entry*() instead of list_for_each*(), removes useless codes, and cleans whitespaces and blank lines. Changes in v5: - fix build error. Changes in v4: - revise the patchs as Jes suggested. Changes in v3: - split it into three patches. Changes in v2: - drop the coding style fixing in v1. Geliang Tang (3): staging: rtl8723au: use list_for_each_entry*() staging: rtl8723au: core: rtw_recv: remove useless codes staging: rtl8723au: whitespace and blank line cleaning drivers/staging/rtl8723au/core/rtw_ap.c | 92 ++- drivers/staging/rtl8723au/core/rtw_mlme.c | 38 +++--- drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 13 ++-- drivers/staging/rtl8723au/core/rtw_recv.c | 42 --- drivers/staging/rtl8723au/core/rtw_sta_mgt.c | 36 +++-- drivers/staging/rtl8723au/core/rtw_xmit.c | 90 -- drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 22 ++ drivers/staging/rtl8723au/os_dep/usb_ops_linux.c | 9 +-- 8 files changed, 106 insertions(+), 236 deletions(-) -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 2/3] staging: rtl8723au: core: rtw_recv: remove useless codes
There are some useless codes in rtw_free_recvframe23a_queue() and recvframe_defrag(), so remove them. Signed-off-by: Geliang Tang Acked-by: Jes Sorensen --- drivers/staging/rtl8723au/core/rtw_recv.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c index bd93e76..d1e0f65 100644 --- a/drivers/staging/rtl8723au/core/rtw_recv.c +++ b/drivers/staging/rtl8723au/core/rtw_recv.c @@ -200,7 +200,6 @@ static void rtw_free_recvframe23a_queue(struct rtw_queue *pframequeue) spin_lock(&pframequeue->lock); phead = get_list_head(pframequeue); - plist = phead->next; list_for_each_entry_safe(hdr, ptmp, phead, list) rtw_free_recvframe23a(hdr); @@ -1547,7 +1546,7 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter, struct rtw_queue *defrag_q) { struct list_head *plist, *phead; - u8 *data, wlanhdr_offset; + u8 wlanhdr_offset; u8 curfragnum; struct recv_frame *pnfhdr, *ptmp; struct recv_frame *prframe, *pnextrframe; @@ -1576,10 +1575,6 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter, curfragnum++; - phead = get_list_head(defrag_q); - - data = prframe->pkt->data; - list_for_each_entry_safe(pnfhdr, ptmp, phead, list) { pnextrframe = (struct recv_frame *)pnfhdr; /* check the fragment sequence (2nd ~n fragment frame) */ -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 3/3] staging: rtl8723au: whitespace and blank line cleaning
This patch cleans whitespaces and blank lines involved with previous two patchs in this patch set. Signed-off-by: Geliang Tang --- drivers/staging/rtl8723au/core/rtw_ap.c | 33 +-- drivers/staging/rtl8723au/core/rtw_mlme.c | 10 --- drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 3 +-- drivers/staging/rtl8723au/core/rtw_recv.c | 15 +++ drivers/staging/rtl8723au/core/rtw_sta_mgt.c | 11 +--- drivers/staging/rtl8723au/core/rtw_xmit.c | 26 -- drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 8 -- 7 files changed, 12 insertions(+), 94 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_ap.c b/drivers/staging/rtl8723au/core/rtw_ap.c index 4ab3631..ce4b589 100644 --- a/drivers/staging/rtl8723au/core/rtw_ap.c +++ b/drivers/staging/rtl8723au/core/rtw_ap.c @@ -171,7 +171,7 @@ static u8 chk_sta_is_alive(struct sta_info *psta) return ret; } -void expire_timeout_chk23a(struct rtw_adapter *padapter) +void expire_timeout_chk23a(struct rtw_adapter *padapter) { struct list_head *phead; u8 updated = 0; @@ -182,12 +182,9 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter) int i; spin_lock_bh(&pstapriv->auth_list_lock); - phead = &pstapriv->auth_list; - /* check auth_queue */ list_for_each_entry_safe(psta, ptmp, phead, auth_list) { - if (psta->expire_to > 0) { psta->expire_to--; if (psta->expire_to == 0) { @@ -205,18 +202,13 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter) spin_lock_bh(&pstapriv->auth_list_lock); } } - } - spin_unlock_bh(&pstapriv->auth_list_lock); spin_lock_bh(&pstapriv->asoc_list_lock); - phead = &pstapriv->asoc_list; - /* check asoc_queue */ list_for_each_entry_safe(psta, ptmp, phead, asoc_list) { - if (chk_sta_is_alive(psta) || !psta->expire_to) { psta->expire_to = pstapriv->expire_to; psta->keep_alive_trycnt = 0; @@ -281,7 +273,6 @@ voidexpire_timeout_chk23a(struct rtw_adapter *padapter) } } } - spin_unlock_bh(&pstapriv->asoc_list_lock); if (chk_alive_num) { @@ -1071,11 +1062,8 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr) return -1; spin_lock_bh(&pacl_node_q->lock); - phead = get_list_head(pacl_node_q); - list_for_each_entry(paclnode, phead, list) { - if (!memcmp(paclnode->addr, addr, ETH_ALEN)) { if (paclnode->valid == true) { added = true; @@ -1084,7 +1072,6 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr) } } } - spin_unlock_bh(&pacl_node_q->lock); if (added) @@ -1127,11 +1114,8 @@ int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr) DBG_8723A("%s(acl_num =%d) = %pM\n", __func__, pacl_list->num, addr); spin_lock_bh(&pacl_node_q->lock); - phead = get_list_head(pacl_node_q); - list_for_each_entry_safe(paclnode, ptmp, phead, list) { - if (!memcmp(paclnode->addr, addr, ETH_ALEN)) { if (paclnode->valid) { paclnode->valid = false; @@ -1142,7 +1126,6 @@ int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr) } } } - spin_unlock_bh(&pacl_node_q->lock); DBG_8723A("%s, acl_num =%d\n", __func__, pacl_list->num); @@ -1355,12 +1338,9 @@ void associated_clients_update23a(struct rtw_adapter *padapter, u8 updated) struct sta_priv *pstapriv = &padapter->stapriv; spin_lock_bh(&pstapriv->asoc_list_lock); - phead = &pstapriv->asoc_list; - list_for_each_entry_safe(psta, ptmp, phead, asoc_list) VCS_update23a(padapter, psta); - spin_unlock_bh(&pstapriv->asoc_list_lock); } } @@ -1635,9 +1615,7 @@ int rtw_ap_inform_ch_switch23a(struct rtw_adapter *padapter, u8 new_ch, u8 ch_of spin_lock_bh(&pstapriv->asoc_list_lock); phead = &pstapriv->asoc_list; - list_for_each_entry(psta, phead, asoc_list) { - issue_action_spct_ch_switch23a(padapter, psta->hwaddr, new_ch, ch_offset); psta->expire_to = ((pstapriv->expire_to * 2) > 5) ? 5 : (pstapriv->expire_to * 2); } @@ -1667,9 +1645,7 @@ int
[PATCH v4 0/3] staging: rtl8723au: use list_for_each_entry*() and cleaning
This patch set uses list_for_each_entry*() instead of list_for_each*(), removes useless codes, and cleans whitespaces and blank lines. Changes in v4: - revise the patchs as Jes suggested. Changes in v3: - split it into three patches. Changes in v2: - drop the coding style fixing in v1. Geliang Tang (3): staging: rtl8723au: use list_for_each_entry*() staging: rtl8723au: core: rtw_recv: remove useless codes staging: rtl8723au: whitespace and blank line cleaning drivers/staging/rtl8723au/core/rtw_ap.c | 92 ++- drivers/staging/rtl8723au/core/rtw_mlme.c | 38 +++--- drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 13 ++-- drivers/staging/rtl8723au/core/rtw_recv.c | 42 --- drivers/staging/rtl8723au/core/rtw_sta_mgt.c | 36 +++-- drivers/staging/rtl8723au/core/rtw_xmit.c | 90 -- drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 22 ++ drivers/staging/rtl8723au/os_dep/usb_ops_linux.c | 9 +-- 8 files changed, 106 insertions(+), 236 deletions(-) -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4 1/3] staging: rtl8723au: use list_for_each_entry*()
Use list_for_each_entry*() instead of list_for_each*() to simplify the code. Signed-off-by: Geliang Tang --- drivers/staging/rtl8723au/core/rtw_ap.c | 59 drivers/staging/rtl8723au/core/rtw_mlme.c | 28 -- drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 10 ++-- drivers/staging/rtl8723au/core/rtw_recv.c | 22 drivers/staging/rtl8723au/core/rtw_sta_mgt.c | 25 - drivers/staging/rtl8723au/core/rtw_xmit.c | 66 ++- drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 14 +++-- drivers/staging/rtl8723au/os_dep/usb_ops_linux.c | 9 ++-- 8 files changed, 95 insertions(+), 138 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_ap.c b/drivers/staging/rtl8723au/core/rtw_ap.c index 1aa9b26..4ab3631 100644 --- a/drivers/staging/rtl8723au/core/rtw_ap.c +++ b/drivers/staging/rtl8723au/core/rtw_ap.c @@ -173,9 +173,9 @@ static u8 chk_sta_is_alive(struct sta_info *psta) void expire_timeout_chk23a(struct rtw_adapter *padapter) { - struct list_head *phead, *plist, *ptmp; + struct list_head *phead; u8 updated = 0; - struct sta_info *psta; + struct sta_info *psta, *ptmp; struct sta_priv *pstapriv = &padapter->stapriv; u8 chk_alive_num = 0; struct sta_info *chk_alive_list[NUM_STA]; @@ -186,8 +186,7 @@ voidexpire_timeout_chk23a(struct rtw_adapter *padapter) phead = &pstapriv->auth_list; /* check auth_queue */ - list_for_each_safe(plist, ptmp, phead) { - psta = container_of(plist, struct sta_info, auth_list); + list_for_each_entry_safe(psta, ptmp, phead, auth_list) { if (psta->expire_to > 0) { psta->expire_to--; @@ -216,8 +215,7 @@ voidexpire_timeout_chk23a(struct rtw_adapter *padapter) phead = &pstapriv->asoc_list; /* check asoc_queue */ - list_for_each_safe(plist, ptmp, phead) { - psta = container_of(plist, struct sta_info, asoc_list); + list_for_each_entry_safe(psta, ptmp, phead, asoc_list) { if (chk_sta_is_alive(psta) || !psta->expire_to) { psta->expire_to = pstapriv->expire_to; @@ -1059,7 +1057,7 @@ void rtw_set_macaddr_acl23a(struct rtw_adapter *padapter, int mode) int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr) { - struct list_head *plist, *phead; + struct list_head *phead; u8 added = false; int i, ret = 0; struct rtw_wlan_acl_node *paclnode; @@ -1076,8 +1074,7 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr) phead = get_list_head(pacl_node_q); - list_for_each(plist, phead) { - paclnode = container_of(plist, struct rtw_wlan_acl_node, list); + list_for_each_entry(paclnode, phead, list) { if (!memcmp(paclnode->addr, addr, ETH_ALEN)) { if (paclnode->valid == true) { @@ -1121,8 +1118,8 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr) int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr) { - struct list_head *plist, *phead, *ptmp; - struct rtw_wlan_acl_node *paclnode; + struct list_head *phead; + struct rtw_wlan_acl_node *paclnode, *ptmp; struct sta_priv *pstapriv = &padapter->stapriv; struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; struct rtw_queue *pacl_node_q = &pacl_list->acl_node_q; @@ -1133,8 +1130,7 @@ int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr) phead = get_list_head(pacl_node_q); - list_for_each_safe(plist, ptmp, phead) { - paclnode = container_of(plist, struct rtw_wlan_acl_node, list); + list_for_each_entry_safe(paclnode, ptmp, phead, list) { if (!memcmp(paclnode->addr, addr, ETH_ALEN)) { if (paclnode->valid) { @@ -1354,19 +1350,16 @@ void associated_clients_update23a(struct rtw_adapter *padapter, u8 updated) { /* update associated stations cap. */ if (updated == true) { - struct list_head *phead, *plist, *ptmp; - struct sta_info *psta; + struct list_head *phead; + struct sta_info *psta, *ptmp; struct sta_priv *pstapriv = &padapter->stapriv; spin_lock_bh(&pstapriv->asoc_list_lock); phead = &pstapriv->asoc_list; - list_for_each_safe(plist, ptmp, phead) { - psta = container_of(plist, struct sta_info, asoc_list); - + list_for_each_entry_safe(psta, ptmp, phead, asoc_list) VCS_update23a(padapter, psta); - } spin_unlock_bh(&pstapriv->asoc_list_lock); } @@ -1627,7
[PATCH v3 1/3] staging: rtl8723au: use list_for_each_entry*()
Use list_for_each_entry*() instead of list_for_each*() to simplify the code. Signed-off-by: Geliang Tang --- Changes in v3: - split it into three patches. Changes in v2: - drop the coding style fixing in v1. --- drivers/staging/rtl8723au/core/rtw_ap.c | 55 --- drivers/staging/rtl8723au/core/rtw_mlme.c | 26 - drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 10 ++-- drivers/staging/rtl8723au/core/rtw_recv.c | 22 drivers/staging/rtl8723au/core/rtw_sta_mgt.c | 25 - drivers/staging/rtl8723au/core/rtw_xmit.c | 64 ++- drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 14 +++-- drivers/staging/rtl8723au/os_dep/usb_ops_linux.c | 9 ++-- 8 files changed, 96 insertions(+), 129 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_ap.c b/drivers/staging/rtl8723au/core/rtw_ap.c index 1aa9b26..4bcd617 100644 --- a/drivers/staging/rtl8723au/core/rtw_ap.c +++ b/drivers/staging/rtl8723au/core/rtw_ap.c @@ -173,9 +173,9 @@ static u8 chk_sta_is_alive(struct sta_info *psta) void expire_timeout_chk23a(struct rtw_adapter *padapter) { - struct list_head *phead, *plist, *ptmp; + struct list_head *phead; u8 updated = 0; - struct sta_info *psta; + struct sta_info *psta, *ptmp; struct sta_priv *pstapriv = &padapter->stapriv; u8 chk_alive_num = 0; struct sta_info *chk_alive_list[NUM_STA]; @@ -186,8 +186,7 @@ voidexpire_timeout_chk23a(struct rtw_adapter *padapter) phead = &pstapriv->auth_list; /* check auth_queue */ - list_for_each_safe(plist, ptmp, phead) { - psta = container_of(plist, struct sta_info, auth_list); + list_for_each_entry_safe(psta, ptmp, phead, auth_list) { if (psta->expire_to > 0) { psta->expire_to--; @@ -216,8 +215,7 @@ voidexpire_timeout_chk23a(struct rtw_adapter *padapter) phead = &pstapriv->asoc_list; /* check asoc_queue */ - list_for_each_safe(plist, ptmp, phead) { - psta = container_of(plist, struct sta_info, asoc_list); + list_for_each_entry_safe(psta, ptmp, phead, asoc_list) { if (chk_sta_is_alive(psta) || !psta->expire_to) { psta->expire_to = pstapriv->expire_to; @@ -1059,7 +1057,7 @@ void rtw_set_macaddr_acl23a(struct rtw_adapter *padapter, int mode) int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr) { - struct list_head *plist, *phead; + struct list_head *phead; u8 added = false; int i, ret = 0; struct rtw_wlan_acl_node *paclnode; @@ -1076,8 +1074,7 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr) phead = get_list_head(pacl_node_q); - list_for_each(plist, phead) { - paclnode = container_of(plist, struct rtw_wlan_acl_node, list); + list_for_each_entry(paclnode, phead, list) { if (!memcmp(paclnode->addr, addr, ETH_ALEN)) { if (paclnode->valid == true) { @@ -1121,8 +1118,8 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr) int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr) { - struct list_head *plist, *phead, *ptmp; - struct rtw_wlan_acl_node *paclnode; + struct list_head *phead; + struct rtw_wlan_acl_node *paclnode, *ptmp; struct sta_priv *pstapriv = &padapter->stapriv; struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; struct rtw_queue *pacl_node_q = &pacl_list->acl_node_q; @@ -1133,8 +1130,7 @@ int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr) phead = get_list_head(pacl_node_q); - list_for_each_safe(plist, ptmp, phead) { - paclnode = container_of(plist, struct rtw_wlan_acl_node, list); + list_for_each_entry_safe(paclnode, ptmp, phead, list) { if (!memcmp(paclnode->addr, addr, ETH_ALEN)) { if (paclnode->valid) { @@ -1354,16 +1350,15 @@ void associated_clients_update23a(struct rtw_adapter *padapter, u8 updated) { /* update associated stations cap. */ if (updated == true) { - struct list_head *phead, *plist, *ptmp; - struct sta_info *psta; + struct list_head *phead; + struct sta_info *psta, *ptmp; struct sta_priv *pstapriv = &padapter->stapriv; spin_lock_bh(&pstapriv->asoc_list_lock); phead = &pstapriv->asoc_list; - list_for_each_safe(plist, ptmp, phead) { - psta = container_of(plist, struct sta_info, asoc_list); + list_for_each_entry_safe(psta, ptmp, phead, asoc_list) { VCS_update23a(padapter, psta); }
[PATCH v3 3/3] staging: rtl8723au: whitespace and blank line cleaning
This patch cleans whitespaces and blank lines surrounding list_for_each_entry*(). Signed-off-by: Geliang Tang --- Changes in v3: - split it into three patches. Changes in v2: - drop the coding style fixing in v1. --- drivers/staging/rtl8723au/core/rtw_ap.c | 41 ++- drivers/staging/rtl8723au/core/rtw_mlme.c | 14 +--- drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 3 +- drivers/staging/rtl8723au/core/rtw_recv.c | 18 +++--- drivers/staging/rtl8723au/core/rtw_sta_mgt.c | 11 +- drivers/staging/rtl8723au/core/rtw_xmit.c | 30 - drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 8 - 7 files changed, 17 insertions(+), 108 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_ap.c b/drivers/staging/rtl8723au/core/rtw_ap.c index 4bcd617..ce4b589 100644 --- a/drivers/staging/rtl8723au/core/rtw_ap.c +++ b/drivers/staging/rtl8723au/core/rtw_ap.c @@ -171,7 +171,7 @@ static u8 chk_sta_is_alive(struct sta_info *psta) return ret; } -void expire_timeout_chk23a(struct rtw_adapter *padapter) +void expire_timeout_chk23a(struct rtw_adapter *padapter) { struct list_head *phead; u8 updated = 0; @@ -182,12 +182,9 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter) int i; spin_lock_bh(&pstapriv->auth_list_lock); - phead = &pstapriv->auth_list; - /* check auth_queue */ list_for_each_entry_safe(psta, ptmp, phead, auth_list) { - if (psta->expire_to > 0) { psta->expire_to--; if (psta->expire_to == 0) { @@ -205,18 +202,13 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter) spin_lock_bh(&pstapriv->auth_list_lock); } } - } - spin_unlock_bh(&pstapriv->auth_list_lock); spin_lock_bh(&pstapriv->asoc_list_lock); - phead = &pstapriv->asoc_list; - /* check asoc_queue */ list_for_each_entry_safe(psta, ptmp, phead, asoc_list) { - if (chk_sta_is_alive(psta) || !psta->expire_to) { psta->expire_to = pstapriv->expire_to; psta->keep_alive_trycnt = 0; @@ -281,7 +273,6 @@ voidexpire_timeout_chk23a(struct rtw_adapter *padapter) } } } - spin_unlock_bh(&pstapriv->asoc_list_lock); if (chk_alive_num) { @@ -1071,11 +1062,8 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr) return -1; spin_lock_bh(&pacl_node_q->lock); - phead = get_list_head(pacl_node_q); - list_for_each_entry(paclnode, phead, list) { - if (!memcmp(paclnode->addr, addr, ETH_ALEN)) { if (paclnode->valid == true) { added = true; @@ -1084,7 +1072,6 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr) } } } - spin_unlock_bh(&pacl_node_q->lock); if (added) @@ -1127,11 +1114,8 @@ int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr) DBG_8723A("%s(acl_num =%d) = %pM\n", __func__, pacl_list->num, addr); spin_lock_bh(&pacl_node_q->lock); - phead = get_list_head(pacl_node_q); - list_for_each_entry_safe(paclnode, ptmp, phead, list) { - if (!memcmp(paclnode->addr, addr, ETH_ALEN)) { if (paclnode->valid) { paclnode->valid = false; @@ -1142,7 +1126,6 @@ int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr) } } } - spin_unlock_bh(&pacl_node_q->lock); DBG_8723A("%s, acl_num =%d\n", __func__, pacl_list->num); @@ -1355,14 +1338,9 @@ void associated_clients_update23a(struct rtw_adapter *padapter, u8 updated) struct sta_priv *pstapriv = &padapter->stapriv; spin_lock_bh(&pstapriv->asoc_list_lock); - phead = &pstapriv->asoc_list; - - list_for_each_entry_safe(psta, ptmp, phead, asoc_list) { - + list_for_each_entry_safe(psta, ptmp, phead, asoc_list) VCS_update23a(padapter, psta); - } - spin_unlock_bh(&pstapriv->asoc_list_lock); } } @@ -1637,9 +1615,7 @@ int rtw_ap_inform_ch_switch23a(struct rtw_adapter *padapter, u8 new_ch, u8 ch_of spin_lock_bh(&pstapriv->asoc_list_lock); phead = &pstapriv->asoc_list; - list_for_each_entry(psta, phead, asoc_list) { - issue_action_spct_ch_switch23a(padapter, psta->hwaddr, new_c
[PATCH v3 2/3] staging: rtl8723au: core: rtw_recv: remove useless codes
There are some useless codes in rtw_free_recvframe23a_queue() and recvframe_defrag(), so remove them. Signed-off-by: Geliang Tang --- Changes in v3: - split it into three patches. Changes in v2: - drop the coding style fixing in v1. --- drivers/staging/rtl8723au/core/rtw_recv.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c index 18b7d03..b36bc6b 100644 --- a/drivers/staging/rtl8723au/core/rtw_recv.c +++ b/drivers/staging/rtl8723au/core/rtw_recv.c @@ -201,7 +201,6 @@ static void rtw_free_recvframe23a_queue(struct rtw_queue *pframequeue) spin_lock(&pframequeue->lock); phead = get_list_head(pframequeue); - plist = phead->next; list_for_each_entry_safe(hdr, ptmp, phead, list) { rtw_free_recvframe23a(hdr); @@ -1567,7 +1566,7 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter, struct rtw_queue *defrag_q) { struct list_head *plist, *phead; - u8 *data, wlanhdr_offset; + u8 wlanhdr_offset; u8 curfragnum; struct recv_frame *pnfhdr, *ptmp; struct recv_frame *prframe, *pnextrframe; @@ -1596,10 +1595,6 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter, curfragnum++; - phead = get_list_head(defrag_q); - - data = prframe->pkt->data; - list_for_each_entry_safe(pnfhdr, ptmp, phead, list) { pnextrframe = (struct recv_frame *)pnfhdr; /* check the fragment sequence (2nd ~n fragment frame) */ -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rtl8712: use list_first_entry_or_null()
Use list_first_entry_or_null() instead of list_empty() + LIST_CONTAINOR() to simplify the code. Signed-off-by: Geliang Tang --- drivers/staging/rtl8712/rtl871x_cmd.c | 13 +--- drivers/staging/rtl8712/rtl871x_mlme.c| 15 +++--- drivers/staging/rtl8712/rtl871x_recv.c| 12 --- drivers/staging/rtl8712/rtl871x_sta_mgt.c | 16 +++ drivers/staging/rtl8712/rtl871x_xmit.c| 33 +++ 5 files changed, 34 insertions(+), 55 deletions(-) diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c index 562a102..5875677 100644 --- a/drivers/staging/rtl8712/rtl871x_cmd.c +++ b/drivers/staging/rtl8712/rtl871x_cmd.c @@ -136,15 +136,12 @@ static struct cmd_obj *_dequeue_cmd(struct __queue *queue) unsigned long irqL; struct cmd_obj *obj; - spin_lock_irqsave(&(queue->lock), irqL); - if (list_empty(&(queue->queue))) { - obj = NULL; - } else { - obj = LIST_CONTAINOR(queue->queue.next, -struct cmd_obj, list); + spin_lock_irqsave(&queue->lock, irqL); + obj = list_first_entry_or_null(&queue->queue, + struct cmd_obj, list); + if (obj) list_del_init(&obj->list); - } - spin_unlock_irqrestore(&(queue->lock), irqL); + spin_unlock_irqrestore(&queue->lock, irqL); return obj; } diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c index 04f727f..1b022db 100644 --- a/drivers/staging/rtl8712/rtl871x_mlme.c +++ b/drivers/staging/rtl8712/rtl871x_mlme.c @@ -87,16 +87,15 @@ struct wlan_network *_r8712_alloc_network(struct mlme_priv *pmlmepriv) unsigned long irqL; struct wlan_network *pnetwork; struct __queue *free_queue = &pmlmepriv->free_bss_pool; - struct list_head *plist = NULL; - if (list_empty(&free_queue->queue)) - return NULL; spin_lock_irqsave(&free_queue->lock, irqL); - plist = free_queue->queue.next; - pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list); - list_del_init(&pnetwork->list); - pnetwork->last_scanned = jiffies; - pmlmepriv->num_of_scanned++; + pnetwork = list_first_entry_or_null(&free_queue->queue, + struct wlan_network, list); + if (pnetwork) { + list_del_init(&pnetwork->list); + pnetwork->last_scanned = jiffies; + pmlmepriv->num_of_scanned++; + } spin_unlock_irqrestore(&free_queue->lock, irqL); return pnetwork; } diff --git a/drivers/staging/rtl8712/rtl871x_recv.c b/drivers/staging/rtl8712/rtl871x_recv.c index 4ff5301..8f040da 100644 --- a/drivers/staging/rtl8712/rtl871x_recv.c +++ b/drivers/staging/rtl8712/rtl871x_recv.c @@ -103,21 +103,17 @@ void _r8712_free_recv_priv(struct recv_priv *precvpriv) r8712_free_recv_priv(precvpriv); } -union recv_frame *r8712_alloc_recvframe(struct __queue *pfree_recv_queue) +union recv_frame *r8712_alloc_recvframe(struct __queue *pfree_recv_queue) { unsigned long irqL; union recv_frame *precvframe; - struct list_head *plist, *phead; struct _adapter *padapter; struct recv_priv *precvpriv; spin_lock_irqsave(&pfree_recv_queue->lock, irqL); - if (list_empty(&pfree_recv_queue->queue)) { - precvframe = NULL; - } else { - phead = &pfree_recv_queue->queue; - plist = phead->next; - precvframe = LIST_CONTAINOR(plist, union recv_frame, u); + precvframe = list_first_entry_or_null(&pfree_recv_queue->queue, + union recv_frame, u.hdr.list); + if (precvframe) { list_del_init(&precvframe->u.hdr.list); padapter = precvframe->u.hdr.adapter; if (padapter != NULL) { diff --git a/drivers/staging/rtl8712/rtl871x_sta_mgt.c b/drivers/staging/rtl8712/rtl871x_sta_mgt.c index 162e61c..659cebc 100644 --- a/drivers/staging/rtl8712/rtl871x_sta_mgt.c +++ b/drivers/staging/rtl8712/rtl871x_sta_mgt.c @@ -116,13 +116,11 @@ struct sta_info *r8712_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) unsigned long flags; pfree_sta_queue = &pstapriv->free_sta_queue; - spin_lock_irqsave(&(pfree_sta_queue->lock), flags); - if (list_empty(&pfree_sta_queue->queue)) { - psta = NULL; - } else { - psta = LIST_CONTAINOR(pfree_sta_queue->queue.next, - struct sta_info, list); - list_del_init(&(psta->list)); + spin_lo
[PATCH] staging: rtl8188eu: use list_first_entry_or_null()
Use list_first_entry_or_null() instead of list_empty() + container_of() to simplify the code. Signed-off-by: Geliang Tang --- drivers/staging/rtl8188eu/core/rtw_cmd.c | 12 +--- drivers/staging/rtl8188eu/core/rtw_mlme.c| 19 +++ drivers/staging/rtl8188eu/core/rtw_recv.c| 15 ++--- drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 23 +++- drivers/staging/rtl8188eu/core/rtw_xmit.c| 84 5 files changed, 48 insertions(+), 105 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c index 433b926..1de7929 100644 --- a/drivers/staging/rtl8188eu/core/rtw_cmd.c +++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c @@ -69,23 +69,17 @@ exit: return _SUCCESS; } -struct cmd_obj *rtw_dequeue_cmd(struct __queue *queue) +struct cmd_obj *rtw_dequeue_cmd(struct __queue *queue) { unsigned long irqL; struct cmd_obj *obj; - spin_lock_irqsave(&queue->lock, irqL); - if (list_empty(&(queue->queue))) { - obj = NULL; - } else { - obj = container_of((&queue->queue)->next, struct cmd_obj, list); + obj = list_first_entry_or_null(&queue->queue, struct cmd_obj, list); + if (obj) list_del_init(&obj->list); - } - spin_unlock_irqrestore(&queue->lock, irqL); - return obj; } diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c b/drivers/staging/rtl8188eu/core/rtw_mlme.c index abab854..9c2e659 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c @@ -128,25 +128,22 @@ void rtw_free_mlme_priv(struct mlme_priv *pmlmepriv) } } -struct wlan_network *_rtw_alloc_network(struct mlme_priv *pmlmepriv)/* _queue *free_queue) */ +struct wlan_network *_rtw_alloc_network(struct mlme_priv *pmlmepriv) + /* _queue *free_queue) */ { - struct wlan_network*pnetwork; + struct wlan_network *pnetwork; struct __queue *free_queue = &pmlmepriv->free_bss_pool; - struct list_head *plist = NULL; spin_lock_bh(&free_queue->lock); - - if (list_empty(&free_queue->queue)) { - pnetwork = NULL; + pnetwork = list_first_entry_or_null(&free_queue->queue, + struct wlan_network, list); + if (!pnetwork) goto exit; - } - plist = free_queue->queue.next; - - pnetwork = container_of(plist, struct wlan_network, list); list_del_init(&pnetwork->list); - RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("_rtw_alloc_network: ptr=%p\n", plist)); + RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, +("_rtw_alloc_network: ptr=%p\n", &pnetwork->list)); pnetwork->network_type = 0; pnetwork->fixed = false; pnetwork->last_scanned = jiffies; diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c index 110b8c0..3b719b7 100644 --- a/drivers/staging/rtl8188eu/core/rtw_recv.c +++ b/drivers/staging/rtl8188eu/core/rtw_recv.c @@ -127,22 +127,15 @@ void _rtw_free_recv_priv(struct recv_priv *precvpriv) struct recv_frame *_rtw_alloc_recvframe(struct __queue *pfree_recv_queue) { struct recv_frame *hdr; - struct list_head *plist, *phead; struct adapter *padapter; struct recv_priv *precvpriv; - if (list_empty(&pfree_recv_queue->queue)) { - hdr = NULL; - } else { - phead = get_list_head(pfree_recv_queue); - - plist = phead->next; - - hdr = container_of(plist, struct recv_frame, list); - + hdr = list_first_entry_or_null(&pfree_recv_queue->queue, + struct recv_frame, list); + if (hdr) { list_del_init(&hdr->list); padapter = hdr->adapter; - if (padapter != NULL) { + if (padapter) { precvpriv = &padapter->recvpriv; if (pfree_recv_queue == &precvpriv->free_recv_queue) precvpriv->free_recvframe_cnt--; diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c index 1beeac4..ce655b6 100644 --- a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c +++ b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c @@ -179,9 +179,9 @@ u32 _rtw_free_sta_priv(struct sta_priv *pstapriv) return _SUCCESS; } -struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) +struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) { - s32 index; + s32 index; struct list_head *phash_list; struct sta_info *p
[PATCH v2] staging: rtl8723au: use list_for_each_entry*()
Use list_for_each_entry*() instead of list_for_each*() to simplify the code. Signed-off-by: Geliang Tang --- Changes in v2: - drop the coding style fixing in v1. --- drivers/staging/rtl8723au/core/rtw_ap.c | 92 ++- drivers/staging/rtl8723au/core/rtw_mlme.c | 38 +++--- drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 15 +--- drivers/staging/rtl8723au/core/rtw_recv.c | 43 --- drivers/staging/rtl8723au/core/rtw_sta_mgt.c | 36 +++-- drivers/staging/rtl8723au/core/rtw_xmit.c | 90 -- drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 22 ++ drivers/staging/rtl8723au/os_dep/usb_ops_linux.c | 9 +-- 8 files changed, 106 insertions(+), 239 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_ap.c b/drivers/staging/rtl8723au/core/rtw_ap.c index 1aa9b26..ce4b589 100644 --- a/drivers/staging/rtl8723au/core/rtw_ap.c +++ b/drivers/staging/rtl8723au/core/rtw_ap.c @@ -171,24 +171,20 @@ static u8 chk_sta_is_alive(struct sta_info *psta) return ret; } -void expire_timeout_chk23a(struct rtw_adapter *padapter) +void expire_timeout_chk23a(struct rtw_adapter *padapter) { - struct list_head *phead, *plist, *ptmp; + struct list_head *phead; u8 updated = 0; - struct sta_info *psta; + struct sta_info *psta, *ptmp; struct sta_priv *pstapriv = &padapter->stapriv; u8 chk_alive_num = 0; struct sta_info *chk_alive_list[NUM_STA]; int i; spin_lock_bh(&pstapriv->auth_list_lock); - phead = &pstapriv->auth_list; - /* check auth_queue */ - list_for_each_safe(plist, ptmp, phead) { - psta = container_of(plist, struct sta_info, auth_list); - + list_for_each_entry_safe(psta, ptmp, phead, auth_list) { if (psta->expire_to > 0) { psta->expire_to--; if (psta->expire_to == 0) { @@ -206,19 +202,13 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter) spin_lock_bh(&pstapriv->auth_list_lock); } } - } - spin_unlock_bh(&pstapriv->auth_list_lock); spin_lock_bh(&pstapriv->asoc_list_lock); - phead = &pstapriv->asoc_list; - /* check asoc_queue */ - list_for_each_safe(plist, ptmp, phead) { - psta = container_of(plist, struct sta_info, asoc_list); - + list_for_each_entry_safe(psta, ptmp, phead, asoc_list) { if (chk_sta_is_alive(psta) || !psta->expire_to) { psta->expire_to = pstapriv->expire_to; psta->keep_alive_trycnt = 0; @@ -283,7 +273,6 @@ voidexpire_timeout_chk23a(struct rtw_adapter *padapter) } } } - spin_unlock_bh(&pstapriv->asoc_list_lock); if (chk_alive_num) { @@ -1059,7 +1048,7 @@ void rtw_set_macaddr_acl23a(struct rtw_adapter *padapter, int mode) int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr) { - struct list_head *plist, *phead; + struct list_head *phead; u8 added = false; int i, ret = 0; struct rtw_wlan_acl_node *paclnode; @@ -1073,12 +1062,8 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr) return -1; spin_lock_bh(&pacl_node_q->lock); - phead = get_list_head(pacl_node_q); - - list_for_each(plist, phead) { - paclnode = container_of(plist, struct rtw_wlan_acl_node, list); - + list_for_each_entry(paclnode, phead, list) { if (!memcmp(paclnode->addr, addr, ETH_ALEN)) { if (paclnode->valid == true) { added = true; @@ -1087,7 +1072,6 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr) } } } - spin_unlock_bh(&pacl_node_q->lock); if (added) @@ -1121,8 +1105,8 @@ int rtw_acl_add_sta23a(struct rtw_adapter *padapter, u8 *addr) int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr) { - struct list_head *plist, *phead, *ptmp; - struct rtw_wlan_acl_node *paclnode; + struct list_head *phead; + struct rtw_wlan_acl_node *paclnode, *ptmp; struct sta_priv *pstapriv = &padapter->stapriv; struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; struct rtw_queue *pacl_node_q = &pacl_list->acl_node_q; @@ -1130,12 +1114,8 @@ int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr) DBG_8723A("%s(acl_num =%d) = %pM\n", __func__, pacl_list->num, addr); spin_lock_bh(&pacl_node_q->lock); - phead = get_list_head(pacl_node_q); - - list_for_each_safe(plist, ptm
[PATCH] staging: rtl8723au: use list_for_each_entry*()
Use list_for_each_entry*() instead of list_for_each*() to simplify the code. Fix coding style by the way. Signed-off-by: Geliang Tang --- drivers/staging/rtl8723au/core/rtw_ap.c | 166 -- drivers/staging/rtl8723au/core/rtw_mlme.c | 38 ++--- drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 13 +- drivers/staging/rtl8723au/core/rtw_recv.c | 43 ++ drivers/staging/rtl8723au/core/rtw_sta_mgt.c | 34 ++--- drivers/staging/rtl8723au/core/rtw_xmit.c | 84 --- drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 22 +-- drivers/staging/rtl8723au/os_dep/usb_ops_linux.c | 9 +- 8 files changed, 140 insertions(+), 269 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_ap.c b/drivers/staging/rtl8723au/core/rtw_ap.c index 1aa9b26..66315f9 100644 --- a/drivers/staging/rtl8723au/core/rtw_ap.c +++ b/drivers/staging/rtl8723au/core/rtw_ap.c @@ -171,24 +171,20 @@ static u8 chk_sta_is_alive(struct sta_info *psta) return ret; } -void expire_timeout_chk23a(struct rtw_adapter *padapter) +void expire_timeout_chk23a(struct rtw_adapter *padapter) { - struct list_head *phead, *plist, *ptmp; + struct list_head *phead; u8 updated = 0; - struct sta_info *psta; + struct sta_info *psta, *ptmp; struct sta_priv *pstapriv = &padapter->stapriv; u8 chk_alive_num = 0; struct sta_info *chk_alive_list[NUM_STA]; int i; spin_lock_bh(&pstapriv->auth_list_lock); - phead = &pstapriv->auth_list; - /* check auth_queue */ - list_for_each_safe(plist, ptmp, phead) { - psta = container_of(plist, struct sta_info, auth_list); - + list_for_each_entry_safe(psta, ptmp, phead, auth_list) { if (psta->expire_to > 0) { psta->expire_to--; if (psta->expire_to == 0) { @@ -206,19 +202,13 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter) spin_lock_bh(&pstapriv->auth_list_lock); } } - } - spin_unlock_bh(&pstapriv->auth_list_lock); spin_lock_bh(&pstapriv->asoc_list_lock); - phead = &pstapriv->asoc_list; - /* check asoc_queue */ - list_for_each_safe(plist, ptmp, phead) { - psta = container_of(plist, struct sta_info, asoc_list); - + list_for_each_entry_safe(psta, ptmp, phead, asoc_list) { if (chk_sta_is_alive(psta) || !psta->expire_to) { psta->expire_to = pstapriv->expire_to; psta->keep_alive_trycnt = 0; @@ -283,7 +273,6 @@ voidexpire_timeout_chk23a(struct rtw_adapter *padapter) } } } - spin_unlock_bh(&pstapriv->asoc_list_lock); if (chk_alive_num) { @@ -299,51 +288,55 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter) SelectChannel23a(padapter, pmlmeext->cur_channel); } - /* issue null data to check sta alive */ - for (i = 0; i < chk_alive_num; i++) { + /* issue null data to check sta alive */ + for (i = 0; i < chk_alive_num; i++) { - int ret = _FAIL; + int ret = _FAIL; - psta = chk_alive_list[i]; - if (!(psta->state & _FW_LINKED)) - continue; + psta = chk_alive_list[i]; + if (!(psta->state & _FW_LINKED)) + continue; - if (psta->state & WIFI_SLEEP_STATE) - ret = issue_nulldata23a(padapter, psta->hwaddr, 0, 1, 50); - else - ret = issue_nulldata23a(padapter, psta->hwaddr, 0, 3, 50); + if (psta->state & WIFI_SLEEP_STATE) + ret = issue_nulldata23a(padapter, psta->hwaddr, + 0, 1, 50); + else + ret = issue_nulldata23a(padapter, psta->hwaddr, + 0, 3, 50); + + psta->keep_alive_trycnt++; + if (ret == _SUCCESS) { + DBG_8723A("asoc check, sta(%pM) is alive\n", + psta->hwaddr); + psta->expire_to = pstapriv->expire_to; + psta->keep_alive_trycnt = 0; + continue; + } else if (psta->keep_alive_trycnt <= 3) { + DBG_8723A("ack check
[PATCH 08/10] staging: fbtft: use to_platform_device()
Use to_platform_device() instead of open-coding it. Signed-off-by: Geliang Tang --- drivers/staging/fbtft/fbtft_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/fbtft/fbtft_device.c b/drivers/staging/fbtft/fbtft_device.c index 071f79b..50d5735 100644 --- a/drivers/staging/fbtft/fbtft_device.c +++ b/drivers/staging/fbtft/fbtft_device.c @@ -1305,7 +1305,7 @@ static void pr_spi_devices(void) static int p_device_found(struct device *dev, void *data) { struct platform_device - *pdev = container_of(dev, struct platform_device, dev); + *pdev = to_platform_device(dev); if (strstr(pdev->name, "fb")) dev_info(dev, "%s id=%d pdata? %s\n", pdev->name, pdev->id, -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/3] staging: rtl8192u: use to_delayed_work
Use to_delayed_work() instead of open-coding it. Signed-off-by: Geliang Tang --- drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 6 +++--- drivers/staging/rtl8192u/r8192U_core.c | 3 +-- drivers/staging/rtl8192u/r8192U_dm.c | 4 ++-- drivers/staging/rtl8192u/r819xU_phy.c | 3 +-- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index 38c3eb7..21ee410 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -487,7 +487,7 @@ EXPORT_SYMBOL(ieee80211_softmac_scan_syncro); static void ieee80211_softmac_scan_wq(struct work_struct *work) { - struct delayed_work *dwork = container_of(work, struct delayed_work, work); + struct delayed_work *dwork = to_delayed_work(work); struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq); static short watchdog; u8 channel_map[MAX_CHANNEL_NUMBER+1]; @@ -2330,7 +2330,7 @@ static void ieee80211_start_monitor_mode(struct ieee80211_device *ieee) static void ieee80211_start_ibss_wq(struct work_struct *work) { - struct delayed_work *dwork = container_of(work, struct delayed_work, work); + struct delayed_work *dwork = to_delayed_work(work); struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, start_ibss_wq); /* iwconfig mode ad-hoc will schedule this and return * on the other hand this will block further iwconfig SET @@ -2504,7 +2504,7 @@ EXPORT_SYMBOL(ieee80211_disassociate); static void ieee80211_associate_retry_wq(struct work_struct *work) { - struct delayed_work *dwork = container_of(work, struct delayed_work, work); + struct delayed_work *dwork = to_delayed_work(work); struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq); unsigned long flags; diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index f4a4eae..5ac0893 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -3436,8 +3436,7 @@ static void rtl819x_update_rxcounts(struct r8192_priv *priv, u32 *TotalRxBcnNum, static void rtl819x_watchdog_wqcallback(struct work_struct *work) { - struct delayed_work *dwork = container_of(work, - struct delayed_work, work); + struct delayed_work *dwork = to_delayed_work(work); struct r8192_priv *priv = container_of(dwork, struct r8192_priv, watch_dog_wq); struct net_device *dev = priv->ieee80211->dev; diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c index 375ec96..9b58b1a 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.c +++ b/drivers/staging/rtl8192u/r8192U_dm.c @@ -767,7 +767,7 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev) void dm_txpower_trackingcallback(struct work_struct *work) { - struct delayed_work *dwork = container_of(work, struct delayed_work, work); + struct delayed_work *dwork = to_delayed_work(work); struct r8192_priv *priv = container_of(dwork, struct r8192_priv, txpower_tracking_wq); struct net_device *dev = priv->ieee80211->dev; @@ -2412,7 +2412,7 @@ staticvoiddm_check_pbc_gpio(struct net_device *dev) *---*/ void dm_rf_pathcheck_workitemcallback(struct work_struct *work) { - struct delayed_work *dwork = container_of(work, struct delayed_work, work); + struct delayed_work *dwork = to_delayed_work(work); struct r8192_priv *priv = container_of(dwork, struct r8192_priv, rfpath_check_wq); struct net_device *dev = priv->ieee80211->dev; /*bool bactually_set = false;*/ diff --git a/drivers/staging/rtl8192u/r819xU_phy.c b/drivers/staging/rtl8192u/r819xU_phy.c index f264d88..696df34 100644 --- a/drivers/staging/rtl8192u/r819xU_phy.c +++ b/drivers/staging/rtl8192u/r819xU_phy.c @@ -1683,8 +1683,7 @@ void InitialGain819xUsb(struct net_device *dev, u8 Operation) void InitialGainOperateWorkItemCallBack(struct work_struct *work) { - struct delayed_work *dwork = container_of(work, struct delayed_work, - work); + struct delayed_work *dwork = to_delayed_work(work); struct r8192_priv *priv = container_of(dwork, struct r8192_priv, initialgain_operate_wq); struct net_device *dev = priv->ieee80211->dev; -- 2.5.0 ___ devel mailing list de...@lin
[PATCH 3/3] staging: rtl8192e: use to_delayed_work
Use to_delayed_work() instead of open-coding it. Signed-off-by: Geliang Tang --- drivers/staging/rtl8192e/rtllib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index 563ac12..d99240e 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -76,7 +76,7 @@ #define container_of_work_rsl(x, y, z) container_of(x, y, z) #define container_of_dwork_rsl(x, y, z)\ - container_of(container_of(x, struct delayed_work, work), y, z) + container_of(to_delayed_work(x), y, z) #define iwe_stream_add_event_rsl(info, start, stop, iwe, len) \ iwe_stream_add_event(info, start, stop, iwe, len) -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 8/9] vme: vme_ca91cx42.c: use to_pci_dev()
Use to_pci_dev() instead of open-coding it. Signed-off-by: Geliang Tang --- drivers/vme/bridges/vme_ca91cx42.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/vme/bridges/vme_ca91cx42.c b/drivers/vme/bridges/vme_ca91cx42.c index b79a74a..5fbeab3 100644 --- a/drivers/vme/bridges/vme_ca91cx42.c +++ b/drivers/vme/bridges/vme_ca91cx42.c @@ -202,7 +202,7 @@ static int ca91cx42_irq_init(struct vme_bridge *ca91cx42_bridge) bridge = ca91cx42_bridge->driver_priv; /* Need pdev */ - pdev = container_of(ca91cx42_bridge->parent, struct pci_dev, dev); + pdev = to_pci_dev(ca91cx42_bridge->parent); INIT_LIST_HEAD(&ca91cx42_bridge->vme_error_handlers); @@ -293,8 +293,7 @@ static void ca91cx42_irq_set(struct vme_bridge *ca91cx42_bridge, int level, iowrite32(tmp, bridge->base + LINT_EN); if ((state == 0) && (sync != 0)) { - pdev = container_of(ca91cx42_bridge->parent, struct pci_dev, - dev); + pdev = to_pci_dev(ca91cx42_bridge->parent); synchronize_irq(pdev->irq); } @@ -518,7 +517,7 @@ static int ca91cx42_alloc_resource(struct vme_master_resource *image, dev_err(ca91cx42_bridge->parent, "Dev entry NULL\n"); return -EINVAL; } - pdev = container_of(ca91cx42_bridge->parent, struct pci_dev, dev); + pdev = to_pci_dev(ca91cx42_bridge->parent); existing_size = (unsigned long long)(image->bus_resource.end - image->bus_resource.start); @@ -1519,7 +1518,7 @@ static void *ca91cx42_alloc_consistent(struct device *parent, size_t size, struct pci_dev *pdev; /* Find pci_dev container of dev */ - pdev = container_of(parent, struct pci_dev, dev); + pdev = to_pci_dev(parent); return pci_alloc_consistent(pdev, size, dma); } @@ -1530,7 +1529,7 @@ static void ca91cx42_free_consistent(struct device *parent, size_t size, struct pci_dev *pdev; /* Find pci_dev container of dev */ - pdev = container_of(parent, struct pci_dev, dev); + pdev = to_pci_dev(parent); pci_free_consistent(pdev, size, vaddr, dma); } -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/3] staging: fbtft: use to_spi_device
Use to_spi_device() instead of open-coding it. Signed-off-by: Geliang Tang --- drivers/staging/fbtft/fbtft_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/fbtft/fbtft_device.c b/drivers/staging/fbtft/fbtft_device.c index 071f79b..55a7307 100644 --- a/drivers/staging/fbtft/fbtft_device.c +++ b/drivers/staging/fbtft/fbtft_device.c @@ -1287,7 +1287,7 @@ Device 'xxx' does not have a release() function, it is broken and must be fixed static int spi_device_found(struct device *dev, void *data) { - struct spi_device *spi = container_of(dev, struct spi_device, dev); + struct spi_device *spi = to_spi_device(dev); dev_info(dev, "%s %s %dkHz %d bits mode=0x%02X\n", spi->modalias, dev_name(dev), spi->max_speed_hz / 1000, spi->bits_per_word, -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: wlan-ng: use list_for_each_entry*
Use list_for_each_entry*() instead of list_for_each*() to simplify the code. Signed-off-by: Geliang Tang --- drivers/staging/wlan-ng/hfa384x_usb.c | 17 - drivers/staging/wlan-ng/prism2usb.c | 15 +++ 2 files changed, 7 insertions(+), 25 deletions(-) diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c index 7551ac2..9b04036 100644 --- a/drivers/staging/wlan-ng/hfa384x_usb.c +++ b/drivers/staging/wlan-ng/hfa384x_usb.c @@ -2810,8 +2810,7 @@ void hfa384x_tx_timeout(wlandevice_t *wlandev) static void hfa384x_usbctlx_reaper_task(unsigned long data) { hfa384x_t *hw = (hfa384x_t *)data; - struct list_head *entry; - struct list_head *temp; + hfa384x_usbctlx_t *ctlx, *temp; unsigned long flags; spin_lock_irqsave(&hw->ctlxq.lock, flags); @@ -2819,10 +2818,7 @@ static void hfa384x_usbctlx_reaper_task(unsigned long data) /* This list is guaranteed to be empty if someone * has unplugged the adapter. */ - list_for_each_safe(entry, temp, &hw->ctlxq.reapable) { - hfa384x_usbctlx_t *ctlx; - - ctlx = list_entry(entry, hfa384x_usbctlx_t, list); + list_for_each_entry_safe(ctlx, temp, &hw->ctlxq.reapable, list) { list_del(&ctlx->list); kfree(ctlx); } @@ -2847,8 +2843,7 @@ static void hfa384x_usbctlx_reaper_task(unsigned long data) static void hfa384x_usbctlx_completion_task(unsigned long data) { hfa384x_t *hw = (hfa384x_t *)data; - struct list_head *entry; - struct list_head *temp; + hfa384x_usbctlx_t *ctlx, *temp; unsigned long flags; int reap = 0; @@ -2858,11 +2853,7 @@ static void hfa384x_usbctlx_completion_task(unsigned long data) /* This list is guaranteed to be empty if someone * has unplugged the adapter ... */ - list_for_each_safe(entry, temp, &hw->ctlxq.completing) { - hfa384x_usbctlx_t *ctlx; - - ctlx = list_entry(entry, hfa384x_usbctlx_t, list); - + list_for_each_entry_safe(ctlx, temp, &hw->ctlxq.completing, list) { /* Call the completion function that this * command was assigned, assuming it has one. */ diff --git a/drivers/staging/wlan-ng/prism2usb.c b/drivers/staging/wlan-ng/prism2usb.c index 8abf3f8..194f67e 100644 --- a/drivers/staging/wlan-ng/prism2usb.c +++ b/drivers/staging/wlan-ng/prism2usb.c @@ -139,8 +139,7 @@ static void prism2sta_disconnect_usb(struct usb_interface *interface) wlandev = (wlandevice_t *)usb_get_intfdata(interface); if (wlandev != NULL) { LIST_HEAD(cleanlist); - struct list_head *entry; - struct list_head *temp; + hfa384x_usbctlx_t *ctlx, *temp; unsigned long flags; hfa384x_t *hw = wlandev->priv; @@ -184,12 +183,8 @@ static void prism2sta_disconnect_usb(struct usb_interface *interface) * and tell everyone who is waiting for their * responses that we have shut down. */ - list_for_each(entry, &cleanlist) { - hfa384x_usbctlx_t *ctlx; - - ctlx = list_entry(entry, hfa384x_usbctlx_t, list); + list_for_each_entry(ctlx, &cleanlist, list) complete(&ctlx->done); - } /* Give any outstanding synchronous commands * a chance to complete. All they need to do @@ -199,12 +194,8 @@ static void prism2sta_disconnect_usb(struct usb_interface *interface) msleep(100); /* Now delete the CTLXs, because no-one else can now. */ - list_for_each_safe(entry, temp, &cleanlist) { - hfa384x_usbctlx_t *ctlx; - - ctlx = list_entry(entry, hfa384x_usbctlx_t, list); + list_for_each_entry_safe(ctlx, temp, &cleanlist, list) kfree(ctlx); - } /* Unhook the wlandev */ unregister_wlandev(wlandev); -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: emxx_udc: use list_first_entry_or_null()
Simplify the code with list_first_entry_or_null(). Signed-off-by: Geliang Tang --- drivers/staging/emxx_udc/emxx_udc.c | 30 +- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c index 4e6c16a..794bb9b 100644 --- a/drivers/staging/emxx_udc/emxx_udc.c +++ b/drivers/staging/emxx_udc/emxx_udc.c @@ -1285,11 +1285,7 @@ static void _nbu2ss_restert_transfer(struct nbu2ss_ep *ep) boolbflag = FALSE; struct nbu2ss_req *req; - if (list_empty(&ep->queue)) - req = NULL; - else - req = list_entry(ep->queue.next, struct nbu2ss_req, queue); - + req = list_first_entry_or_null(&ep->queue, struct nbu2ss_req, queue); if (!req) return; @@ -1784,11 +1780,7 @@ static inline int _nbu2ss_ep0_in_data_stage(struct nbu2ss_udc *udc) struct nbu2ss_req *req; struct nbu2ss_ep*ep = &udc->ep[0]; - if (list_empty(&ep->queue)) - req = NULL; - else - req = list_entry(ep->queue.next, struct nbu2ss_req, queue); - + req = list_first_entry_or_null(&ep->queue, struct nbu2ss_req, queue); if (!req) req = &udc->ep0_req; @@ -1811,11 +1803,7 @@ static inline int _nbu2ss_ep0_out_data_stage(struct nbu2ss_udc *udc) struct nbu2ss_req *req; struct nbu2ss_ep*ep = &udc->ep[0]; - if (list_empty(&ep->queue)) - req = NULL; - else - req = list_entry(ep->queue.next, struct nbu2ss_req, queue); - + req = list_first_entry_or_null(&ep->queue, struct nbu2ss_req, queue); if (!req) req = &udc->ep0_req; @@ -1838,11 +1826,7 @@ static inline int _nbu2ss_ep0_status_stage(struct nbu2ss_udc *udc) struct nbu2ss_req *req; struct nbu2ss_ep*ep = &udc->ep[0]; - if (list_empty(&ep->queue)) - req = NULL; - else - req = list_entry(ep->queue.next, struct nbu2ss_req, queue); - + req = list_first_entry_or_null(&ep->queue, struct nbu2ss_req, queue); if (!req) { req = &udc->ep0_req; if (req->req.complete) @@ -2145,11 +2129,7 @@ static inline void _nbu2ss_epn_int(struct nbu2ss_udc *udc, u32 epnum) /* Interrupt Clear */ _nbu2ss_writel(&udc->p_regs->EP_REGS[num].EP_STATUS, ~(u32)status); - if (list_empty(&ep->queue)) - req = NULL; - else - req = list_entry(ep->queue.next, struct nbu2ss_req, queue); - + req = list_first_entry_or_null(&ep->queue, struct nbu2ss_req, queue); if (!req) { /* pr_warn("=== %s(%d) req == NULL\n", __func__, epnum); */ return; -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] staging: comedi: use kmalloc_array instead of kmalloc
Use kmalloc_array instead of kmalloc to allocate memory for an array. Signed-off-by: Geliang Tang --- Changes in v2: - preserve the existing whitespace style. --- drivers/staging/comedi/drivers/amplc_pci224.c | 11 +++ drivers/staging/comedi/drivers/ni_670x.c | 5 +++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c b/drivers/staging/comedi/drivers/amplc_pci224.c index b2f7679..cac011f 100644 --- a/drivers/staging/comedi/drivers/amplc_pci224.c +++ b/drivers/staging/comedi/drivers/amplc_pci224.c @@ -1022,14 +1022,17 @@ pci224_auto_attach(struct comedi_device *dev, unsigned long context_model) irq = pci_dev->irq; /* Allocate buffer to hold values for AO channel scan. */ - devpriv->ao_scan_vals = kmalloc(sizeof(devpriv->ao_scan_vals[0]) * - board->ao_chans, GFP_KERNEL); + devpriv->ao_scan_vals = kmalloc_array(board->ao_chans, + sizeof(devpriv->ao_scan_vals[0]), + GFP_KERNEL); if (!devpriv->ao_scan_vals) return -ENOMEM; /* Allocate buffer to hold AO channel scan order. */ - devpriv->ao_scan_order = kmalloc(sizeof(devpriv->ao_scan_order[0]) * -board->ao_chans, GFP_KERNEL); + devpriv->ao_scan_order = + kmalloc_array(board->ao_chans, + sizeof(devpriv->ao_scan_order[0]), + GFP_KERNEL); if (!devpriv->ao_scan_order) return -ENOMEM; diff --git a/drivers/staging/comedi/drivers/ni_670x.c b/drivers/staging/comedi/drivers/ni_670x.c index f4c580f..3e7271880 100644 --- a/drivers/staging/comedi/drivers/ni_670x.c +++ b/drivers/staging/comedi/drivers/ni_670x.c @@ -214,8 +214,9 @@ static int ni_670x_auto_attach(struct comedi_device *dev, if (s->n_chan == 32) { const struct comedi_lrange **range_table_list; - range_table_list = kmalloc(sizeof(struct comedi_lrange *) * 32, - GFP_KERNEL); + range_table_list = kmalloc_array(32, +sizeof(struct comedi_lrange *), +GFP_KERNEL); if (!range_table_list) return -ENOMEM; s->range_table_list = range_table_list; -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/4] staging: rtl8192u: r8192U_core: use kmalloc_array instead of kmalloc
Use kmalloc_array instead of kmalloc to allocate memory for an array. Signed-off-by: Geliang Tang --- drivers/staging/rtl8192u/r8192U_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index e06864f..07a1447 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -1725,8 +1725,8 @@ static short rtl8192_usb_initendpoints(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); - priv->rx_urb = kmalloc(sizeof(struct urb *) * (MAX_RX_URB + 1), - GFP_KERNEL); + priv->rx_urb = kmalloc_array(MAX_RX_URB + 1, sizeof(struct urb *), +GFP_KERNEL); if (priv->rx_urb == NULL) return -ENOMEM; -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/4] staging: rdma: use kmalloc_array instead of kmalloc
Use kmalloc_array instead of kmalloc to allocate memory for an array. Signed-off-by: Geliang Tang --- drivers/staging/rdma/amso1100/c2.c | 6 -- drivers/staging/rdma/ipath/ipath_file_ops.c | 8 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/staging/rdma/amso1100/c2.c b/drivers/staging/rdma/amso1100/c2.c index 35ac536..4e6d24a 100644 --- a/drivers/staging/rdma/amso1100/c2.c +++ b/drivers/staging/rdma/amso1100/c2.c @@ -116,7 +116,8 @@ static int c2_tx_ring_alloc(struct c2_ring *tx_ring, void *vaddr, struct c2_element *elem; int i; - tx_ring->start = kmalloc(sizeof(*elem) * tx_ring->count, GFP_KERNEL); + tx_ring->start = kmalloc_array(tx_ring->count, sizeof(*elem), + GFP_KERNEL); if (!tx_ring->start) return -ENOMEM; @@ -165,7 +166,8 @@ static int c2_rx_ring_alloc(struct c2_ring *rx_ring, void *vaddr, struct c2_element *elem; int i; - rx_ring->start = kmalloc(sizeof(*elem) * rx_ring->count, GFP_KERNEL); + rx_ring->start = kmalloc_array(rx_ring->count, sizeof(*elem), + GFP_KERNEL); if (!rx_ring->start) return -ENOMEM; diff --git a/drivers/staging/rdma/ipath/ipath_file_ops.c b/drivers/staging/rdma/ipath/ipath_file_ops.c index 13c3cd1..6187b84 100644 --- a/drivers/staging/rdma/ipath/ipath_file_ops.c +++ b/drivers/staging/rdma/ipath/ipath_file_ops.c @@ -917,15 +917,15 @@ static int ipath_create_user_egr(struct ipath_portdata *pd) chunk = pd->port_rcvegrbuf_chunks; egrperchunk = pd->port_rcvegrbufs_perchunk; size = pd->port_rcvegrbuf_size; - pd->port_rcvegrbuf = kmalloc(chunk * sizeof(pd->port_rcvegrbuf[0]), -GFP_KERNEL); + pd->port_rcvegrbuf = kmalloc_array(chunk, sizeof(pd->port_rcvegrbuf[0]), + GFP_KERNEL); if (!pd->port_rcvegrbuf) { ret = -ENOMEM; goto bail; } pd->port_rcvegrbuf_phys = - kmalloc(chunk * sizeof(pd->port_rcvegrbuf_phys[0]), - GFP_KERNEL); + kmalloc_array(chunk, sizeof(pd->port_rcvegrbuf_phys[0]), + GFP_KERNEL); if (!pd->port_rcvegrbuf_phys) { ret = -ENOMEM; goto bail_rcvegrbuf; -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/4] staging: lustre: libcfs: use kmalloc_array instead of kmalloc
Use kmalloc_array instead of kmalloc to allocate memory for an array. Signed-off-by: Geliang Tang --- drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c index 64a136c..3d3713b 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c @@ -60,9 +60,8 @@ int cfs_tracefile_init_arch(void) /* initialize trace_data */ memset(cfs_trace_data, 0, sizeof(cfs_trace_data)); for (i = 0; i < CFS_TCD_TYPE_MAX; i++) { - cfs_trace_data[i] = - kmalloc(sizeof(union cfs_trace_data_union) * - num_possible_cpus(), GFP_KERNEL); + cfs_trace_data[i] = kmalloc_array(num_possible_cpus(), + sizeof(union cfs_trace_data_union), GFP_KERNEL); if (cfs_trace_data[i] == NULL) goto out; -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/4] staging: comedi: use kmalloc_array instead of kmalloc
Use kmalloc_array instead of kmalloc to allocate memory for an array. Signed-off-by: Geliang Tang --- drivers/staging/comedi/drivers/amplc_pci224.c | 8 drivers/staging/comedi/drivers/ni_670x.c | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c b/drivers/staging/comedi/drivers/amplc_pci224.c index b2f7679..d39f02d 100644 --- a/drivers/staging/comedi/drivers/amplc_pci224.c +++ b/drivers/staging/comedi/drivers/amplc_pci224.c @@ -1022,14 +1022,14 @@ pci224_auto_attach(struct comedi_device *dev, unsigned long context_model) irq = pci_dev->irq; /* Allocate buffer to hold values for AO channel scan. */ - devpriv->ao_scan_vals = kmalloc(sizeof(devpriv->ao_scan_vals[0]) * - board->ao_chans, GFP_KERNEL); + devpriv->ao_scan_vals = kmalloc_array(board->ao_chans, + sizeof(devpriv->ao_scan_vals[0]), GFP_KERNEL); if (!devpriv->ao_scan_vals) return -ENOMEM; /* Allocate buffer to hold AO channel scan order. */ - devpriv->ao_scan_order = kmalloc(sizeof(devpriv->ao_scan_order[0]) * -board->ao_chans, GFP_KERNEL); + devpriv->ao_scan_order = kmalloc_array(board->ao_chans, + sizeof(devpriv->ao_scan_order[0]), GFP_KERNEL); if (!devpriv->ao_scan_order) return -ENOMEM; diff --git a/drivers/staging/comedi/drivers/ni_670x.c b/drivers/staging/comedi/drivers/ni_670x.c index f4c580f..3e7271880 100644 --- a/drivers/staging/comedi/drivers/ni_670x.c +++ b/drivers/staging/comedi/drivers/ni_670x.c @@ -214,8 +214,9 @@ static int ni_670x_auto_attach(struct comedi_device *dev, if (s->n_chan == 32) { const struct comedi_lrange **range_table_list; - range_table_list = kmalloc(sizeof(struct comedi_lrange *) * 32, - GFP_KERNEL); + range_table_list = kmalloc_array(32, +sizeof(struct comedi_lrange *), +GFP_KERNEL); if (!range_table_list) return -ENOMEM; s->range_table_list = range_table_list; -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 5/9] staging: wilc1000: fix trivial typos
s/regsiter/register/ Signed-off-by: Geliang Tang --- drivers/staging/wilc1000/linux_wlan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index ccab89f..6dc5faf 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1880,10 +1880,10 @@ static void __exit exit_wilc_driver(void) } #ifndef WILC_SDIO - PRINT_D(INIT_DBG, "SPI unregsiter...\n"); + PRINT_D(INIT_DBG, "SPI unregister...\n"); spi_unregister_driver(&wilc_bus); #else - PRINT_D(INIT_DBG, "SDIO unregsiter...\n"); + PRINT_D(INIT_DBG, "SDIO unregister...\n"); sdio_unregister_driver(&wilc_bus); #endif -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/3] staging: lustre: make sptlrpc_flavor_has_bulk return boolean
This patch makes sptlrpc_flavor_has_bulk return boolean, since this function only uses either one or zero as its return value. Signed-off-by: Geliang Tang --- drivers/staging/lustre/lustre/include/lustre_sec.h | 2 +- drivers/staging/lustre/lustre/ptlrpc/sec.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_sec.h b/drivers/staging/lustre/lustre/include/lustre_sec.h index aaadf09..dd1033b 100644 --- a/drivers/staging/lustre/lustre/include/lustre_sec.h +++ b/drivers/staging/lustre/lustre/include/lustre_sec.h @@ -322,7 +322,7 @@ struct sptlrpc_rule_set { }; int sptlrpc_parse_flavor(const char *str, struct sptlrpc_flavor *flvr); -int sptlrpc_flavor_has_bulk(struct sptlrpc_flavor *flvr); +bool sptlrpc_flavor_has_bulk(struct sptlrpc_flavor *flvr); static inline void sptlrpc_rule_set_init(struct sptlrpc_rule_set *set) { diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec.c b/drivers/staging/lustre/lustre/ptlrpc/sec.c index 34d1330..39f5261 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec.c @@ -2261,14 +2261,14 @@ EXPORT_SYMBOL(sec2target_str); /* * return true if the bulk data is protected */ -int sptlrpc_flavor_has_bulk(struct sptlrpc_flavor *flvr) +bool sptlrpc_flavor_has_bulk(struct sptlrpc_flavor *flvr) { switch (SPTLRPC_FLVR_BULK_SVC(flvr->sf_rpc)) { case SPTLRPC_BULK_SVC_INTG: case SPTLRPC_BULK_SVC_PRIV: - return 1; + return true; default: - return 0; + return false; } } EXPORT_SYMBOL(sptlrpc_flavor_has_bulk); -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/3] staging: xgifb: make XGIfb_has_VB return boolean
This patch makes XGIfb_has_VB return boolean, since this function only uses either one or zero as its return value. Signed-off-by: Geliang Tang --- drivers/staging/xgifb/XGI_main_26.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c index 5a6251a4..89f5b55 100644 --- a/drivers/staging/xgifb/XGI_main_26.c +++ b/drivers/staging/xgifb/XGI_main_26.c @@ -1548,7 +1548,7 @@ static void XGIfb_detect_VB(struct xgifb_video_info *xgifb_info) } } -static int XGIfb_has_VB(struct xgifb_video_info *xgifb_info) +static bool XGIfb_has_VB(struct xgifb_video_info *xgifb_info) { u8 vb_chipid; @@ -1562,9 +1562,9 @@ static int XGIfb_has_VB(struct xgifb_video_info *xgifb_info) break; default: xgifb_info->hasVB = HASVB_NONE; - return 0; + return false; } - return 1; + return true; } static void XGIfb_get_VB_type(struct xgifb_video_info *xgifb_info) -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/3] staging: comedi: make ni_tio_has_gate2_registers return boolean
This patch makes ni_tio_has_gate2_registers return boolean, since this function only uses either one or zero as its return value. Signed-off-by: Geliang Tang --- drivers/staging/comedi/drivers/ni_tio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_tio.c b/drivers/staging/comedi/drivers/ni_tio.c index c20c51b..b74e44e 100644 --- a/drivers/staging/comedi/drivers/ni_tio.c +++ b/drivers/staging/comedi/drivers/ni_tio.c @@ -167,15 +167,15 @@ static inline unsigned GI_HW_ARM_SEL_MASK(enum ni_gpct_variant variant) } } -static int ni_tio_has_gate2_registers(const struct ni_gpct_device *counter_dev) +static bool ni_tio_has_gate2_registers(const struct ni_gpct_device *counter_dev) { switch (counter_dev->variant) { case ni_gpct_variant_e_series: default: - return 0; + return false; case ni_gpct_variant_m_series: case ni_gpct_variant_660x: - return 1; + return true; } } -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 2/2] staging: IB/ipath: remove sched.h header
sched.h header in ipath_*.c is now unnecessary, since I have added sched.h in ipath_kernel.h. So remove it. Signed-off-by: Geliang Tang --- Changes in v2: - split it into two patches. --- drivers/staging/rdma/ipath/ipath_driver.c | 1 - drivers/staging/rdma/ipath/ipath_intr.c| 1 - drivers/staging/rdma/ipath/ipath_qp.c | 1 - drivers/staging/rdma/ipath/ipath_ruc.c | 1 - drivers/staging/rdma/ipath/ipath_ud.c | 1 - drivers/staging/rdma/ipath/ipath_user_pages.c | 1 - drivers/staging/rdma/ipath/ipath_user_sdma.c | 1 - drivers/staging/rdma/ipath/ipath_verbs_mcast.c | 1 - 8 files changed, 8 deletions(-) diff --git a/drivers/staging/rdma/ipath/ipath_driver.c b/drivers/staging/rdma/ipath/ipath_driver.c index 46d9898..dfcfaa5 100644 --- a/drivers/staging/rdma/ipath/ipath_driver.c +++ b/drivers/staging/rdma/ipath/ipath_driver.c @@ -33,7 +33,6 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -#include #include #include #include diff --git a/drivers/staging/rdma/ipath/ipath_intr.c b/drivers/staging/rdma/ipath/ipath_intr.c index e568971..0403fa2 100644 --- a/drivers/staging/rdma/ipath/ipath_intr.c +++ b/drivers/staging/rdma/ipath/ipath_intr.c @@ -33,7 +33,6 @@ #include #include -#include #include "ipath_kernel.h" #include "ipath_verbs.h" diff --git a/drivers/staging/rdma/ipath/ipath_qp.c b/drivers/staging/rdma/ipath/ipath_qp.c index b2c6766..280cd2d 100644 --- a/drivers/staging/rdma/ipath/ipath_qp.c +++ b/drivers/staging/rdma/ipath/ipath_qp.c @@ -32,7 +32,6 @@ */ #include -#include #include #include diff --git a/drivers/staging/rdma/ipath/ipath_ruc.c b/drivers/staging/rdma/ipath/ipath_ruc.c index 1f95bba..2296832 100644 --- a/drivers/staging/rdma/ipath/ipath_ruc.c +++ b/drivers/staging/rdma/ipath/ipath_ruc.c @@ -31,7 +31,6 @@ * SOFTWARE. */ -#include #include #include "ipath_verbs.h" diff --git a/drivers/staging/rdma/ipath/ipath_ud.c b/drivers/staging/rdma/ipath/ipath_ud.c index e8a2a91..33fcfe2 100644 --- a/drivers/staging/rdma/ipath/ipath_ud.c +++ b/drivers/staging/rdma/ipath/ipath_ud.c @@ -31,7 +31,6 @@ * SOFTWARE. */ -#include #include #include "ipath_verbs.h" diff --git a/drivers/staging/rdma/ipath/ipath_user_pages.c b/drivers/staging/rdma/ipath/ipath_user_pages.c index 1da1252..d29b4da 100644 --- a/drivers/staging/rdma/ipath/ipath_user_pages.c +++ b/drivers/staging/rdma/ipath/ipath_user_pages.c @@ -34,7 +34,6 @@ #include #include #include -#include #include "ipath_kernel.h" diff --git a/drivers/staging/rdma/ipath/ipath_user_sdma.c b/drivers/staging/rdma/ipath/ipath_user_sdma.c index e82b3ee..8c12e3c 100644 --- a/drivers/staging/rdma/ipath/ipath_user_sdma.c +++ b/drivers/staging/rdma/ipath/ipath_user_sdma.c @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/staging/rdma/ipath/ipath_verbs_mcast.c b/drivers/staging/rdma/ipath/ipath_verbs_mcast.c index 6216ea9..72d476f 100644 --- a/drivers/staging/rdma/ipath/ipath_verbs_mcast.c +++ b/drivers/staging/rdma/ipath/ipath_verbs_mcast.c @@ -32,7 +32,6 @@ */ #include -#include #include #include "ipath_verbs.h" -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 1/2] staging: IB/ipath: use TASK_COMM_LEN in ipath_portdata
Use comm[TASK_COMM_LEN] instead of comm[16] in ipath_kernel.h. And add sched.h header in it. Signed-off-by: Geliang Tang --- Changes in v2: - split it into two patches. --- drivers/staging/rdma/ipath/ipath_kernel.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/rdma/ipath/ipath_kernel.h b/drivers/staging/rdma/ipath/ipath_kernel.h index f0f9471..66c934a 100644 --- a/drivers/staging/rdma/ipath/ipath_kernel.h +++ b/drivers/staging/rdma/ipath/ipath_kernel.h @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -162,7 +163,7 @@ struct ipath_portdata { struct pid *port_pid; struct pid *port_subpid[INFINIPATH_MAX_SUBPORT]; /* same size as task_struct .comm[] */ - char port_comm[16]; + char port_comm[TASK_COMM_LEN]; /* pkeys set by this use of this port */ u16 port_pkeys[4]; /* so file ops can get at unit */ -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] IB/ipath: use TASK_COMM_LEN in ipath_portdata
Use comm[TASK_COMM_LEN] instead of comm[16]. Add linux/sched.h header in ipath_kernel.h, and remove linux/sched.h header from ipath_*.c which have included ipath_kernel.h. Signed-off-by: Geliang Tang --- drivers/staging/rdma/ipath/ipath_driver.c | 1 - drivers/staging/rdma/ipath/ipath_intr.c| 1 - drivers/staging/rdma/ipath/ipath_kernel.h | 3 ++- drivers/staging/rdma/ipath/ipath_qp.c | 1 - drivers/staging/rdma/ipath/ipath_ruc.c | 1 - drivers/staging/rdma/ipath/ipath_ud.c | 1 - drivers/staging/rdma/ipath/ipath_user_pages.c | 1 - drivers/staging/rdma/ipath/ipath_user_sdma.c | 1 - drivers/staging/rdma/ipath/ipath_verbs_mcast.c | 1 - 9 files changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/staging/rdma/ipath/ipath_driver.c b/drivers/staging/rdma/ipath/ipath_driver.c index 46d9898..dfcfaa5 100644 --- a/drivers/staging/rdma/ipath/ipath_driver.c +++ b/drivers/staging/rdma/ipath/ipath_driver.c @@ -33,7 +33,6 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -#include #include #include #include diff --git a/drivers/staging/rdma/ipath/ipath_intr.c b/drivers/staging/rdma/ipath/ipath_intr.c index e568971..0403fa2 100644 --- a/drivers/staging/rdma/ipath/ipath_intr.c +++ b/drivers/staging/rdma/ipath/ipath_intr.c @@ -33,7 +33,6 @@ #include #include -#include #include "ipath_kernel.h" #include "ipath_verbs.h" diff --git a/drivers/staging/rdma/ipath/ipath_kernel.h b/drivers/staging/rdma/ipath/ipath_kernel.h index f0f9471..66c934a 100644 --- a/drivers/staging/rdma/ipath/ipath_kernel.h +++ b/drivers/staging/rdma/ipath/ipath_kernel.h @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -162,7 +163,7 @@ struct ipath_portdata { struct pid *port_pid; struct pid *port_subpid[INFINIPATH_MAX_SUBPORT]; /* same size as task_struct .comm[] */ - char port_comm[16]; + char port_comm[TASK_COMM_LEN]; /* pkeys set by this use of this port */ u16 port_pkeys[4]; /* so file ops can get at unit */ diff --git a/drivers/staging/rdma/ipath/ipath_qp.c b/drivers/staging/rdma/ipath/ipath_qp.c index face876..0344327 100644 --- a/drivers/staging/rdma/ipath/ipath_qp.c +++ b/drivers/staging/rdma/ipath/ipath_qp.c @@ -32,7 +32,6 @@ */ #include -#include #include #include diff --git a/drivers/staging/rdma/ipath/ipath_ruc.c b/drivers/staging/rdma/ipath/ipath_ruc.c index 1f95bba..2296832 100644 --- a/drivers/staging/rdma/ipath/ipath_ruc.c +++ b/drivers/staging/rdma/ipath/ipath_ruc.c @@ -31,7 +31,6 @@ * SOFTWARE. */ -#include #include #include "ipath_verbs.h" diff --git a/drivers/staging/rdma/ipath/ipath_ud.c b/drivers/staging/rdma/ipath/ipath_ud.c index e8a2a91..33fcfe2 100644 --- a/drivers/staging/rdma/ipath/ipath_ud.c +++ b/drivers/staging/rdma/ipath/ipath_ud.c @@ -31,7 +31,6 @@ * SOFTWARE. */ -#include #include #include "ipath_verbs.h" diff --git a/drivers/staging/rdma/ipath/ipath_user_pages.c b/drivers/staging/rdma/ipath/ipath_user_pages.c index 1da1252..d29b4da 100644 --- a/drivers/staging/rdma/ipath/ipath_user_pages.c +++ b/drivers/staging/rdma/ipath/ipath_user_pages.c @@ -34,7 +34,6 @@ #include #include #include -#include #include "ipath_kernel.h" diff --git a/drivers/staging/rdma/ipath/ipath_user_sdma.c b/drivers/staging/rdma/ipath/ipath_user_sdma.c index e82b3ee..8c12e3c 100644 --- a/drivers/staging/rdma/ipath/ipath_user_sdma.c +++ b/drivers/staging/rdma/ipath/ipath_user_sdma.c @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/staging/rdma/ipath/ipath_verbs_mcast.c b/drivers/staging/rdma/ipath/ipath_verbs_mcast.c index 6216ea9..72d476f 100644 --- a/drivers/staging/rdma/ipath/ipath_verbs_mcast.c +++ b/drivers/staging/rdma/ipath/ipath_verbs_mcast.c @@ -32,7 +32,6 @@ */ #include -#include #include #include "ipath_verbs.h" -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] IB/hfi1: use TASK_COMM_LEN in hfi1_ctxtdata
Use comm[TASK_COMM_LEN] instead of comm[16]. Signed-off-by: Geliang Tang --- drivers/staging/rdma/hfi1/hfi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rdma/hfi1/hfi.h b/drivers/staging/rdma/hfi1/hfi.h index 8ca171b..a35213e 100644 --- a/drivers/staging/rdma/hfi1/hfi.h +++ b/drivers/staging/rdma/hfi1/hfi.h @@ -262,7 +262,7 @@ struct hfi1_ctxtdata { pid_t pid; pid_t subpid[HFI1_MAX_SHARED_CTXTS]; /* same size as task_struct .comm[], command that opened context */ - char comm[16]; + char comm[TASK_COMM_LEN]; /* so file ops can get at unit */ struct hfi1_devdata *dd; /* so functions that need physical port can get it easily */ -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] RDMA/amso1100: use offset_in_page macro
Use offset_in_page macro instead of (addr & ~PAGE_MASK). Signed-off-by: Geliang Tang --- drivers/staging/rdma/amso1100/c2_alloc.c| 2 +- drivers/staging/rdma/amso1100/c2_provider.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rdma/amso1100/c2_alloc.c b/drivers/staging/rdma/amso1100/c2_alloc.c index 78d247e..039872d 100644 --- a/drivers/staging/rdma/amso1100/c2_alloc.c +++ b/drivers/staging/rdma/amso1100/c2_alloc.c @@ -131,7 +131,7 @@ void c2_free_mqsp(__be16 *mqsp) *mqsp = (__force __be16) head->head; /* Compute the shared_ptr index */ - idx = ((unsigned long) mqsp & ~PAGE_MASK) >> 1; + idx = (offset_in_page(mqsp)) >> 1; idx -= (unsigned long) &(((struct sp_chunk *) 0)->shared_ptr[0]) >> 1; /* Point this index at the head */ diff --git a/drivers/staging/rdma/amso1100/c2_provider.c b/drivers/staging/rdma/amso1100/c2_provider.c index 25c3f00..956d76b 100644 --- a/drivers/staging/rdma/amso1100/c2_provider.c +++ b/drivers/staging/rdma/amso1100/c2_provider.c @@ -359,7 +359,7 @@ static struct ib_mr *c2_reg_phys_mr(struct ib_pd *ib_pd, for (i = 0; i < num_phys_buf; i++) { - if (buffer_list[i].addr & ~PAGE_MASK) { + if (offset_in_page(buffer_list[i].addr)) { pr_debug("Unaligned Memory Buffer: 0x%x\n", (unsigned int) buffer_list[i].addr); return ERR_PTR(-EINVAL); -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] IB/ipath: use offset_in_page macro
Use offset_in_page macro instead of (addr & ~PAGE_MASK). Signed-off-by: Geliang Tang --- drivers/staging/rdma/ipath/ipath_user_sdma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rdma/ipath/ipath_user_sdma.c b/drivers/staging/rdma/ipath/ipath_user_sdma.c index cc04b7b..e82b3ee 100644 --- a/drivers/staging/rdma/ipath/ipath_user_sdma.c +++ b/drivers/staging/rdma/ipath/ipath_user_sdma.c @@ -239,7 +239,7 @@ static int ipath_user_sdma_num_pages(const struct iovec *iov) /* truncate length to page boundary */ static int ipath_user_sdma_page_length(unsigned long addr, unsigned long len) { - const unsigned long offset = addr & ~PAGE_MASK; + const unsigned long offset = offset_in_page(addr); return ((offset + len) > PAGE_SIZE) ? (PAGE_SIZE - offset) : len; } @@ -298,7 +298,7 @@ static int ipath_user_sdma_pin_pages(const struct ipath_devdata *dd, dma_addr_t dma_addr = dma_map_page(&dd->pcidev->dev, pages[j], 0, flen, DMA_TO_DEVICE); - unsigned long fofs = addr & ~PAGE_MASK; + unsigned long fofs = offset_in_page(addr); if (dma_mapping_error(&dd->pcidev->dev, dma_addr)) { ret = -ENOMEM; -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] IB/hfi1: use offset_in_page macro
Use offset_in_page macro instead of (addr & ~PAGE_MASK). Signed-off-by: Geliang Tang --- drivers/staging/rdma/hfi1/file_ops.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rdma/hfi1/file_ops.c b/drivers/staging/rdma/hfi1/file_ops.c index 9a77221..7d28680 100644 --- a/drivers/staging/rdma/hfi1/file_ops.c +++ b/drivers/staging/rdma/hfi1/file_ops.c @@ -168,7 +168,7 @@ enum mmap_types { HFI1_MMAP_TOKEN_SET(TYPE, type) | \ HFI1_MMAP_TOKEN_SET(CTXT, ctxt) | \ HFI1_MMAP_TOKEN_SET(SUBCTXT, subctxt) | \ - HFI1_MMAP_TOKEN_SET(OFFSET, ((unsigned long)addr & ~PAGE_MASK))) + HFI1_MMAP_TOKEN_SET(OFFSET, (offset_in_page(addr #define EXP_TID_SET(field, value) \ (((value) & EXP_TID_TID##field##_MASK) << \ @@ -1335,9 +1335,9 @@ static int get_base_info(struct file *fp, void __user *ubase, __u32 len) */ binfo.user_regbase = HFI1_MMAP_TOKEN(UREGS, uctxt->ctxt, subctxt_fp(fp), 0); - offset = uctxt->ctxt - dd->first_user_ctxt) * + offset = offset_in_pageuctxt->ctxt - dd->first_user_ctxt) * HFI1_MAX_SHARED_CTXTS) + subctxt_fp(fp)) * - sizeof(*dd->events)) & ~PAGE_MASK; + sizeof(*dd->events)); binfo.events_bufbase = HFI1_MMAP_TOKEN(EVENTS, uctxt->ctxt, subctxt_fp(fp), offset); @@ -1573,7 +1573,7 @@ static int exp_tid_setup(struct file *fp, struct hfi1_tid_info *tinfo) vaddr = tinfo->vaddr; - if (vaddr & ~PAGE_MASK) { + if (offset_in_page(vaddr)) { ret = -EINVAL; goto bail; } -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rdma: add a blank line after function
Fixed warnings found by checkpatch.pl: Please use a blank line after function/struct/union/enum declarations FILE: drivers/staging/rdma/amso1100/c2_mq.c:158: FILE: drivers/staging/rdma/hfi1/file_ops.c:2069: FILE: drivers/staging/rdma/hfi1/sdma.c:744: FILE: drivers/staging/rdma/hfi1/verbs.c:1202: Signed-off-by: Geliang Tang --- drivers/staging/rdma/amso1100/c2_mq.c | 1 + drivers/staging/rdma/hfi1/file_ops.c | 1 + drivers/staging/rdma/hfi1/sdma.c | 1 + drivers/staging/rdma/hfi1/verbs.c | 1 + 4 files changed, 4 insertions(+) diff --git a/drivers/staging/rdma/amso1100/c2_mq.c b/drivers/staging/rdma/amso1100/c2_mq.c index 0cddc49..7827fb8 100644 --- a/drivers/staging/rdma/amso1100/c2_mq.c +++ b/drivers/staging/rdma/amso1100/c2_mq.c @@ -155,6 +155,7 @@ void c2_mq_req_init(struct c2_mq *q, u32 index, u32 q_size, u32 msg_size, q->hint_count = 0; return; } + void c2_mq_rep_init(struct c2_mq *q, u32 index, u32 q_size, u32 msg_size, u8 *pool_start, u16 __iomem *peer, u32 type) { diff --git a/drivers/staging/rdma/hfi1/file_ops.c b/drivers/staging/rdma/hfi1/file_ops.c index 72d3850..9a77221 100644 --- a/drivers/staging/rdma/hfi1/file_ops.c +++ b/drivers/staging/rdma/hfi1/file_ops.c @@ -2066,6 +2066,7 @@ static const struct file_operations ui_file_ops = { .open = ui_open, .release = ui_release, }; + #define UI_OFFSET 192 /* device minor offset for UI devices */ static int create_ui = 1; diff --git a/drivers/staging/rdma/hfi1/sdma.c b/drivers/staging/rdma/hfi1/sdma.c index aecd1a7..78d016b 100644 --- a/drivers/staging/rdma/hfi1/sdma.c +++ b/drivers/staging/rdma/hfi1/sdma.c @@ -741,6 +741,7 @@ u16 sdma_get_descq_cnt(void) return SDMA_DESCQ_CNT; return count; } + /** * sdma_select_engine_vl() - select sdma engine * @dd: devdata diff --git a/drivers/staging/rdma/hfi1/verbs.c b/drivers/staging/rdma/hfi1/verbs.c index 41bb59e..a43fccd 100644 --- a/drivers/staging/rdma/hfi1/verbs.c +++ b/drivers/staging/rdma/hfi1/verbs.c @@ -1199,6 +1199,7 @@ pio_bail: } return 0; } + /* * egress_pkey_matches_entry - return 1 if the pkey matches ent (ent * being an entry from the ingress partition key table), return 0 -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] IB/hfi1: class_name_user() should be static
Fixes the following sparse warning: drivers/staging/rdma/hfi1/device.c:127:12: warning: symbol 'class_name_user' was not declared. Should it be static? Signed-off-by: Geliang Tang --- drivers/staging/rdma/hfi1/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rdma/hfi1/device.c b/drivers/staging/rdma/hfi1/device.c index bc26a53..58472e5 100644 --- a/drivers/staging/rdma/hfi1/device.c +++ b/drivers/staging/rdma/hfi1/device.c @@ -124,7 +124,7 @@ static char *hfi1_devnode(struct device *dev, umode_t *mode) } static const char *hfi1_class_name_user = "hfi1_user"; -const char *class_name_user(void) +static const char *class_name_user(void) { return hfi1_class_name_user; } -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] IB/hfi1: use kvfree() in sdma.c
Use kvfree() instead of open-coding it. Signed-off-by: Geliang Tang --- drivers/staging/rdma/hfi1/sdma.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/rdma/hfi1/sdma.c b/drivers/staging/rdma/hfi1/sdma.c index aecd1a7..9c02a3d 100644 --- a/drivers/staging/rdma/hfi1/sdma.c +++ b/drivers/staging/rdma/hfi1/sdma.c @@ -966,10 +966,7 @@ static void sdma_clean(struct hfi1_devdata *dd, size_t num_engines) sde->descq = NULL; sde->descq_phys = 0; } - if (is_vmalloc_addr(sde->tx_ring)) - vfree(sde->tx_ring); - else - kfree(sde->tx_ring); + kvfree(sde->tx_ring); sde->tx_ring = NULL; } spin_lock_irq(&dd->sde_map_lock); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: comedi: make "unsigned int __force *" shorter
Use macro "uip" instead of "unsigned int __force *", like "vuip" in arch/alpha/include/asm/core_cia.h. Signed-off-by: Geliang Tang --- drivers/staging/comedi/comedi_compat32.c | 3 +-- drivers/staging/comedi/comedi_compat32.h | 2 ++ drivers/staging/comedi/comedi_fops.c | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/staging/comedi/comedi_compat32.c b/drivers/staging/comedi/comedi_compat32.c index f356386..adaef03 100644 --- a/drivers/staging/comedi/comedi_compat32.c +++ b/drivers/staging/comedi/comedi_compat32.c @@ -202,8 +202,7 @@ static int get_compat_cmd(struct comedi_cmd __user *cmd, err |= __get_user(temp.uint, &cmd32->stop_arg); err |= __put_user(temp.uint, &cmd->stop_arg); err |= __get_user(temp.uptr, &cmd32->chanlist); - err |= __put_user((unsigned int __force *)compat_ptr(temp.uptr), - &cmd->chanlist); + err |= __put_user((uip)compat_ptr(temp.uptr), &cmd->chanlist); err |= __get_user(temp.uint, &cmd32->chanlist_len); err |= __put_user(temp.uint, &cmd->chanlist_len); err |= __get_user(temp.uptr, &cmd32->data); diff --git a/drivers/staging/comedi/comedi_compat32.h b/drivers/staging/comedi/comedi_compat32.h index 5ce77f3..8446273 100644 --- a/drivers/staging/comedi/comedi_compat32.h +++ b/drivers/staging/comedi/comedi_compat32.h @@ -33,4 +33,6 @@ long comedi_compat_ioctl(struct file *, unsigned int cmd, unsigned long arg); #endif /* CONFIG_COMPAT */ +#define uipunsigned int __force * + #endif /* _COMEDI_COMPAT32_H */ diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 2ba9cdb..d37f4c5 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -1714,7 +1714,7 @@ static int do_cmd_ioctl(struct comedi_device *dev, dev_dbg(dev->class_dev, "test returned %d\n", ret); cmd = async->cmd; /* restore chanlist pointer before copying back */ - cmd.chanlist = (unsigned int __force *)user_chanlist; + cmd.chanlist = (uip)user_chanlist; cmd.data = NULL; if (copy_to_user(arg, &cmd, sizeof(cmd))) { dev_dbg(dev->class_dev, "fault writing cmd\n"); @@ -1800,7 +1800,7 @@ static int do_cmdtest_ioctl(struct comedi_device *dev, kfree(cmd.chanlist);/* free kernel copy of user chanlist */ /* restore chanlist pointer before copying back */ - cmd.chanlist = (unsigned int __force *)user_chanlist; + cmd.chanlist = (uip)user_chanlist; if (copy_to_user(arg, &cmd, sizeof(cmd))) { dev_dbg(dev->class_dev, "bad cmd address\n"); -- 2.3.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: lustre: lnet: fix type warning in lib-socket.c
This patch fixes the following sparse warning: drivers/staging/lustre/lnet/lnet/lib-socket.c:175:29: warning: incorrect type in assignment (different address spaces) expected char [noderef] *ifcu_buf got char * Signed-off-by: Geliang Tang --- drivers/staging/lustre/lnet/lnet/lib-socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c index 6f7ef4c..e3d1c42 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-socket.c +++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c @@ -172,7 +172,7 @@ lnet_ipif_enumerate(char ***namesp) goto out0; } - ifc.ifc_buf = (char *)ifr; + ifc.ifc_buf = (char __user *)ifr; ifc.ifc_len = nalloc * sizeof(*ifr); rc = lnet_sock_ioctl(SIOCGIFCONF, (unsigned long)&ifc); -- 2.3.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2] staging: comedi: fix cast warning in comedi_compat32.c
On Mon, Jun 22, 2015 at 10:43:38AM +0100, Ian Abbott wrote: > Now it removes the call to compat_ptr(), so it won't work. Your first patch > was better, apart from exceeding the 80 character line limit. Thank you. I revised the patch again. Geliang Tang (1): staging: comedi: fix cast warning in comedi_compat32.c drivers/staging/comedi/comedi_compat32.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.3.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3] staging: comedi: fix cast warning in comedi_compat32.c
This patch fixes the following sparse warning: drivers/staging/comedi/comedi_compat32.c:205:16: warning: cast removes address space of expression Signed-off-by: Geliang Tang --- Changes in v3: - fix the 80 character line limit. Changes in v2: - compat_ptr() is substituted by 'unsigned long'. --- drivers/staging/comedi/comedi_compat32.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/comedi/comedi_compat32.c b/drivers/staging/comedi/comedi_compat32.c index 2584824..f356386 100644 --- a/drivers/staging/comedi/comedi_compat32.c +++ b/drivers/staging/comedi/comedi_compat32.c @@ -202,7 +202,8 @@ static int get_compat_cmd(struct comedi_cmd __user *cmd, err |= __get_user(temp.uint, &cmd32->stop_arg); err |= __put_user(temp.uint, &cmd->stop_arg); err |= __get_user(temp.uptr, &cmd32->chanlist); - err |= __put_user(compat_ptr(temp.uptr), &cmd->chanlist); + err |= __put_user((unsigned int __force *)compat_ptr(temp.uptr), + &cmd->chanlist); err |= __get_user(temp.uint, &cmd32->chanlist_len); err |= __put_user(temp.uint, &cmd->chanlist_len); err |= __get_user(temp.uptr, &cmd32->data); -- 2.3.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: comedi: fix sparse warning in comedi_compat32.c
On Sat, Jun 20, 2015 at 04:08:19PM +0530, Sudip Mukherjee wrote: > compat_ptr is already a typecast. > static inline void __user *compat_ptr(compat_uptr_t uptr) > { > return (void __user *)(unsigned long)uptr; > } > > so you are adding another typecast to an already exitsing typecast. :( > > and besides, this also introduces one new checkpatch warning of > line more than 80 char. > > regards > sudip Thank you for your review. I revised the patch as you suggested. Here it is. Geliang Tang (1): staging: comedi: fix cast warning in comedi_compat32.c drivers/staging/comedi/comedi_compat32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.3.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] staging: comedi: fix cast warning in comedi_compat32.c
This patch fixes the following sparse warning: drivers/staging/comedi/comedi_compat32.c:205:16: warning: cast removes address space of expression Signed-off-by: Geliang Tang --- Changes in v2: - compat_ptr() is substituted by 'unsigned long'. --- drivers/staging/comedi/comedi_compat32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/comedi_compat32.c b/drivers/staging/comedi/comedi_compat32.c index 2584824..894a50c 100644 --- a/drivers/staging/comedi/comedi_compat32.c +++ b/drivers/staging/comedi/comedi_compat32.c @@ -202,7 +202,7 @@ static int get_compat_cmd(struct comedi_cmd __user *cmd, err |= __get_user(temp.uint, &cmd32->stop_arg); err |= __put_user(temp.uint, &cmd->stop_arg); err |= __get_user(temp.uptr, &cmd32->chanlist); - err |= __put_user(compat_ptr(temp.uptr), &cmd->chanlist); + err |= __put_user((unsigned long)(temp.uptr), &cmd->chanlist); err |= __get_user(temp.uint, &cmd32->chanlist_len); err |= __put_user(temp.uint, &cmd->chanlist_len); err |= __get_user(temp.uptr, &cmd32->data); -- 2.3.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: comedi: fix sparse warning in comedi_compat32.c
This patch fixes the following sparse warning: drivers/staging/comedi/comedi_compat32.c:205:16: warning: cast removes address space of expression Signed-off-by: Geliang Tang --- drivers/staging/comedi/comedi_compat32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/comedi_compat32.c b/drivers/staging/comedi/comedi_compat32.c index 2584824..29a10fe4 100644 --- a/drivers/staging/comedi/comedi_compat32.c +++ b/drivers/staging/comedi/comedi_compat32.c @@ -202,7 +202,7 @@ static int get_compat_cmd(struct comedi_cmd __user *cmd, err |= __get_user(temp.uint, &cmd32->stop_arg); err |= __put_user(temp.uint, &cmd->stop_arg); err |= __get_user(temp.uptr, &cmd32->chanlist); - err |= __put_user(compat_ptr(temp.uptr), &cmd->chanlist); + err |= __put_user((unsigned int __force *)compat_ptr(temp.uptr), &cmd->chanlist); err |= __get_user(temp.uint, &cmd32->chanlist_len); err |= __put_user(temp.uint, &cmd->chanlist_len); err |= __get_user(temp.uptr, &cmd32->data); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: comedi: fix sparse warning in ni_mio_common.c
This patch fixes the following sparse warning: drivers/staging/comedi/drivers/ni_mio_common.c:573:26: warning: shift too big (4294967295) for type int Signed-off-by: Geliang Tang --- drivers/staging/comedi/drivers/ni_mio_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 6cc304a..420f752 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -570,7 +570,7 @@ static inline void ni_set_bitfield(struct comedi_device *dev, int reg, static inline unsigned ni_stc_dma_channel_select_bitfield(unsigned channel) { if (channel < 4) - return 1 << channel; + return 1 << (channel & 0x03); if (channel == 4) return 0x3; if (channel == 5) -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 2/2] staging: comedi: keep the consistency
Changed "register 0x%x" to "register=0x%x" to keep the consistency of this file. Signed-off-by: Geliang Tang Reviewed-by: Ian Abbott --- drivers/staging/comedi/drivers/ni_mio_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index f01ef89..6cc304a 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -3761,7 +3761,7 @@ static unsigned int ni_gpct_to_stc_register(struct comedi_device *dev, if (reg < ARRAY_SIZE(ni_gpct_to_stc_regmap)) { regmap = &ni_gpct_to_stc_regmap[reg]; } else { - dev_warn(dev->class_dev, "%s: unhandled register 0x%x\n", + dev_warn(dev->class_dev, "%s: unhandled register=0x%x\n", __func__, reg); return 0; } -- 2.3.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 0/2] staging: comedi: fix coding style issues
On Sun, May 24, 2015 at 01:11:08PM -0700, Greg KH wrote: > That's multiple things in one patch :( > > Also, this is an attachment, which I can't apply, please resend it as a > proper email. Thanks for your reply. I split it into two patches, as you suggested. Here are them. --- Changes in v3: - split it into two patches. Changes in v2: - remove the kernel version in the commit message. --- Geliang Tang (2): staging: comedi: fix checkpatch error staging: comedi: keep the consistency drivers/staging/comedi/drivers/ni_mio_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.3.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 1/2] staging: comedi: fix checkpatch error
Fixed an error found by checkpatch.pl. ERROR: space required after that ',' (ctx:VxV) ./drivers/ni_mio_common.c:3764 Signed-off-by: Geliang Tang Reviewed-by: Ian Abbott --- drivers/staging/comedi/drivers/ni_mio_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 9dfd4e6..f01ef89 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -3761,7 +3761,7 @@ static unsigned int ni_gpct_to_stc_register(struct comedi_device *dev, if (reg < ARRAY_SIZE(ni_gpct_to_stc_regmap)) { regmap = &ni_gpct_to_stc_regmap[reg]; } else { - dev_warn(dev->class_dev,"%s: unhandled register 0x%x\n", + dev_warn(dev->class_dev, "%s: unhandled register 0x%x\n", __func__, reg); return 0; } -- 2.3.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] staging: comedi: fix coding style issues
On Mon, May 18, 2015 at 12:37:09PM +0100, Ian Abbott wrote: > On 16/05/15 05:16, Geliang Tang wrote: > >1) Fixed an error found by checkpatch.pl. > >ERROR: space required after that ',' (ctx:VxV) > >./drivers/ni_mio_common.c:3764 > >2) Changed "register 0x%x" to "register=0x%x" to keep the consistency > >of this file. > >3) The kernel version is next-20150515, 4.1.0-rc3. > > You shouldn't mention point 3 in the commit message as it will look a bit > strange when it ends up in the commit log. If you need to mention that, it > should go after the commit message, separated from the patch by a "---" line > like this: > > Body of commit message goes here. > > Signed off by and Cc lines go here. > --- > Additional patch commentary goes here. > --- > Actual patch goes here. > > Git will ignore the additional commentary when the patch is applied. > > > > >Signed-off-by: Geliang Tang > >--- > > drivers/staging/comedi/drivers/ni_mio_common.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > >diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c > >b/drivers/staging/comedi/drivers/ni_mio_common.c > >index 9dfd4e6..6cc304a 100644 > >--- a/drivers/staging/comedi/drivers/ni_mio_common.c > >+++ b/drivers/staging/comedi/drivers/ni_mio_common.c > >@@ -3761,7 +3761,7 @@ static unsigned int ni_gpct_to_stc_register(struct > >comedi_device *dev, > > if (reg < ARRAY_SIZE(ni_gpct_to_stc_regmap)) { > > regmap = &ni_gpct_to_stc_regmap[reg]; > > } else { > >-dev_warn(dev->class_dev,"%s: unhandled register 0x%x\n", > >+dev_warn(dev->class_dev, "%s: unhandled register=0x%x\n", > > __func__, reg); > > return 0; > > } > > > > Apart from that niggle, the patch looks good! > > Reviewed-by: Ian Abbott > > -- > -=( Ian Abbott @ MEV Ltd.E-mail: )=- > -=( Web: http://www.mev.co.uk/ )=- Thank you for your review. I revised the patch as you suggested. Here it is. >From d864f6af18a44031a241e10e64d98f9e6b8c0660 Mon Sep 17 00:00:00 2001 From: Geliang Tang Date: Wed, 20 May 2015 14:26:13 + Subject: [PATCH v2] staging: comedi: fix coding style issues 1) Fixed an error found by checkpatch.pl. ERROR: space required after that ',' (ctx:VxV) ./drivers/ni_mio_common.c:3764 2) Changed "register 0x%x" to "register=0x%x" to keep the consistency of this file. Signed-off-by: Geliang Tang Reviewed-by: Ian Abbott --- Changes in v2: - remove the kernel version in the commit message. --- drivers/staging/comedi/drivers/ni_mio_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 9dfd4e6..6cc304a 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -3761,7 +3761,7 @@ static unsigned int ni_gpct_to_stc_register(struct comedi_device *dev, if (reg < ARRAY_SIZE(ni_gpct_to_stc_regmap)) { regmap = &ni_gpct_to_stc_regmap[reg]; } else { - dev_warn(dev->class_dev,"%s: unhandled register 0x%x\n", + dev_warn(dev->class_dev, "%s: unhandled register=0x%x\n", __func__, reg); return 0; } -- 2.3.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: comedi: fix coding style issues
1) Fixed an error found by checkpatch.pl. ERROR: space required after that ',' (ctx:VxV) ./drivers/ni_mio_common.c:3764 2) Changed "register 0x%x" to "register=0x%x" to keep the consistency of this file. 3) The kernel version is next-20150515, 4.1.0-rc3. Signed-off-by: Geliang Tang --- drivers/staging/comedi/drivers/ni_mio_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 9dfd4e6..6cc304a 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -3761,7 +3761,7 @@ static unsigned int ni_gpct_to_stc_register(struct comedi_device *dev, if (reg < ARRAY_SIZE(ni_gpct_to_stc_regmap)) { regmap = &ni_gpct_to_stc_regmap[reg]; } else { - dev_warn(dev->class_dev,"%s: unhandled register 0x%x\n", + dev_warn(dev->class_dev, "%s: unhandled register=0x%x\n", __func__, reg); return 0; } -- 2.3.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel