[PATCH 7/9] rtlwifi: rtl8723ae: Fix Smatch warning
Smatch reports the following: CHECK drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_btc.c drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_btc.c:137 rtl8723e_dm_bt_need_to_dec_bt_pwr() warn: inconsistent indenting Signed-off-by: Larry Finger --- drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_btc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_btc.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_btc.c index 00a0531..44de695 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_btc.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/hal_btc.c @@ -134,9 +134,9 @@ static bool rtl8723e_dm_bt_need_to_dec_bt_pwr(struct ieee80211_hw *hw) if (mgnt_link_status_query(hw) == RT_MEDIA_CONNECT) { RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, "Need to decrease bt power\n"); - rtlpriv->btcoexist.cstate |= - BT_COEX_STATE_DEC_BT_POWER; - return true; + rtlpriv->btcoexist.cstate |= + BT_COEX_STATE_DEC_BT_POWER; + return true; } rtlpriv->btcoexist.cstate &= ~BT_COEX_STATE_DEC_BT_POWER; -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v10 3/3] staging/android: refactor SYNC IOCTLs
From: Gustavo Padovan Change SYNC_IOC_FILE_INFO (former SYNC_IOC_FENCE_INFO) behaviour to avoid future API breaks and optimize buffer allocation. Now num_fences can be filled by the caller to inform how many fences it wants to retrieve from the kernel. If the num_fences passed is greater than zero info->sync_fence_info should point to a buffer with enough space to fit all fences. However if num_fences passed to the kernel is 0, the kernel will reply with number of fences of the sync_file. Sending first an ioctl with num_fences = 0 can optimize buffer allocation, in a first call with num_fences = 0 userspace will receive the actual number of fences in the num_fences filed. Then it can allocate a buffer with the correct size on sync_fence_info and call SYNC_IOC_FILE_INFO again, but now with the actual value of num_fences in the sync_file. info->sync_fence_info was converted to __u64 pointer to prevent 32bit compatibility issues. And a flags member was added. An example userspace code for the later would be: struct sync_file_info *info; int err, size, num_fences; info = malloc(sizeof(*info)); info.flags = 0; err = ioctl(fd, SYNC_IOC_FILE_INFO, info); num_fences = info->num_fences; if (num_fences) { info.flags = 0; size = sizeof(struct sync_fence_info) * num_fences; info->num_fences = num_fences; info->sync_fence_info = (uint64_t) calloc(num_fences, sizeof(struct sync_fence_info)); err = ioctl(fd, SYNC_IOC_FILE_INFO, info); } Finally the IOCTLs numbers were changed to avoid any potential old userspace running the old API to get weird errors. Changing the opcodes will make them fail right away. This is just a precaution, there no upstream users of these interfaces yet and the only user is Android, but we don't expect anyone trying to run android userspace and all it dependencies on top of upstream kernels. Signed-off-by: Gustavo Padovan Reviewed-by: Maarten Lankhorst Acked-by: Greg Hackmann Acked-by: Rob Clark Acked-by: Daniel Vetter --- v2: fix fence_info memory leak v3: Comments from Emil Velikov - improve commit message - remove __u64 cast - remove check for output fields in file_info - clean up sync_fill_fence_info() Comments from Maarten Lankhorst - remove in.num_fences && !in.sync_fence_info check - remove info->len and use only num_fences to calculate size Comments from Dan Carpenter - fix info->sync_fence_info documentation v4: remove allocated struct sync_file_info (comment from Maarten) v5: merge all commits that were changing the ABI v6: fix -Wint-to-pointer-cast error on info.sync_fence_info --- drivers/staging/android/sync.c | 76 - drivers/staging/android/uapi/sync.h | 36 +- 2 files changed, 67 insertions(+), 45 deletions(-) diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c index 3a8f210..f9c6094 100644 --- a/drivers/staging/android/sync.c +++ b/drivers/staging/android/sync.c @@ -445,6 +445,11 @@ static long sync_file_ioctl_merge(struct sync_file *sync_file, goto err_put_fd; } + if (data.flags || data.pad) { + err = -EINVAL; + goto err_put_fd; + } + fence2 = sync_file_fdget(data.fd2); if (!fence2) { err = -ENOENT; @@ -479,13 +484,9 @@ err_put_fd: return err; } -static int sync_fill_fence_info(struct fence *fence, void *data, int size) +static void sync_fill_fence_info(struct fence *fence, + struct sync_fence_info *info) { - struct sync_fence_info *info = data; - - if (size < sizeof(*info)) - return -ENOMEM; - strlcpy(info->obj_name, fence->ops->get_timeline_name(fence), sizeof(info->obj_name)); strlcpy(info->driver_name, fence->ops->get_driver_name(fence), @@ -495,58 +496,63 @@ static int sync_fill_fence_info(struct fence *fence, void *data, int size) else info->status = 0; info->timestamp_ns = ktime_to_ns(fence->timestamp); - - return sizeof(*info); } static long sync_file_ioctl_fence_info(struct sync_file *sync_file, unsigned long arg) { - struct sync_file_info *info; + struct sync_file_info info; + struct sync_fence_info *fence_info = NULL; __u32 size; - __u32 len = 0; int ret, i; - if (copy_from_user(&size, (void __user *)arg, sizeof(size))) + if (copy_from_user(&info, (void __user *)arg, sizeof(info))) return -EFAULT; - if (size < sizeof(struct sync_file_info)) + if (info.flags || info.pad) return -EINVAL; - if (size > 4096) -
[PATCH 24/42] staging: comedi: ni_660x: add a comment about the initial DIO state
The (*auto_attach) initializes all the DIO channels to a default state. Add a comment for clarity. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_660x.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index 3415a15..6f84946 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -1073,6 +1073,11 @@ static int ni_660x_auto_attach(struct comedi_device *dev, for (i = 0; i < n_counters; ++i) ni_tio_init_counter(&devpriv->counter_dev->counters[i]); +/* + * Default the DIO channels as: + * chan 0-7: DIO inputs + * chan 8-39: counter signal inputs + */ for (i = 0; i < NUM_PFI_CHANNELS; ++i) { if (i < 8) ni_660x_set_pfi_routing(dev, i, NI_660X_PFI_OUTPUT_DIO); -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 41/42] staging: comedi: ni_660x: refactor GPCT_OFFSET
This driver supports boards that have 1 or 2 TIO chips with base addresses 0x800 apart. Replace the static const array 'GPCT_OFFSET' with a define and calculate the base address based on the chip index. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_660x.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index 3b57ce5..73ccd62 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -204,9 +204,7 @@ static const struct ni_660x_register_data ni_660x_reg_data[NI660X_NUM_REGS] = { [NI660X_IO_CFG_38_39] = { 0x7a2, 2 } /* read/write */ }; -/* Offset of the GPCT chips from the base-address of the card */ -/* First chip is at base-address + 0x00, etc. */ -static const unsigned GPCT_OFFSET[2] = { 0x0, 0x800 }; +#define NI660X_CHIP_OFFSET 0x800 enum ni_660x_boardid { BOARD_PCI6601, @@ -271,7 +269,8 @@ struct ni_660x_private { static void ni_660x_write(struct comedi_device *dev, unsigned int chip, unsigned int bits, unsigned int reg) { - unsigned int addr = GPCT_OFFSET[chip] + ni_660x_reg_data[reg].offset; + unsigned int addr = (chip * NI660X_CHIP_OFFSET) + + ni_660x_reg_data[reg].offset; if (ni_660x_reg_data[reg].size == 2) writew(bits, dev->mmio + addr); @@ -282,7 +281,8 @@ static void ni_660x_write(struct comedi_device *dev, unsigned int chip, static unsigned int ni_660x_read(struct comedi_device *dev, unsigned int chip, unsigned int reg) { - unsigned int addr = GPCT_OFFSET[chip] + ni_660x_reg_data[reg].offset; + unsigned int addr = (chip * NI660X_CHIP_OFFSET) + + ni_660x_reg_data[reg].offset; if (ni_660x_reg_data[reg].size == 2) return readw(dev->mmio + addr); -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 19/42] staging: comedi: ni_660x: Prefer 'unsigned int' to bare use of 'unsigned'
Fix the checkpatch.pl issues. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_660x.c | 40 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index 6a3a12e..6ca5c67 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -299,7 +299,7 @@ enum ni_660x_boardid { struct ni_660x_board { const char *name; - unsigned n_chips; /* total number of TIO chips */ + unsigned int n_chips; /* total number of TIO chips */ }; static const struct ni_660x_board ni_660x_boards[] = { @@ -337,7 +337,7 @@ struct ni_660x_private { spinlock_t mite_channel_lock; /* interrupt_lock prevents races between interrupt and comedi_poll */ spinlock_t interrupt_lock; - unsigned dma_cfg[NI_660X_MAX_NUM_CHIPS]; + unsigned int dma_cfg[NI_660X_MAX_NUM_CHIPS]; spinlock_t soft_reg_copy_lock; unsigned short pfi_output_selects[NUM_PFI_CHANNELS]; }; @@ -533,17 +533,17 @@ static inline struct mite_dma_descriptor_ring *mite_ring(struct ni_660x_private struct ni_gpct *counter) { - unsigned chip = counter->chip_index; + unsigned int chip = counter->chip_index; return priv->mite_rings[chip][counter->counter_index]; } static inline void ni_660x_set_dma_channel(struct comedi_device *dev, - unsigned mite_channel, + unsigned int mite_channel, struct ni_gpct *counter) { struct ni_660x_private *devpriv = dev->private; - unsigned chip = counter->chip_index; + unsigned int chip = counter->chip_index; unsigned long flags; spin_lock_irqsave(&devpriv->soft_reg_copy_lock, flags); @@ -558,11 +558,11 @@ static inline void ni_660x_set_dma_channel(struct comedi_device *dev, } static inline void ni_660x_unset_dma_channel(struct comedi_device *dev, -unsigned mite_channel, +unsigned int mite_channel, struct ni_gpct *counter) { struct ni_660x_private *devpriv = dev->private; - unsigned chip = counter->chip_index; + unsigned int chip = counter->chip_index; unsigned long flags; spin_lock_irqsave(&devpriv->soft_reg_copy_lock, flags); @@ -642,7 +642,7 @@ static int ni_660x_cancel(struct comedi_device *dev, struct comedi_subdevice *s) static void set_tio_counterswap(struct comedi_device *dev, int chip) { - unsigned bits = 0; + unsigned int bits = 0; /* * See P. 3.5 of the Register-Level Programming manual. @@ -670,7 +670,7 @@ static irqreturn_t ni_660x_interrupt(int irq, void *d) struct comedi_device *dev = d; struct ni_660x_private *devpriv = dev->private; struct comedi_subdevice *s; - unsigned i; + unsigned int i; unsigned long flags; if (!dev->attached) @@ -718,7 +718,7 @@ static int ni_660x_buf_change(struct comedi_device *dev, static int ni_660x_allocate_private(struct comedi_device *dev) { struct ni_660x_private *devpriv; - unsigned i; + unsigned int i; devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv)); if (!devpriv) @@ -737,8 +737,8 @@ static int ni_660x_alloc_mite_rings(struct comedi_device *dev) { const struct ni_660x_board *board = dev->board_ptr; struct ni_660x_private *devpriv = dev->private; - unsigned i; - unsigned j; + unsigned int i; + unsigned int j; for (i = 0; i < board->n_chips; ++i) { for (j = 0; j < counters_per_chip; ++j) { @@ -755,8 +755,8 @@ static void ni_660x_free_mite_rings(struct comedi_device *dev) { const struct ni_660x_board *board = dev->board_ptr; struct ni_660x_private *devpriv = dev->private; - unsigned i; - unsigned j; + unsigned int i; + unsigned int j; for (i = 0; i < board->n_chips; ++i) { for (j = 0; j < counters_per_chip; ++j) @@ -767,7 +767,7 @@ static void ni_660x_free_mite_rings(struct comedi_device *dev) static void init_tio_chip(struct comedi_device *dev, int chipset) { struct ni_660x_private *devpriv = dev->private; - unsigned i; + unsigned int i; /* init dma configuration register */ devpriv->dma_cfg[chipset] = 0; @@ -782,7 +782,7 @@ static int ni_660x_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *d
Re: [PATCH v9 2/3] kernel.h: add to_user_ptr()
2016-03-17 Joe Perches : > On Thu, 2016-03-17 at 18:19 -0300, Gustavo Padovan wrote: > > 2016-03-17 Joe Perches : > > > On Thu, 2016-03-17 at 16:50 -0400, Rob Clark wrote: > > > > On Thu, Mar 17, 2016 at 4:40 PM, Joe Perches wrote: > > > [] > > > > > It's a name that seems like it should be a straightforward > > > > > cast of a kernel pointer to a __user pointer like: > > > > > > > > > > static inline void __user *to_user_ptr(void *p) > > > > > { > > > > > return (void __user *)p; > > > > > } > > > > ahh, ok. I guess I was used to using it in the context of ioctl > > > > structs.. in that context u64 -> (void __user *) made more sense. > > > > > > > > Maybe uapi_to_ptr()? (ok, not super-creative.. maybe someone has a > > > > better idea) > > > Maybe u64_to_user_ptr? > > That is a good name. If everyone agrees I can resend this patch > > changing it to u64_to_user_ptr. Then should we still keep it on > > kernel.h? > > I've no particular opinion about location, > but maybe compat.h might be appropriate. I don't think this is really related to compat. I'd keep kernel.h. The problem I'm trying to solve here is: CC drivers/dma-buf/sync_file.o drivers/dma-buf/sync_file.c: In function ‘sync_file_ioctl_fence_info’: drivers/dma-buf/sync_file.c:341:19: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] if (copy_to_user((void __user *)info.sync_fence_info, fence_info, where info.sync_fence_info is __u64. Gustavo ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: staging: most: warning: ‘mbo’ may be used uninitialized in this function
On Fri, Mar 18, 2016 at 01:41:19PM +0100, Geert Uytterhoeven wrote: > On Fri, Mar 18, 2016 at 6:42 AM, Linux Kernel Mailing List > wrote: > > Web: > > https://git.kernel.org/torvalds/c/f45b0fba43f415f69982df743dfa9b5d1b57785e > > Commit: f45b0fba43f415f69982df743dfa9b5d1b57785e > > Parent: b3c9f3c56c41cbebe7804b48ba8e6e484509c2c0 > > Refname:refs/heads/master > > Author: Christian Gromm > > AuthorDate: Tue Dec 22 10:53:06 2015 +0100 > > Committer: Greg Kroah-Hartman > > CommitDate: Sun Feb 7 17:34:58 2016 -0800 > > > > staging: most: remove stacked_mbo > > > > This patch makes use of kfifo_peek and kfifo_skip, which renders the > > variable stacked_mbo useless. It is therefore removed. > > > > Signed-off-by: Christian Gromm > > Signed-off-by: Greg Kroah-Hartman > > --- > > drivers/staging/most/aim-cdev/cdev.c | 16 +++- > > 1 file changed, 3 insertions(+), 13 deletions(-) > > > > diff --git a/drivers/staging/most/aim-cdev/cdev.c > > b/drivers/staging/most/aim-cdev/cdev.c > > index d9c3f56..0ee2f08 100644 > > --- a/drivers/staging/most/aim-cdev/cdev.c > > +++ b/drivers/staging/most/aim-cdev/cdev.c > > > @@ -249,11 +246,7 @@ aim_read(struct file *filp, char __user *buf, size_t > > count, loff_t *offset) > > struct aim_channel *c = filp->private_data; > > > > mutex_lock(&c->io_mutex); > > - if (c->stacked_mbo) { > > - mbo = c->stacked_mbo; > > - goto start_copy; > > - } > > - while ((!kfifo_out(&c->fifo, &mbo, 1)) && (c->dev)) { > > + while (c->dev && !kfifo_peek(&c->fifo, &mbo)) { > > drivers/staging/most/aim-cdev/cdev.c:241: warning: ‘mbo’ may be used > uninitialized in this function > > From looking at the code, it's not obvious to me if this is a false > positive or not. > Can it happen that mbo is not initialized fully, e.g. if less than sizeof(mbo) > bytes have been read from the kfifo? > mbo is not touched by the kfifo_peek in the case where (c->dev == NULL), but since we protect the c->dev by the io_mutex it remains NULL until the check after the while loop where we quit. Looks like the analyzer suspects that c->dev may be changed to a valid pointer before the second check. So, it is false positive, but it is worth to initialize the mbo with the NULL to get rid of the warning. regards andy ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v9 2/3] kernel.h: add to_user_ptr()
On Thu, 2016-03-17 at 18:19 -0300, Gustavo Padovan wrote: > 2016-03-17 Joe Perches : > > On Thu, 2016-03-17 at 16:50 -0400, Rob Clark wrote: > > > On Thu, Mar 17, 2016 at 4:40 PM, Joe Perches wrote: > > [] > > > > It's a name that seems like it should be a straightforward > > > > cast of a kernel pointer to a __user pointer like: > > > > > > > > static inline void __user *to_user_ptr(void *p) > > > > { > > > > return (void __user *)p; > > > > } > > > ahh, ok. I guess I was used to using it in the context of ioctl > > > structs.. in that context u64 -> (void __user *) made more sense. > > > > > > Maybe uapi_to_ptr()? (ok, not super-creative.. maybe someone has a > > > better idea) > > Maybe u64_to_user_ptr? > That is a good name. If everyone agrees I can resend this patch > changing it to u64_to_user_ptr. Then should we still keep it on > kernel.h? I've no particular opinion about location, but maybe compat.h might be appropriate. Maybe add all variants: void __user *u32_to_user_ptr(u32 val) void __user *u64_to_user_ptr(u64 val) u32 user_ptr_to_u32(void __user *p) u64 user_ptr_to_u64(void __user *p) Maybe there's something about 32 bit userspace on 64 OS that should be done too. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
re: staging: most: hdm-dim2: Replace request_irq with devm_request_irq
Hello Amitoj Kaur Chawla, The patch 3eced21a5afb: "staging: most: hdm-dim2: Replace request_irq with devm_request_irq" from Feb 18, 2016, leads to the following static checker warning: drivers/staging/most/hdm-dim2/dim2_hdm.c:841 dim2_probe() error: 'dev->netinfo_task' dereferencing possible ERR_PTR() drivers/staging/most/hdm-dim2/dim2_hdm.c 737 struct kobject *kobj; 738 739 dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); 740 if (!dev) 741 return -ENOMEM; 742 743 dev->atx_idx = -1; 744 745 platform_set_drvdata(pdev, dev); 746 #if defined(ENABLE_HDM_TEST) 747 test_dev = dev; 748 #else 749 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 750 dev->io_base = devm_ioremap_resource(&pdev->dev, res); 751 if (IS_ERR(dev->io_base)) 752 return PTR_ERR(dev->io_base); 753 754 ret = platform_get_irq(pdev, 0); 755 if (ret < 0) { 756 dev_err(&pdev->dev, "failed to get irq\n"); 757 return -ENODEV; 758 } 759 dev->irq_ahb0 = ret; 760 761 ret = devm_request_irq(&pdev->dev, dev->irq_ahb0, dim2_ahb_isr, 0, 762 "mlb_ahb0", dev); 763 if (ret) { 764 dev_err(&pdev->dev, "failed to request IRQ: %d, err: %d\n", 765 dev->irq_ahb0, ret); 766 return ret; 767 } 768 #endif 769 init_waitqueue_head(&dev->netinfo_waitq); 770 dev->deliver_netinfo = 0; 771 dev->netinfo_task = kthread_run(&deliver_netinfo_thread, (void *)dev, 772 "dim2_netinfo"); 773 if (IS_ERR(dev->netinfo_task)) 774 ret = PTR_ERR(dev->netinfo_task); Presumably this should be "return PTR_ERR(dev->netinfo_task);" or do we need to free something above? 775 776 for (i = 0; i < DMA_CHANNELS; i++) { 777 struct most_channel_capability *cap = dev->capabilities + i; 778 struct hdm_channel *hdm_ch = dev->hch + i; regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Drivers: hv: vmbus: handle various crash scenarios
Kdump keeps biting. Turns out CHANNELMSG_UNLOAD_RESPONSE is always delivered to CPU0 regardless of what CPU we're sending CHANNELMSG_UNLOAD from. vmbus_wait_for_unload() doesn't account for the fact that in case we're crashing on some other CPU and CPU0 is still alive and operational CHANNELMSG_UNLOAD_RESPONSE will be delivered there completing vmbus_connection.unload_event, our wait on the current CPU will never end. Do the following: 1) Check for completion_done() in the loop. In case interrupt handler is still alive we'll get the confirmation we need. 2) Always read CPU0's message page as CHANNELMSG_UNLOAD_RESPONSE will be delivered there. We can race with still-alive interrupt handler doing the same but we don't care as we're checking completion_done() now. 3) Cleanup message pages on all CPUs. This is required (at least for the current CPU as we're clearing CPU0 messages now but we may want to bring up additional CPUs on crash) as new messages won't be delivered till we consume what's pending. On boot we'll place message pages somewhere else and we won't be able to read stale messages. Signed-off-by: Vitaly Kuznetsov --- drivers/hv/channel_mgmt.c | 30 +- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c index b10e8f74..5f37057 100644 --- a/drivers/hv/channel_mgmt.c +++ b/drivers/hv/channel_mgmt.c @@ -512,14 +512,26 @@ static void init_vp_index(struct vmbus_channel *channel, const uuid_le *type_gui static void vmbus_wait_for_unload(void) { - int cpu = smp_processor_id(); - void *page_addr = hv_context.synic_message_page[cpu]; + int cpu; + void *page_addr = hv_context.synic_message_page[0]; struct hv_message *msg = (struct hv_message *)page_addr + VMBUS_MESSAGE_SINT; struct vmbus_channel_message_header *hdr; bool unloaded = false; - while (1) { + /* +* CHANNELMSG_UNLOAD_RESPONSE is always delivered to CPU0. When we're +* crashing on a different CPU let's hope that IRQ handler on CPU0 is +* still functional and vmbus_unload_response() will complete +* vmbus_connection.unload_event. If not, the last thing we can do is +* read message page for CPU0 regardless of what CPU we're on. +*/ + while (!unloaded) { + if (completion_done(&vmbus_connection.unload_event)) { + unloaded = true; + break; + } + if (READ_ONCE(msg->header.message_type) == HVMSG_NONE) { mdelay(10); continue; @@ -530,9 +542,17 @@ static void vmbus_wait_for_unload(void) unloaded = true; vmbus_signal_eom(msg); + } - if (unloaded) - break; + /* +* We're crashing and already got the UNLOAD_RESPONSE, cleanup all +* maybe-pending messages on all CPUs to be able to receive new +* messages after we reconnect. +*/ + for_each_online_cpu(cpu) { + page_addr = hv_context.synic_message_page[cpu]; + msg = (struct hv_message *)page_addr + VMBUS_MESSAGE_SINT; + msg->header.message_type = HVMSG_NONE; } } -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 31/42] staging: comedi: ni_mio_common: ni_gpct_device_destroy() can handle a NULL pointer
Remove the unnecessary NULL pointer check. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_mio_common.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index dcaf7e8..71c8fd2 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -5675,8 +5675,6 @@ static void mio_common_detach(struct comedi_device *dev) { struct ni_private *devpriv = dev->private; - if (devpriv) { - if (devpriv->counter_dev) - ni_gpct_device_destroy(devpriv->counter_dev); - } + if (devpriv) + ni_gpct_device_destroy(devpriv->counter_dev); } -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v9 2/3] kernel.h: add to_user_ptr()
On Thu, Mar 17, 2016 at 5:19 PM, Gustavo Padovan wrote: > 2016-03-17 Joe Perches : > >> On Thu, 2016-03-17 at 16:50 -0400, Rob Clark wrote: >> > On Thu, Mar 17, 2016 at 4:40 PM, Joe Perches wrote: >> [] >> > > It's a name that seems like it should be a straightforward >> > > cast of a kernel pointer to a __user pointer like: >> > > >> > > static inline void __user *to_user_ptr(void *p) >> > > { >> > > return (void __user *)p; >> > > } >> > ahh, ok. I guess I was used to using it in the context of ioctl >> > structs.. in that context u64 -> (void __user *) made more sense. >> > >> > Maybe uapi_to_ptr()? (ok, not super-creative.. maybe someone has a >> > better idea) >> >> Maybe u64_to_user_ptr? > > That is a good name. If everyone agrees I can resend this patch > changing it to u64_to_user_ptr. Then should we still keep it on > kernel.h? works for me BR, -R ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 38/42] staging: comedi: ni_660x: sort enum ni_660x_register
Sort this enum so that it has a 1:1 relationship with the ni_tio.h enum ni_gpct_register. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_660x.c | 95 1 file changed, 48 insertions(+), 47 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index 1cca9ea..ad67ee5 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -43,78 +43,79 @@ /* See Register-Level Programmer Manual page 3.1 */ enum ni_660x_register { - NI660X_G0_INT_ACK, - NI660X_G0_STATUS, - NI660X_G1_INT_ACK, - NI660X_G1_STATUS, - NI660X_G01_STATUS, + NI660X_G0_AUTO_INC, + NI660X_G1_AUTO_INC, + NI660X_G2_AUTO_INC, + NI660X_G3_AUTO_INC, NI660X_G0_CMD, - NI660X_STC_DIO_PARALLEL_INPUT, NI660X_G1_CMD, + NI660X_G2_CMD, + NI660X_G3_CMD, NI660X_G0_HW_SAVE, NI660X_G1_HW_SAVE, - NI660X_STC_DIO_OUTPUT, - NI660X_STC_DIO_CONTROL, + NI660X_G2_HW_SAVE, + NI660X_G3_HW_SAVE, NI660X_G0_SW_SAVE, NI660X_G1_SW_SAVE, + NI660X_G2_SW_SAVE, + NI660X_G3_SW_SAVE, NI660X_G0_MODE, - NI660X_G01_STATUS1, NI660X_G1_MODE, - NI660X_STC_DIO_SERIAL_INPUT, + NI660X_G2_MODE, + NI660X_G3_MODE, NI660X_G0_LOADA, - NI660X_G01_STATUS2, - NI660X_G0_LOADB, NI660X_G1_LOADA, + NI660X_G2_LOADA, + NI660X_G3_LOADA, + NI660X_G0_LOADB, NI660X_G1_LOADB, + NI660X_G2_LOADB, + NI660X_G3_LOADB, NI660X_G0_INPUT_SEL, NI660X_G1_INPUT_SEL, - NI660X_G0_AUTO_INC, - NI660X_G1_AUTO_INC, - NI660X_G01_RESET, - NI660X_G0_INT_ENA, - NI660X_G1_INT_ENA, + NI660X_G2_INPUT_SEL, + NI660X_G3_INPUT_SEL, NI660X_G0_CNT_MODE, NI660X_G1_CNT_MODE, + NI660X_G2_CNT_MODE, + NI660X_G3_CNT_MODE, NI660X_G0_GATE2, NI660X_G1_GATE2, + NI660X_G2_GATE2, + NI660X_G3_GATE2, + NI660X_G01_STATUS, + NI660X_G23_STATUS, + NI660X_G01_RESET, + NI660X_G23_RESET, + NI660X_G01_STATUS1, + NI660X_G23_STATUS1, + NI660X_G01_STATUS2, + NI660X_G23_STATUS2, NI660X_G0_DMA_CFG, - NI660X_G0_DMA_STATUS, NI660X_G1_DMA_CFG, + NI660X_G2_DMA_CFG, + NI660X_G3_DMA_CFG, + NI660X_G0_DMA_STATUS, NI660X_G1_DMA_STATUS, + NI660X_G2_DMA_STATUS, + NI660X_G3_DMA_STATUS, + NI660X_G0_INT_ACK, + NI660X_G1_INT_ACK, NI660X_G2_INT_ACK, - NI660X_G2_STATUS, NI660X_G3_INT_ACK, + NI660X_G0_STATUS, + NI660X_G1_STATUS, + NI660X_G2_STATUS, NI660X_G3_STATUS, - NI660X_G23_STATUS, - NI660X_G2_CMD, - NI660X_G3_CMD, - NI660X_G2_HW_SAVE, - NI660X_G3_HW_SAVE, - NI660X_G2_SW_SAVE, - NI660X_G3_SW_SAVE, - NI660X_G2_MODE, - NI660X_G23_STATUS1, - NI660X_G3_MODE, - NI660X_G2_LOADA, - NI660X_G23_STATUS2, - NI660X_G2_LOADB, - NI660X_G3_LOADA, - NI660X_G3_LOADB, - NI660X_G2_INPUT_SEL, - NI660X_G3_INPUT_SEL, - NI660X_G2_AUTO_INC, - NI660X_G3_AUTO_INC, - NI660X_G23_RESET, + NI660X_G0_INT_ENA, + NI660X_G1_INT_ENA, NI660X_G2_INT_ENA, NI660X_G3_INT_ENA, - NI660X_G2_CNT_MODE, - NI660X_G3_CNT_MODE, - NI660X_G3_GATE2, - NI660X_G2_GATE2, - NI660X_G2_DMA_CFG, - NI660X_G2_DMA_STATUS, - NI660X_G3_DMA_CFG, - NI660X_G3_DMA_STATUS, + + NI660X_STC_DIO_PARALLEL_INPUT = NITIO_NUM_REGS, + NI660X_STC_DIO_OUTPUT, + NI660X_STC_DIO_CONTROL, + NI660X_STC_DIO_SERIAL_INPUT, NI660X_DIO32_INPUT, NI660X_DIO32_OUTPUT, NI660X_CLK_CFG, -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 5/5] Drivers: hv: vmbus: Implement copy-free read APIs
Implement copy-free read APIs. Signed-off-by: K. Y. Srinivasan --- drivers/hv/ring_buffer.c | 55 ++ include/linux/hyperv.h |6 + 2 files changed, 61 insertions(+), 0 deletions(-) diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c index c2c2b2e..c80e1f3 100644 --- a/drivers/hv/ring_buffer.c +++ b/drivers/hv/ring_buffer.c @@ -444,3 +444,58 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, return ret; } + +/* + * In-place read functions. + */ +bool get_next_pkt_raw(struct vmbus_channel *channel, + struct vmpacket_descriptor **desc) +{ + struct hv_ring_buffer_info *ring_info = &channel->inbound; + u32 read_loc = ring_info->ring_buffer->read_index; + void *ring_buffer = hv_get_ring_buffer(ring_info); + struct vmpacket_descriptor *cur_desc; + u32 packetlen; + u32 dsize = ring_info->ring_datasize; + u32 bytes_avail_toread = hv_get_bytes_to_read(ring_info); + + if (bytes_avail_toread < sizeof(struct vmpacket_descriptor)) + return false; + + if ((read_loc + sizeof(*desc)) > dsize) + return false; + + cur_desc = ring_buffer + read_loc; + packetlen = cur_desc->len8 << 3; + + if ((read_loc + packetlen + 8) > (dsize - 1)) + return false; + + *desc = cur_desc; + return true; +} +EXPORT_SYMBOL_GPL(get_next_pkt_raw); + +void put_pkt_raw(struct vmbus_channel *channel, +struct vmpacket_descriptor *desc) +{ + struct hv_ring_buffer_info *ring_info = &channel->inbound; + u32 read_loc = ring_info->ring_buffer->read_index; + u32 packetlen = desc->len8 << 3; + u32 dsize = ring_info->ring_datasize; + + if ((read_loc + packetlen + 8) > dsize) + BUG(); + + /* +* Make sure all reads are done before we update the read index since +* the writer may start writing to the read area once the read index +* is updated. +*/ + virt_mb(); + ring_info->ring_buffer->read_index += packetlen + 8; + + if (hv_need_to_signal_on_read(ring_info)) + vmbus_set_event(channel); +} +EXPORT_SYMBOL_GPL(put_pkt_raw); diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index a6b053c..455f3f0 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -1035,6 +1035,12 @@ extern int vmbus_recvpacket_raw(struct vmbus_channel *channel, u32 *buffer_actual_len, u64 *requestid); +bool get_next_pkt_raw(struct vmbus_channel *channel, + struct vmpacket_descriptor **desc); + +void put_pkt_raw(struct vmbus_channel *channel, +struct vmpacket_descriptor *desc); + extern void vmbus_ontimer(unsigned long data); -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/2] Add antenna selection code to rtl8723be
These patches fix a problem that occurs for laptops that are constructed with only a single antenna, but have an incorrect programming of the on-board EEPROM. These changes have been extensively tested in the rtlwifi_new repo at GitHub.com. As the patches fix a deficiency rather than a bug, they probably need to be submitted to the 4.7 stream. Because the fix is needed for stable kernels, I have added the appropriate Cc. Larry Larry Finger (2): rtlwifi: rtl8723be: Add antenna select module parameter rtlwifi: btcoexist: Implement antenna selection .../realtek/rtlwifi/btcoexist/halbtc8723b2ant.c| 9 ++-- .../realtek/rtlwifi/btcoexist/halbtcoutsrc.c | 27 +- .../realtek/rtlwifi/btcoexist/halbtcoutsrc.h | 2 +- .../wireless/realtek/rtlwifi/btcoexist/rtl_btc.c | 5 +++- .../net/wireless/realtek/rtlwifi/rtl8723be/hw.c| 5 .../net/wireless/realtek/rtlwifi/rtl8723be/sw.c| 3 +++ drivers/net/wireless/realtek/rtlwifi/wifi.h| 3 +++ 7 files changed, 49 insertions(+), 5 deletions(-) -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/1] scsi: storvsc: Support manual scan of FC hosts on Hyper-V
On Wed, 2016-03-16 at 23:15 +, KY Srinivasan wrote: > > > -Original Message- > > From: James Bottomley [mailto:james.bottom...@hansenpartnership.com > > ] > > Sent: Wednesday, March 16, 2016 4:08 PM > > To: Martin K. Petersen ; KY Srinivasan > > > > Cc: Christoph Hellwig ; > > gre...@linuxfoundation.org; > > linux-ker...@vger.kernel.org; de...@linuxdriverproject.org; > > oher...@suse.com; jbottom...@parallels.com; > > linux-s...@vger.kernel.org; > > a...@canonical.com; vkuzn...@redhat.com; jasow...@redhat.com; > > h...@suse.de > > Subject: Re: [PATCH 1/1] scsi: storvsc: Support manual scan of FC > > hosts on > > Hyper-V > > > > On Wed, 2016-03-16 at 18:34 -0400, Martin K. Petersen wrote: > > > > > > > > "KY" == KY Srinivasan writes: > > > > > > KY> How would I get the sysfs files under fc_host if I don't use > > > the > > > FC > > > KY> transport. The customer scripts expect these sysfs files. > > > > > > Right, but I was interested in finding out why they need those > > > files. And whether an alternative to the FC transport would be a > > > better solution. > > > > If it's just the wwn file (or a set of other values), we might be > > able > > to separate that bit out of the FC transport class so you can use > > it > > independently ... do you have a full list of the files being used? > > Wwn files are what we can support on Hyper-V and that is what I want > to support (to address customer requirements). There is no wwn file. These are all the possible attributes they could use; which one(s) do you want: /* * Setup SCSI Host Attributes. */ SETUP_HOST_ATTRIBUTE_RD(node_name); SETUP_HOST_ATTRIBUTE_RD(port_name); SETUP_HOST_ATTRIBUTE_RD(permanent_port_name); SETUP_HOST_ATTRIBUTE_RD(supported_classes); SETUP_HOST_ATTRIBUTE_RD(supported_fc4s); SETUP_HOST_ATTRIBUTE_RD(supported_speeds); SETUP_HOST_ATTRIBUTE_RD(maxframe_size); if (ft->vport_create) { SETUP_HOST_ATTRIBUTE_RD_NS(max_npiv_vports); SETUP_HOST_ATTRIBUTE_RD_NS(npiv_vports_inuse); } SETUP_HOST_ATTRIBUTE_RD(serial_number); SETUP_HOST_ATTRIBUTE_RD(manufacturer); SETUP_HOST_ATTRIBUTE_RD(model); SETUP_HOST_ATTRIBUTE_RD(model_description); SETUP_HOST_ATTRIBUTE_RD(hardware_version); SETUP_HOST_ATTRIBUTE_RD(driver_version); SETUP_HOST_ATTRIBUTE_RD(firmware_version); SETUP_HOST_ATTRIBUTE_RD(optionrom_version); SETUP_HOST_ATTRIBUTE_RD(port_id); SETUP_HOST_ATTRIBUTE_RD(port_type); SETUP_HOST_ATTRIBUTE_RD(port_state); SETUP_HOST_ATTRIBUTE_RD(active_fc4s); SETUP_HOST_ATTRIBUTE_RD(speed); SETUP_HOST_ATTRIBUTE_RD(fabric_name); SETUP_HOST_ATTRIBUTE_RD(symbolic_name); SETUP_HOST_ATTRIBUTE_RW(system_hostname); /* Transport-managed attributes */ SETUP_PRIVATE_HOST_ATTRIBUTE_RW(dev_loss_tmo); SETUP_PRIVATE_HOST_ATTRIBUTE_RW(tgtid_bind_type); if (ft->issue_fc_host_lip) SETUP_PRIVATE_HOST_ATTRIBUTE_RW(issue_lip); if (ft->vport_create) SETUP_PRIVATE_HOST_ATTRIBUTE_RW(vport_create); if (ft->vport_delete) SETUP_PRIVATE_HOST_ATTRIBUTE_RW(vport_delete); /* * Setup Remote Port Attributes. */ count=0; SETUP_RPORT_ATTRIBUTE_RD(maxframe_size); SETUP_RPORT_ATTRIBUTE_RD(supported_classes); SETUP_RPORT_ATTRIBUTE_RW(dev_loss_tmo); SETUP_PRIVATE_RPORT_ATTRIBUTE_RD(node_name); SETUP_PRIVATE_RPORT_ATTRIBUTE_RD(port_name); SETUP_PRIVATE_RPORT_ATTRIBUTE_RD(port_id); SETUP_PRIVATE_RPORT_ATTRIBUTE_RD(roles); SETUP_PRIVATE_RPORT_ATTRIBUTE_RD(port_state); SETUP_PRIVATE_RPORT_ATTRIBUTE_RD(scsi_target_id); SETUP_PRIVATE_RPORT_ATTRIBUTE_RW(fast_io_fail_tmo); /* * Setup Virtual Port Attributes. */ SETUP_PRIVATE_VPORT_ATTRIBUTE_RD(vport_state); SETUP_PRIVATE_VPORT_ATTRIBUTE_RD(vport_last_state); SETUP_PRIVATE_VPORT_ATTRIBUTE_RD(node_name); SETUP_PRIVATE_VPORT_ATTRIBUTE_RD(port_name); SETUP_PRIVATE_VPORT_ATTRIBUTE_RD(roles); SETUP_PRIVATE_VPORT_ATTRIBUTE_RD(vport_type); SETUP_VPORT_ATTRIBUTE_RW(symbolic_name); SETUP_VPORT_ATTRIBUTE_WR(vport_delete); SETUP_VPORT_ATTRIBUTE_WR(vport_disable); I'm assuming it's host and rport port_id? James ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/2] rtlwifi: rtl8723be: Add antenna select module parameter
A number of new laptops have been delivered with only a single antenna. In principle, this is OK; however, a problem arises when the on-board EEPROM is programmed to use the other antenna connection. The option of opening the computer and moving the connector is not always possible as it will void the warranty in some cases. In addition, this solution breaks the Windows driver when the box dual boots Linux and Windows. A fix involving a new module parameter has been developed. This commit adds the new parameter and implements the changes needed for the driver. Signed-off-by: Larry Finger Cc: Stable [V4.0+] --- drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c | 5 + drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c | 3 +++ drivers/net/wireless/realtek/rtlwifi/wifi.h | 3 +++ 3 files changed, 11 insertions(+) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c index c983d2f..5a3df91 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c @@ -2684,6 +2684,7 @@ void rtl8723be_read_bt_coexist_info_from_hwpg(struct ieee80211_hw *hw, bool auto_load_fail, u8 *hwinfo) { struct rtl_priv *rtlpriv = rtl_priv(hw); + struct rtl_mod_params *mod_params = rtlpriv->cfg->mod_params; u8 value; u32 tmpu_32; @@ -2702,6 +2703,10 @@ void rtl8723be_read_bt_coexist_info_from_hwpg(struct ieee80211_hw *hw, rtlpriv->btcoexist.btc_info.ant_num = ANT_X2; } + /* override ant_num / ant_path */ + if (mod_params->ant_sel) + rtlpriv->btcoexist.btc_info.ant_num = + (mod_params->ant_sel == 1 ? ANT_X2 : ANT_X1); } void rtl8723be_bt_reg_init(struct ieee80211_hw *hw) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c index a78eaed..2101793 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c @@ -273,6 +273,7 @@ static struct rtl_mod_params rtl8723be_mod_params = { .msi_support = false, .disable_watchdog = false, .debug = DBG_EMERG, + .ant_sel = 0, }; static struct rtl_hal_cfg rtl8723be_hal_cfg = { @@ -394,6 +395,7 @@ module_param_named(fwlps, rtl8723be_mod_params.fwctrl_lps, bool, 0444); module_param_named(msi, rtl8723be_mod_params.msi_support, bool, 0444); module_param_named(disable_watchdog, rtl8723be_mod_params.disable_watchdog, bool, 0444); +module_param_named(ant_sel, rtl8723be_mod_params.ant_sel, int, 0444); MODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n"); MODULE_PARM_DESC(ips, "Set to 0 to not use link power save (default 1)\n"); MODULE_PARM_DESC(swlps, "Set to 1 to use SW control power save (default 0)\n"); @@ -402,6 +404,7 @@ MODULE_PARM_DESC(msi, "Set to 1 to use MSI interrupts mode (default 0)\n"); MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)"); MODULE_PARM_DESC(disable_watchdog, "Set to 1 to disable the watchdog (default 0)\n"); +MODULE_PARM_DESC(ant_sel, "Set to 1 or 2 to force antenna number (default 0)\n"); static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume); diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wireless/realtek/rtlwifi/wifi.h index 554d814..93bd7fc 100644 --- a/drivers/net/wireless/realtek/rtlwifi/wifi.h +++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h @@ -2246,6 +2246,9 @@ struct rtl_mod_params { /* default 0: 1 means do not disable interrupts */ bool int_clear; + + /* select antenna */ + int ant_sel; }; struct rtl_hal_usbint_cfg { -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 37/42] staging: comedi: ni_660x: remove inline mite_ring()
This fuction just returns a pointer from the private data. The name might provide some confusion since it appears to be an exported function from the mite driver. Just remove it and get the pointer directly where needed. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_660x.c | 21 +++-- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index cf25892..1cca9ea 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -465,16 +465,6 @@ static unsigned int ni_660x_gpct_read(struct ni_gpct *counter, return ni_660x_read(dev, counter->chip_index, ni_660x_register); } -static inline struct mite_dma_descriptor_ring *mite_ring(struct ni_660x_private -*priv, -struct ni_gpct -*counter) -{ - unsigned int chip = counter->chip_index; - - return priv->mite_rings[chip][counter->counter_index]; -} - static inline void ni_660x_set_dma_channel(struct comedi_device *dev, unsigned int mite_channel, struct ni_gpct *counter) @@ -515,12 +505,13 @@ static int ni_660x_request_mite_channel(struct comedi_device *dev, enum comedi_io_direction direction) { struct ni_660x_private *devpriv = dev->private; - unsigned long flags; + struct mite_dma_descriptor_ring *ring; struct mite_channel *mite_chan; + unsigned long flags; spin_lock_irqsave(&devpriv->mite_channel_lock, flags); - mite_chan = mite_request_channel(devpriv->mite, -mite_ring(devpriv, counter)); + ring = devpriv->mite_rings[counter->chip_index][counter->counter_index]; + mite_chan = mite_request_channel(devpriv->mite, ring); if (!mite_chan) { spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); dev_err(dev->class_dev, @@ -645,9 +636,11 @@ static int ni_660x_buf_change(struct comedi_device *dev, { struct ni_660x_private *devpriv = dev->private; struct ni_gpct *counter = s->private; + struct mite_dma_descriptor_ring *ring; int ret; - ret = mite_buf_change(mite_ring(devpriv, counter), s); + ring = devpriv->mite_rings[counter->chip_index][counter->counter_index]; + ret = mite_buf_change(ring, s); if (ret < 0) return ret; -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/5] Drivers: hv: vmbus
Cleanup the Hyper-V ring buffer code. Also Implement APIs for supporting copy-free operations on the read side. K. Y. Srinivasan (5): Drivers: hv: vmbus: Introduce functions for estimating room in the ring buffer Drivers: hv: vmbus: Use READ_ONCE() to read variables that are volatile Drivers: hv: vmbus: Fix a bug in hv_need_to_signal_on_read() Drivers: hv: vmbus: Use the new virt_xx barrier code Drivers: hv: vmbus: Implement copy-free read APIs drivers/hv/ring_buffer.c | 99 - include/linux/hyperv.h | 33 +++ 2 files changed, 103 insertions(+), 29 deletions(-) -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/2] storvsc_drv: make use of the lightweight FC transport class
Signed-off-by: James Bottomley --- drivers/scsi/storvsc_drv.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index 3ddcabb..dcb7393 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c @@ -1769,21 +1769,16 @@ static int __init storvsc_drv_init(void) sizeof(u64))); #if IS_ENABLED(CONFIG_SCSI_FC_ATTRS) - fc_transport_template = fc_attach_transport(&fc_transport_functions); + fc_transport_template = fc_lw_attach_transport(&fc_transport_functions); if (!fc_transport_template) return -ENODEV; - - /* -* Install Hyper-V specific timeout handler. -*/ - fc_transport_template->eh_timed_out = storvsc_eh_timed_out; #endif ret = vmbus_driver_register(&storvsc_drv); #if IS_ENABLED(CONFIG_SCSI_FC_ATTRS) if (ret) - fc_release_transport(fc_transport_template); + fc_lw_release_transport(fc_transport_template); #endif return ret; @@ -1793,7 +1788,7 @@ static void __exit storvsc_drv_exit(void) { vmbus_driver_unregister(&storvsc_drv); #if IS_ENABLED(CONFIG_SCSI_FC_ATTRS) - fc_release_transport(fc_transport_template); + fc_lw_release_transport(fc_transport_template); #endif } -- 2.6.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: refresh TODO for rtl8723au
On Fri, 2016-03-18 at 23:58 -0400, Jes Sorensen wrote: > Joe Perches writes: > > On Fri, 2016-03-18 at 13:42 -0400, Jes Sorensen wrote: > > > Xose Vazquez Perez writes: > > > > > > > > People should not waste time and energy working on this staging driver. > > > > A replacement(rtl8xxxu) using the kernel wireless stack already was > > > > merged > > > > in the 4.3 kernel. > > [] > > > > > > > > > > > drivers/staging/rtl8723au/TODO | 3 +++ > > > Acked-by: Jes Sorensen > > why not git rm drivers/staging/rtl8723au/ ? > Because you don't just pull the rug out under people. I plan to mark it > obsolete and then remove it in a follow-on release. Duh. I note you removed the obsolete suggestion which is probably more valuable then updating the TODO. Updating the TODO to something like: Actual bug fixes only, no other changes accepted. This driver is going to be removed by 4.8 or so is also probably more valuable than keeping all the current items and just adding a note that another driver exists. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/5] Drivers: hv: vmbus: Use READ_ONCE() to read variables that are volatile
Use the READ_ONCE macro to access variabes that can change asynchronously. Signed-off-by: K. Y. Srinivasan --- drivers/hv/ring_buffer.c |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c index 902375b..2919395 100644 --- a/drivers/hv/ring_buffer.c +++ b/drivers/hv/ring_buffer.c @@ -69,7 +69,7 @@ u32 hv_end_read(struct hv_ring_buffer_info *rbi) static bool hv_need_to_signal(u32 old_write, struct hv_ring_buffer_info *rbi) { mb(); - if (rbi->ring_buffer->interrupt_mask) + if (READ_ONCE(rbi->ring_buffer->interrupt_mask)) return false; /* check interrupt_mask before read_index */ @@ -78,7 +78,7 @@ static bool hv_need_to_signal(u32 old_write, struct hv_ring_buffer_info *rbi) * This is the only case we need to signal when the * ring transitions from being empty to non-empty. */ - if (old_write == rbi->ring_buffer->read_index) + if (old_write == READ_ONCE(rbi->ring_buffer->read_index)) return true; return false; @@ -102,8 +102,9 @@ static bool hv_need_to_signal(u32 old_write, struct hv_ring_buffer_info *rbi) static bool hv_need_to_signal_on_read(struct hv_ring_buffer_info *rbi) { u32 cur_write_sz; - u32 pending_sz = rbi->ring_buffer->pending_send_sz; + u32 pending_sz; + pending_sz = READ_ONCE(rbi->ring_buffer->pending_send_sz); /* If the other end is not blocked on write don't bother. */ if (pending_sz == 0) return false; -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: fsl-mc: Fix up bad parameters to dev_err and dev_dbg
The first parameter to dev_dbg() and dev_err() is struct device *, not struct device **. Fixes: de71daf5c839 ("Staging: fsl-mc: Replace pr_debug with dev_dbg") Fixes: 454b0ec8bf99 ("Staging: fsl-mc: Replace pr_err with dev_err") Cc: Bhumika Goyal Signed-off-by: Guenter Roeck --- drivers/staging/fsl-mc/bus/mc-bus.c | 4 ++-- drivers/staging/fsl-mc/bus/mc-sys.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/fsl-mc/bus/mc-bus.c b/drivers/staging/fsl-mc/bus/mc-bus.c index 9f77c37bd612..b59455661f4d 100644 --- a/drivers/staging/fsl-mc/bus/mc-bus.c +++ b/drivers/staging/fsl-mc/bus/mc-bus.c @@ -260,14 +260,14 @@ static int get_dprc_icid(struct fsl_mc_io *mc_io, error = dprc_open(mc_io, 0, container_id, &dprc_handle); if (error < 0) { - dev_err(&mc_io->dev, "dprc_open() failed: %d\n", error); + dev_err(mc_io->dev, "dprc_open() failed: %d\n", error); return error; } memset(&attr, 0, sizeof(attr)); error = dprc_get_attributes(mc_io, 0, dprc_handle, &attr); if (error < 0) { - dev_err(&mc_io->dev, "dprc_get_attributes() failed: %d\n", + dev_err(mc_io->dev, "dprc_get_attributes() failed: %d\n", error); goto common_cleanup; } diff --git a/drivers/staging/fsl-mc/bus/mc-sys.c b/drivers/staging/fsl-mc/bus/mc-sys.c index 8101c469abb0..810a611c1cb0 100644 --- a/drivers/staging/fsl-mc/bus/mc-sys.c +++ b/drivers/staging/fsl-mc/bus/mc-sys.c @@ -328,7 +328,7 @@ static int mc_polling_wait_preemptible(struct fsl_mc_io *mc_io, MC_CMD_COMPLETION_POLLING_MAX_SLEEP_USECS); if (time_after_eq(jiffies, jiffies_until_timeout)) { - dev_dbg(&mc_io->dev, + dev_dbg(mc_io->dev, "MC command timed out (portal: %#llx, obj handle: %#x, command: %#x)\n", mc_io->portal_phys_addr, (unsigned int) @@ -370,7 +370,7 @@ static int mc_polling_wait_atomic(struct fsl_mc_io *mc_io, udelay(MC_CMD_COMPLETION_POLLING_MAX_SLEEP_USECS); timeout_usecs -= MC_CMD_COMPLETION_POLLING_MAX_SLEEP_USECS; if (timeout_usecs == 0) { - dev_dbg(&mc_io->dev, + dev_dbg(mc_io->dev, "MC command timed out (portal: %#llx, obj handle: %#x, command: %#x)\n", mc_io->portal_phys_addr, (unsigned int) @@ -426,7 +426,7 @@ int mc_send_command(struct fsl_mc_io *mc_io, struct mc_command *cmd) goto common_exit; if (status != MC_CMD_STATUS_OK) { - dev_dbg(&mc_io->dev, + dev_dbg(mc_io->dev, "MC command failed: portal: %#llx, obj handle: %#x, command: %#x, status: %s (%#x)\n", mc_io->portal_phys_addr, (unsigned int)MC_CMD_HDR_READ_TOKEN(cmd->header), -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] de-stage android sync framework
From: Gustavo Padovan Hi, This is the first step and the most important one of the de-stage of the the sync framework, it de-stage the sync_file part which is used to send/receive fence file descriptors with the userspace. These patches sits on top of the sync ABI changes that I sent earlier today: https://www.spinics.net/lists/dri-devel/msg102795.html Comments are welcome! Gustavo Gustavo Padovan (1): dma-buf/sync_file: de-stage sync_file drivers/Kconfig| 2 + drivers/dma-buf/Kconfig| 11 + drivers/dma-buf/Makefile | 1 + drivers/dma-buf/sync_file.c| 382 + drivers/staging/android/Kconfig| 1 + drivers/staging/android/sync.c | 362 --- drivers/staging/android/sync.h | 92 + drivers/staging/android/sync_debug.c | 1 + include/linux/sync_file.h | 106 ++ .../uapi/sync.h => include/uapi/linux/sync_file.h | 0 10 files changed, 506 insertions(+), 452 deletions(-) create mode 100644 drivers/dma-buf/Kconfig create mode 100644 drivers/dma-buf/sync_file.c create mode 100644 include/linux/sync_file.h rename drivers/staging/android/uapi/sync.h => include/uapi/linux/sync_file.h (100%) -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: refresh TODO for rtl8723au
Joe Perches writes: > On Fri, 2016-03-18 at 13:42 -0400, Jes Sorensen wrote: >> Xose Vazquez Perez writes: >> > People should not waste time and energy working on this staging driver. >> > A replacement(rtl8xxxu) using the kernel wireless stack already was merged >> > in the 4.3 kernel. > [] >> > drivers/staging/rtl8723au/TODO | 3 +++ >> Acked-by: Jes Sorensen > > why not git rm drivers/staging/rtl8723au/ ? Because you don't just pull the rug out under people. I plan to mark it obsolete and then remove it in a follow-on release. Jes ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: rtl8192e: fixed coding style issues
Hi, Thank you for the email, apologies for that I'll get that sorted out now. Thanks again On Thu, Mar 17, 2016 at 10:11:18AM -0700, Greg KH wrote: > On Thu, Mar 17, 2016 at 04:55:37PM +, Yousof El-Sayed wrote: > > Signed-off-by: Yousof El-Sayed > > I can't take patches without any changelog entry, sorry. > > And be specific about what and why you are changing anything, "coding > style issues" is very vague. > > thanks, > > greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rtl8188eu: remove return at end of void function call
Remove unnecessary return statement from last line of void function call Signed-off-by: Nicholas Sim --- drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c index 591a912..064721b 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c @@ -2105,7 +2105,6 @@ static void site_survey(struct adapter *padapter) issue_action_BSSCoexistPacket(padapter); issue_action_BSSCoexistPacket(padapter); } - return; } /* collect bss info from Beacon and Probe request/response frames. */ -- 2.4.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/9] Fix Smatch warnings in rtlwifi family of drivers
Today's patch by Arndt Bergman showing an indentation problem in rtl8821ae told me that it was time for rechecking all the code for indentation and other problems. Along with Arndt's patch, there are no remaining Smatch warnings. As with all other cleanup patches, these have low priority. Larry --- Larry Finger (9): rtlwifi: Fix Smatch warnings rtlwifi: btcoexist: Fix Smatch warning rtlwifi: rtl8188ee: Fix Smatch warnings rtlwifi: rtl8192c-common: Fix Smatch warning rtlwifi: rtl8192ee: Fix Smatch warning rtlwifi: rtl8192se: Fix Smatch warning rtlwifi: rtl8723ae: Fix Smatch warning rtlwifi: rtl8723be: Fix Smatch warnings rtlwifi: rtl8821ae: Fix Smatch warning .../realtek/rtlwifi/btcoexist/halbtc8723b2ant.c| 2 +- drivers/net/wireless/realtek/rtlwifi/pci.c | 39 +++--- .../net/wireless/realtek/rtlwifi/rtl8188ee/dm.c| 2 +- .../net/wireless/realtek/rtlwifi/rtl8188ee/phy.c | 3 +- .../wireless/realtek/rtlwifi/rtl8192c/dm_common.c | 2 +- .../net/wireless/realtek/rtlwifi/rtl8192ee/trx.c | 2 +- .../net/wireless/realtek/rtlwifi/rtl8192se/phy.c | 2 +- .../wireless/realtek/rtlwifi/rtl8723ae/hal_btc.c | 6 ++-- .../net/wireless/realtek/rtlwifi/rtl8723be/phy.c | 10 +++--- .../net/wireless/realtek/rtlwifi/rtl8723be/rf.c| 4 +-- .../net/wireless/realtek/rtlwifi/rtl8821ae/dm.c| 6 ++-- 11 files changed, 37 insertions(+), 41 deletions(-) -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] [media] media: rename media unregister function
Shuah Khan wrote: > On 03/18/2016 08:12 AM, Javier Martinez Canillas wrote: >> Hello Shuah, >> >> On 03/18/2016 11:01 AM, Shuah Khan wrote: >>> On 03/18/2016 07:05 AM, Mauro Carvalho Chehab wrote: Now that media_device_unregister() also does a cleanup, rename it to media_device_unregister_cleanup(). Signed-off-by: Mauro Carvalho Chehab >>> >>> I think adding cleanup is redundant. media_device_unregister() >>> would imply that there has to be some cleanup releasing resources. >>> I wouldn't make this change. >>> >> >> Problem is that there is a media_device_init() and media_device_register(), >> so having both unregister and cleanup in this function will make very clear >> that a single function is the counter part of the previous two operations. >> > > Yes. I realized that this change is motivated by the fact that there is > the media_device_init() and we had the counterpart media_device_cleanup() > as an exported function. I still think there is no need to make the change > to add _cleanup() at the end of media_device_unregister(). It can be handled > in API documentation that it does both. I think that's a bad idea. People will only read the documentation when something doesn't work. In this case it's easy to miss that. -- Sakari Ailus sakari.ai...@linux.intel.com ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/9] rtlwifi: rtl8192c-common: Fix Smatch warning
Smatch lists the following: CHECK drivers/net/wireless/realtek/rtlwifi/rtl8192c/dm_common.c drivers/net/wireless/realtek/rtlwifi/rtl8192c/dm_common.c:243 rtl92c_dm_false_alarm_counter_statistics() warn: inconsistent indenting Signed-off-by: Larry Finger --- drivers/net/wireless/realtek/rtlwifi/rtl8192c/dm_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/dm_common.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/dm_common.c index 03cbe4c..316be5f 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/dm_common.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/dm_common.c @@ -240,7 +240,7 @@ static void rtl92c_dm_false_alarm_counter_statistics(struct ieee80211_hw *hw) ret_value = rtl_get_bbreg(hw, ROFDM_PHYCOUNTER3, MASKDWORD); falsealm_cnt->cnt_mcs_fail = (ret_value & 0x); -ret_value = rtl_get_bbreg(hw, ROFDM0_FRAMESYNC, MASKDWORD); + ret_value = rtl_get_bbreg(hw, ROFDM0_FRAMESYNC, MASKDWORD); falsealm_cnt->cnt_fast_fsync_fail = (ret_value & 0x); falsealm_cnt->cnt_sb_search_fail = ((ret_value & 0x) >> 16); -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] [media] media: rename media unregister function
Hello Shuah, On 03/18/2016 11:01 AM, Shuah Khan wrote: > On 03/18/2016 07:05 AM, Mauro Carvalho Chehab wrote: >> Now that media_device_unregister() also does a cleanup, rename it >> to media_device_unregister_cleanup(). >> >> Signed-off-by: Mauro Carvalho Chehab > > I think adding cleanup is redundant. media_device_unregister() > would imply that there has to be some cleanup releasing resources. > I wouldn't make this change. > Problem is that there is a media_device_init() and media_device_register(), so having both unregister and cleanup in this function will make very clear that a single function is the counter part of the previous two operations. > thanks, > -- Shuah > Best regards, -- Javier Martinez Canillas Open Source Group Samsung Research America ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/1] scsi: storvsc: Support manual scan of FC hosts on Hyper-V
On Thu, 2016-03-17 at 00:01 +, KY Srinivasan wrote: > The only attributes I would be interested are: > 1) node name > 2) port name > > Ideally, if this can show under /sys/class/fc_host/hostx/port_name > and node_name, > it will be ideal since all user scripts can work. OK, like this? >From 7af7c428e7e04ddcc87fda12d6571e3dff8ae024 Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Fri, 18 Mar 2016 15:35:45 -0700 Subject: scsi_transport_fc: introduce lightweight class for virtualization systems The FC transport class is very heavily tilted towards helping things which operate a fabric (as it should be). However, there seems to be a need for a lightweight version for use in virtual systems that simply want to show pass through FC information without making any use of the heavyweight functions. This is an attempt to give them what they want: the lightweight class has no vports or rports and only two host attributes. Essentially, it's designed for the HV storvsc driver, but if other virtualizataion systems have similar problems, we can add more attributes. Signed-off-by: James Bottomley --- drivers/scsi/scsi_transport_fc.c | 94 include/scsi/scsi_transport_fc.h | 3 ++ 2 files changed, 97 insertions(+) diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index 8a88226..a9fcb4d 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c @@ -351,6 +351,27 @@ struct fc_internal { #define to_fc_internal(tmpl) container_of(tmpl, struct fc_internal, t) +#define FC_LW_HOST_NUM_ATTRS 2 +struct fc_lw_internal { + struct scsi_transport_template t; + struct fc_function_template *f; + + /* +* For attributes : each object has : +* An array of the actual attributes structures +* An array of null-terminated pointers to the attribute +* structures - used for mid-layer interaction. +* +* The attribute containers for the starget and host are are +* part of the midlayer. As the remote port is specific to the +* fc transport, we must provide the attribute container. +*/ + struct device_attribute private_host_attrs[FC_LW_HOST_NUM_ATTRS]; + struct device_attribute *host_attrs[FC_LW_HOST_NUM_ATTRS + 1]; +}; + +#define to_fc_lw_internal(tmpl)container_of(tmpl, struct fc_lw_internal, t) + static int fc_target_setup(struct transport_container *tc, struct device *dev, struct device *cdev) { @@ -472,6 +493,12 @@ static int fc_host_remove(struct transport_container *tc, struct device *dev, return 0; } +static DECLARE_TRANSPORT_CLASS(fc_lw_host_class, + "fc_host", + NULL, + NULL, + NULL); + static DECLARE_TRANSPORT_CLASS(fc_host_class, "fc_host", fc_host_setup, @@ -1968,6 +1995,25 @@ static int fc_host_match(struct attribute_container *cont, return &i->t.host_attrs.ac == cont; } +static int fc_lw_host_match(struct attribute_container *cont, + struct device *dev) +{ + struct Scsi_Host *shost; + struct fc_lw_internal *i; + + if (!scsi_is_host_device(dev)) + return 0; + + shost = dev_to_shost(dev); + if (!shost->transportt || shost->transportt->host_attrs.ac.class + != &fc_lw_host_class.class) + return 0; + + i = to_fc_lw_internal(shost->transportt); + + return &i->t.host_attrs.ac == cont; +} + static int fc_target_match(struct attribute_container *cont, struct device *dev) { @@ -2171,6 +2217,54 @@ static int fc_it_nexus_response(struct Scsi_Host *shost, u64 nexus, int result) return i->f->it_nexus_response(shost, nexus, result); } +/** + * fc_attach_lw_transport - light weight attach function + * @ft:function template for optional attributes + * + * This attach function is to be used only for virtual FC emulators + * which do not have a physical fabric underneath them and thus only + * need a few attributes and no helper functions + */ +struct scsi_transport_template * +fc_lw_attach_transport(struct fc_function_template *ft) +{ + int count; + struct fc_lw_internal *i = kzalloc(sizeof(struct fc_lw_internal), + GFP_KERNEL); + + if (unlikely(!i)) + return NULL; + + i->t.host_attrs.ac.attrs = &i->host_attrs[0]; + i->t.host_attrs.ac.class = &fc_lw_host_class.class; + i->t.host_attrs.ac.match = fc_lw_host_match; + i->t.host_size = sizeof(struct fc_host_attrs); + transport_container_register(&i->t.host_attrs); + + i->f = ft; + + count = 0; + SETUP_HOST_ATTRIBUTE_RD(node_name); + SETUP_HOST_ATTRIBUTE
Re: [PATCH] staging: refresh TODO for rtl8723au
On Fri, 2016-03-18 at 13:42 -0400, Jes Sorensen wrote: > Xose Vazquez Perez writes: > > People should not waste time and energy working on this staging driver. > > A replacement(rtl8xxxu) using the kernel wireless stack already was merged > > in the 4.3 kernel. [] > > drivers/staging/rtl8723au/TODO | 3 +++ > Acked-by: Jes Sorensen why not git rm drivers/staging/rtl8723au/ ? How about changing MAINTAINERS from: STAGING - REALTEK RTL8723U WIRELESS DRIVER M: Larry Finger M: Jes Sorensen L: linux-wirel...@vger.kernel.org S: Maintained F: drivers/staging/rtl8723au/ to S: Obsolete ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 21/42] staging: comedi: ni_660x: tidy up Digital I/O subdevice init
Add some whitespace to the Digital I/O subdevice init and add a comment about the channels. This driver is a bit goofy, only 32 of the 40 channels can actually be used for Digital I/Os and 32 of them can be routed to the counters for alternate use. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_660x.c | 68 1 file changed, 60 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index 4f7f5ca..f24009c 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -964,15 +964,67 @@ static int ni_660x_auto_attach(struct comedi_device *dev, /* Old GENERAL-PURPOSE COUNTER/TIME (GPCT) subdevice, no longer used */ s->type = COMEDI_SUBD_UNUSED; + /* +* Digital I/O subdevice +* +* There are 40 channels but only the first 32 can be digital I/Os. +* The last 8 are dedicated to counters 0 and 1. +* +* Counter 0-3 signals are from the first TIO chip. +* Counter 4-7 signals are from the second TIO chip. +* +* Comedi External +* PFI Chan DIO ChanCounter Signal +* --- -- +* 00 +* 11 +* 22 +* 33 +* 44 +* 55 +* 66 +* 77 +* 88 CTR 7 OUT +* 99 CTR 7 AUX +*10 10 CTR 7 GATE +*11 11 CTR 7 SOURCE +*12 12 CTR 6 OUT +*13 13 CTR 6 AUX +*14 14 CTR 6 GATE +*15 15 CTR 6 SOURCE +*16 16 CTR 5 OUT +*17 17 CTR 5 AUX +*18 18 CTR 5 GATE +*19 19 CTR 5 SOURCE +*20 20 CTR 4 OUT +*21 21 CTR 4 AUX +*22 22 CTR 4 GATE +*23 23 CTR 4 SOURCE +*24 24 CTR 3 OUT +*25 25 CTR 3 AUX +*26 26 CTR 3 GATE +*27 27 CTR 3 SOURCE +*28 28 CTR 2 OUT +*29 29 CTR 2 AUX +*30 30 CTR 2 GATE +*31 31 CTR 2 SOURCE +*32CTR 1 OUT +*33CTR 1 AUX +*34CTR 1 GATE +*35CTR 1 SOURCE +*36CTR 0 OUT +*37CTR 0 AUX +*38CTR 0 GATE +*39CTR 0 SOURCE +*/ s = &dev->subdevices[subdev++]; - /* DIGITAL I/O SUBDEVICE */ - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = NUM_PFI_CHANNELS; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = ni_660x_dio_insn_bits; - s->insn_config = ni_660x_dio_insn_config; + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = NUM_PFI_CHANNELS; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits= ni_660x_dio_insn_bits; + s->insn_config = ni_660x_dio_insn_config; /* * We use the ioconfig registers to control dio direction, so zero -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 17/42] staging: comedi: ni_660x: remove enum ni_660x_subdevices
Hard-coding the subdevice order is normally a bad idea. If a new subdevice is added, or removed, it could potentially break pretty badly. Remove the enum and associated NI_660X_GPCT_SUBDEV() helper that hard-code the subdevice order. Fix the (*auto_attach) so it initializes all the subdevices without depending on the hard-coded order. Change the interrupt handler so that all the counter subdevices are handled without depending on the hard-coded order. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_660x.c | 25 ++--- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index 0183497..595c862 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -179,15 +179,6 @@ enum ni_660x_register { #define NI660X_IO_CFG_IN_SEL(_c, _s) (((_s) & 0x7) << (((_c) % 2) ? 4 : 12)) #define NI660X_IO_CFG_IN_SEL_MASK(_c) NI660X_IO_CFG_IN_SEL((_c), 0x7) -enum ni_660x_subdevices { - NI_660X_DIO_SUBDEV = 1, - NI_660X_GPCT_SUBDEV_0 = 2 -}; -static inline unsigned NI_660X_GPCT_SUBDEV(unsigned index) -{ - return NI_660X_GPCT_SUBDEV_0 + index; -} - struct ni_660x_register_data { int offset; /* Offset from base address from GPCT chip */ char size; /* 2 or 4 bytes */ @@ -694,9 +685,10 @@ static irqreturn_t ni_660x_interrupt(int irq, void *d) /* lock to avoid race with comedi_poll */ spin_lock_irqsave(&devpriv->interrupt_lock, flags); smp_mb(); - for (i = 0; i < ni_660x_num_counters(dev); ++i) { - s = &dev->subdevices[NI_660X_GPCT_SUBDEV(i)]; - ni_660x_handle_gpct_interrupt(dev, s); + for (i = 0; i < dev->n_subdevices; ++i) { + s = &dev->subdevices[i]; + if (s->type == COMEDI_SUBD_COUNTER) + ni_660x_handle_gpct_interrupt(dev, s); } spin_unlock_irqrestore(&devpriv->interrupt_lock, flags); return IRQ_HANDLED; @@ -935,6 +927,7 @@ static int ni_660x_auto_attach(struct comedi_device *dev, const struct ni_660x_board *board = NULL; struct ni_660x_private *devpriv; struct comedi_subdevice *s; + int subdev; int ret; unsigned i; unsigned global_interrupt_config_bits; @@ -971,11 +964,13 @@ static int ni_660x_auto_attach(struct comedi_device *dev, if (ret) return ret; - s = &dev->subdevices[0]; + subdev = 0; + + s = &dev->subdevices[subdev++]; /* Old GENERAL-PURPOSE COUNTER/TIME (GPCT) subdevice, no longer used */ s->type = COMEDI_SUBD_UNUSED; - s = &dev->subdevices[NI_660X_DIO_SUBDEV]; + s = &dev->subdevices[subdev++]; /* DIGITAL I/O SUBDEVICE */ s->type = COMEDI_SUBD_DIO; s->subdev_flags = SDF_READABLE | SDF_WRITABLE; @@ -1000,7 +995,7 @@ static int ni_660x_auto_attach(struct comedi_device *dev, if (!devpriv->counter_dev) return -ENOMEM; for (i = 0; i < NI_660X_MAX_NUM_COUNTERS; ++i) { - s = &dev->subdevices[NI_660X_GPCT_SUBDEV(i)]; + s = &dev->subdevices[subdev++]; if (i < ni_660x_num_counters(dev)) { s->type = COMEDI_SUBD_COUNTER; s->subdev_flags = SDF_READABLE | SDF_WRITABLE | -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 00/42] staging: comedi: ni_660x: big driver cleanup
This driver has a lot of checkpatch.pl issues: total: 0 errors, 71 warnings, 27 checks, 1222 lines checked There is also a lot of cruft that bloats the driver and makes it harder to follow. This series fixes all the checkpatch.pl issues: total: 0 errors, 0 warnings, 0 checks, 944 lines checked And, even better, removes the cruft: textdata bss dec hex filename 10249 344 0 105932961 ni_660x.o.original 4719 344 0506313c7 ni_660x.o H Hartley Sweeten (42): staging: comedi: ni_660x: change IOConfigReg() into a macro staging: comedi: ni_660x: remove struct NI_660xRegisterData 'name' staging: comedi: ni_660x: remove enum ni_register_width staging: comedi: ni_660x: remove enum ni_660x_register_direction staging: comedi: ni_660x: rename CamelCase 'NI_660xRegisterData' staging: comedi: ni_660x: cleanup the NI660X_IO_CFG register helpers staging: comedi: ni_660x: tidy up multi-line comment staging: comedi: ni_660x: remove enum clock_config_register_bits staging: comedi: ni_660x: cleanup the NI660X_DMA_CFG register helpers staging: comedi: ni_660x: cleanup the NI660X_GLOBAL_INT_{STATUS,CFG} staging: comedi: ni_660x: tidy up ni_660x_write_register() staging: comedi: ni_660x: tidy up ni_660x_read_register() staging: comedi: ni_660x: tidy up ni_gpct_{write,read}_register() staging: comedi: ni_660x: tidy up ni_660x_select_pfi_output() staging: comedi: ni_660x: remove BUG_ON() in ni_660x_request_mite_channel() staging: comedi: ni_660x: fix block comment issues staging: comedi: ni_660x: remove enum ni_660x_subdevices staging: comedi: ni_660x: remove ni_660x_num_counters() staging: comedi: ni_660x: Prefer 'unsigned int' to bare use of 'unsigned' staging: comedi: ni_660x: Prefer kernel type 'u64' over 'uint64_t' staging: comedi: ni_660x: tidy up Digital I/O subdevice init staging: comedi: ni_660x: tidy up ni_660x_dio_insn_bits() staging: comedi: ni_660x: tidy up ni_660x_set_pfi_routing() staging: comedi: ni_660x: add a comment about the initial DIO state staging: comedi: ni_660x: refactor ni_gpct_to_660x_register() staging: comedi: ni_660x: add comments for the spinlock_t definitions staging: comedi: ni_660x: fix memory barrier without comment staging: comedi: ni_660x: tidy up the misc. constants staging: comedi: ni_660x: tidy up the counter subdevices init staging: comedi: ni_660x: ni_gpct_device_destroy() can handle a NULL pointer staging: comedi: ni_mio_common: ni_gpct_device_destroy() can handle a NULL pointer staging: comedi: ni_660x: disable interrupts when detaching driver staging: comedi: ni_660x: init TIO chips before subdevice init staging: comedi: ni_660x: allocate counters early in (*auto_attach) staging: comedi: ni_660x: initialize the counter with the subdevice init staging: comedi: ni_660x: default DIO channels with subdevice init staging: comedi: ni_660x: remove inline mite_ring() staging: comedi: ni_660x: sort enum ni_660x_register staging: comedi: ni_660x: remove ni_gpct_to_660x_register[] staging: comedi: ni_660x: remove spinlock 'dma_cfg_lock' staging: comedi: ni_660x: refactor GPCT_OFFSET staging: comedi: ni_660x: update the MODULE_DESCRIPTION drivers/staging/comedi/drivers/ni_660x.c | 1156 +--- drivers/staging/comedi/drivers/ni_mio_common.c |6 +- 2 files changed, 441 insertions(+), 721 deletions(-) -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 14/42] staging: comedi: ni_660x: tidy up ni_660x_select_pfi_output()
Tidy up this function to fix the checkpatch.pl issues: WARNING: Prefer 'unsigned int' to bare use of 'unsigned' For aesthetics, remove the static const local variables. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_660x.c | 54 ++-- 1 file changed, 24 insertions(+), 30 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index e0532f4..79678af 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -817,46 +817,40 @@ static int ni_660x_dio_insn_bits(struct comedi_device *dev, } static void ni_660x_select_pfi_output(struct comedi_device *dev, - unsigned pfi_channel, - unsigned output_select) + unsigned int chan, unsigned int out_sel) { const struct ni_660x_board *board = dev->board_ptr; - static const unsigned counter_4_7_first_pfi = 8; - static const unsigned counter_4_7_last_pfi = 23; - unsigned active_chipset = 0; - unsigned idle_chipset = 0; - unsigned active_bits; - unsigned idle_bits; + unsigned int active_chip = 0; + unsigned int idle_chip = 0; + unsigned int bits; if (board->n_chips > 1) { - if (output_select == NI660X_IO_CFG_OUT_SEL_COUNTER && - pfi_channel >= counter_4_7_first_pfi && - pfi_channel <= counter_4_7_last_pfi) { - active_chipset = 1; - idle_chipset = 0; + if (out_sel == NI660X_IO_CFG_OUT_SEL_COUNTER && + chan >= 8 && chan <= 23) { + /* counters 4-7 pfi channels */ + active_chip = 1; + idle_chip = 0; } else { - active_chipset = 0; - idle_chipset = 1; + /* counters 0-3 pfi channels */ + active_chip = 0; + idle_chip = 1; } } - if (idle_chipset != active_chipset) { - idle_bits = ni_660x_read(dev, idle_chipset, -NI660X_IO_CFG(pfi_channel)); - idle_bits &= ~NI660X_IO_CFG_OUT_SEL_MASK(pfi_channel); - idle_bits |= - NI660X_IO_CFG_OUT_SEL(pfi_channel, - NI660X_IO_CFG_OUT_SEL_HIGH_Z); - ni_660x_write(dev, idle_chipset, idle_bits, - NI660X_IO_CFG(pfi_channel)); + if (idle_chip != active_chip) { + /* set the pfi channel to high-z on the inactive chip */ + bits = ni_660x_read(dev, idle_chip, NI660X_IO_CFG(chan)); + bits &= ~NI660X_IO_CFG_OUT_SEL_MASK(chan); + bits |= NI660X_IO_CFG_OUT_SEL(chan, + NI660X_IO_CFG_OUT_SEL_HIGH_Z); + ni_660x_write(dev, idle_chip, bits, NI660X_IO_CFG(chan)); } - active_bits = ni_660x_read(dev, active_chipset, - NI660X_IO_CFG(pfi_channel)); - active_bits &= ~NI660X_IO_CFG_OUT_SEL_MASK(pfi_channel); - active_bits |= NI660X_IO_CFG_OUT_SEL(pfi_channel, output_select); - ni_660x_write(dev, active_chipset, active_bits, - NI660X_IO_CFG(pfi_channel)); + /* set the pfi channel output on the active chip */ + bits = ni_660x_read(dev, active_chip, NI660X_IO_CFG(chan)); + bits &= ~NI660X_IO_CFG_OUT_SEL_MASK(chan); + bits |= NI660X_IO_CFG_OUT_SEL(chan, out_sel); + ni_660x_write(dev, active_chip, bits, NI660X_IO_CFG(chan)); } static int ni_660x_set_pfi_routing(struct comedi_device *dev, unsigned chan, -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 27/42] staging: comedi: ni_660x: fix memory barrier without comment
Fix the checkpatch.pl issue. Move the memory barrier to a better place. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_660x.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index 2926d26..bb5b5ff 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -613,9 +613,11 @@ static irqreturn_t ni_660x_interrupt(int irq, void *d) if (!dev->attached) return IRQ_NONE; + /* make sure dev->attached is checked before doing anything else */ + smp_mb(); + /* lock to avoid race with comedi_poll */ spin_lock_irqsave(&devpriv->interrupt_lock, flags); - smp_mb(); for (i = 0; i < dev->n_subdevices; ++i) { s = &dev->subdevices[i]; if (s->type == COMEDI_SUBD_COUNTER) -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 33/42] staging: comedi: ni_660x: init TIO chips before subdevice init
For aesthetics, initialize the TIO chips before the subdevices are allocated and initialized. Refactor the function to initialize all the TIO chips and move it to a better place in the driver. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_660x.c | 52 ++-- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index c71dae8..afe62bf 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -703,20 +703,6 @@ static void ni_660x_free_mite_rings(struct comedi_device *dev) } } -static void init_tio_chip(struct comedi_device *dev, int chipset) -{ - struct ni_660x_private *devpriv = dev->private; - unsigned int i; - - /* init dma configuration register */ - devpriv->dma_cfg[chipset] = 0; - for (i = 0; i < NI660X_MAX_DMA_CHANNEL; ++i) - devpriv->dma_cfg[chipset] |= NI660X_DMA_CFG_SEL_NONE(i); - ni_660x_write(dev, chipset, devpriv->dma_cfg[chipset], NI660X_DMA_CFG); - for (i = 0; i < NI660X_NUM_PFI_CHANNELS; ++i) - ni_660x_write(dev, chipset, 0, NI660X_IO_CFG(i)); -} - static int ni_660x_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, @@ -857,6 +843,33 @@ static int ni_660x_dio_insn_config(struct comedi_device *dev, return insn->n; } +static void ni_660x_init_tio_chips(struct comedi_device *dev, + unsigned int n_chips) +{ + struct ni_660x_private *devpriv = dev->private; + unsigned int chip; + unsigned int chan; + + /* +* We use the ioconfig registers to control dio direction, so zero +* output enables in stc dio control reg. +*/ + ni_660x_write(dev, 0, 0, NI660X_STC_DIO_CONTROL); + + for (chip = 0; chip < n_chips; ++chip) { + /* init dma configuration register */ + devpriv->dma_cfg[chip] = 0; + for (chan = 0; chan < NI660X_MAX_DMA_CHANNEL; ++chan) + devpriv->dma_cfg[chip] |= NI660X_DMA_CFG_SEL_NONE(chan); + ni_660x_write(dev, chip, devpriv->dma_cfg[chip], + NI660X_DMA_CFG); + + /* init ioconfig registers */ + for (chan = 0; chan < NI660X_NUM_PFI_CHANNELS; ++chan) + ni_660x_write(dev, chip, 0, NI660X_IO_CFG(chan)); + } +} + static int ni_660x_auto_attach(struct comedi_device *dev, unsigned long context) { @@ -899,6 +912,8 @@ static int ni_660x_auto_attach(struct comedi_device *dev, if (ret < 0) return ret; + ni_660x_init_tio_chips(dev, board->n_chips); + ret = comedi_alloc_subdevices(dev, 2 + NI660X_MAX_COUNTERS); if (ret) return ret; @@ -971,12 +986,6 @@ static int ni_660x_auto_attach(struct comedi_device *dev, s->insn_bits= ni_660x_dio_insn_bits; s->insn_config = ni_660x_dio_insn_config; - /* -* We use the ioconfig registers to control dio direction, so zero -* output enables in stc dio control reg. -*/ - ni_660x_write(dev, 0, 0, NI660X_STC_DIO_CONTROL); - n_counters = board->n_chips * NI660X_COUNTERS_PER_CHIP; gpct_dev = ni_gpct_device_construct(dev, ni_660x_gpct_write, @@ -1017,9 +1026,6 @@ static int ni_660x_auto_attach(struct comedi_device *dev, } } - for (i = 0; i < board->n_chips; ++i) - init_tio_chip(dev, i); - for (i = 0; i < n_counters; ++i) ni_tio_init_counter(&gpct_dev->counters[i]); -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/5] Drivers: hv: vmbus: Fix a bug in hv_need_to_signal_on_read()
We need to issue a full memory barrier prior making a signalling decision. Signed-off-by: K. Y. Srinivasan Cc: sta...@vger.kernel.org --- drivers/hv/ring_buffer.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c index 2919395..67dc245 100644 --- a/drivers/hv/ring_buffer.c +++ b/drivers/hv/ring_buffer.c @@ -104,6 +104,7 @@ static bool hv_need_to_signal_on_read(struct hv_ring_buffer_info *rbi) u32 cur_write_sz; u32 pending_sz; + mb(); pending_sz = READ_ONCE(rbi->ring_buffer->pending_send_sz); /* If the other end is not blocked on write don't bother. */ if (pending_sz == 0) -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/5] Drivers: hv: vmbus: Use the new virt_xx barrier code
Use the virt_xx barriers that have been defined for use in virtual machines. Signed-off-by: K. Y. Srinivasan --- drivers/hv/ring_buffer.c | 14 +++--- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c index 67dc245..c2c2b2e 100644 --- a/drivers/hv/ring_buffer.c +++ b/drivers/hv/ring_buffer.c @@ -33,14 +33,14 @@ void hv_begin_read(struct hv_ring_buffer_info *rbi) { rbi->ring_buffer->interrupt_mask = 1; - mb(); + virt_mb(); } u32 hv_end_read(struct hv_ring_buffer_info *rbi) { rbi->ring_buffer->interrupt_mask = 0; - mb(); + virt_mb(); /* * Now check to see if the ring buffer is still empty. @@ -68,12 +68,12 @@ u32 hv_end_read(struct hv_ring_buffer_info *rbi) static bool hv_need_to_signal(u32 old_write, struct hv_ring_buffer_info *rbi) { - mb(); + virt_mb(); if (READ_ONCE(rbi->ring_buffer->interrupt_mask)) return false; /* check interrupt_mask before read_index */ - rmb(); + virt_rmb(); /* * This is the only case we need to signal when the * ring transitions from being empty to non-empty. @@ -104,7 +104,7 @@ static bool hv_need_to_signal_on_read(struct hv_ring_buffer_info *rbi) u32 cur_write_sz; u32 pending_sz; - mb(); + virt_mb(); pending_sz = READ_ONCE(rbi->ring_buffer->pending_send_sz); /* If the other end is not blocked on write don't bother. */ if (pending_sz == 0) @@ -359,7 +359,7 @@ int hv_ringbuffer_write(struct hv_ring_buffer_info *outring_info, sizeof(u64)); /* Issue a full memory barrier before updating the write index */ - mb(); + virt_mb(); /* Now, update the write location */ hv_set_next_write_location(outring_info, next_write_location); @@ -435,7 +435,7 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, * the writer may start writing to the read area once the read index * is updated. */ - mb(); + virt_mb(); /* Update the read index */ hv_set_next_read_location(inring_info, next_read_location); -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel