[PATCH 28/42] staging: comedi: ni_660x: tidy up the misc. constants
Remove enum ni_660x_constants and just #define the value. Move all the constant #defines so they are in one place and rename them so they are more conesistent. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_660x.c | 49 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index bb5b5ff..80499d6 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -41,14 +41,6 @@ #include "mite.h" #include "ni_tio.h" -enum ni_660x_constants { - counters_per_chip = 4 -}; - -#define NUM_PFI_CHANNELS 40 -/* there are only up to 3 dma channels, but the register layout allows for 4 */ -#define MAX_DMA_CHANNEL 4 - /* See Register-Level Programmer Manual page 3.1 */ enum ni_660x_register { NI660X_G0_INT_ACK, @@ -390,22 +382,29 @@ static const struct ni_660x_board ni_660x_boards[] = { }, }; -#define NI_660X_MAX_NUM_CHIPS 2 -#define NI_660X_MAX_NUM_COUNTERS (NI_660X_MAX_NUM_CHIPS * counters_per_chip) +#define NI660X_NUM_PFI_CHANNELS40 + +/* there are only up to 3 dma channels, but the register layout allows for 4 */ +#define NI660X_MAX_DMA_CHANNEL 4 + +#define NI660X_COUNTERS_PER_CHIP 4 +#define NI660X_MAX_CHIPS 2 +#define NI660X_MAX_COUNTERS(NI660X_MAX_CHIPS * \ +NI660X_COUNTERS_PER_CHIP) struct ni_660x_private { struct mite_struct *mite; struct ni_gpct_device *counter_dev; struct mite_dma_descriptor_ring - *mite_rings[NI_660X_MAX_NUM_CHIPS][counters_per_chip]; + *mite_rings[NI660X_MAX_CHIPS][NI660X_COUNTERS_PER_CHIP]; /* protects mite channel request/release */ spinlock_t mite_channel_lock; /* prevents races between interrupt and comedi_poll */ spinlock_t interrupt_lock; /* protects dma_cfg changes */ spinlock_t dma_cfg_lock; - unsigned int dma_cfg[NI_660X_MAX_NUM_CHIPS]; - unsigned int io_cfg[NUM_PFI_CHANNELS]; + unsigned int dma_cfg[NI660X_MAX_CHIPS]; + unsigned int io_cfg[NI660X_NUM_PFI_CHANNELS]; u64 io_dir; }; @@ -667,7 +666,7 @@ static int ni_660x_allocate_private(struct comedi_device *dev) spin_lock_init(&devpriv->mite_channel_lock); spin_lock_init(&devpriv->interrupt_lock); spin_lock_init(&devpriv->dma_cfg_lock); - for (i = 0; i < NUM_PFI_CHANNELS; ++i) + for (i = 0; i < NI660X_NUM_PFI_CHANNELS; ++i) devpriv->io_cfg[i] = NI_660X_PFI_OUTPUT_COUNTER; return 0; @@ -681,7 +680,7 @@ static int ni_660x_alloc_mite_rings(struct comedi_device *dev) unsigned int j; for (i = 0; i < board->n_chips; ++i) { - for (j = 0; j < counters_per_chip; ++j) { + for (j = 0; j < NI660X_COUNTERS_PER_CHIP; ++j) { devpriv->mite_rings[i][j] = mite_alloc_ring(devpriv->mite); if (!devpriv->mite_rings[i][j]) @@ -699,7 +698,7 @@ static void ni_660x_free_mite_rings(struct comedi_device *dev) unsigned int j; for (i = 0; i < board->n_chips; ++i) { - for (j = 0; j < counters_per_chip; ++j) + for (j = 0; j < NI660X_COUNTERS_PER_CHIP; ++j) mite_free_ring(devpriv->mite_rings[i][j]); } } @@ -711,10 +710,10 @@ static void init_tio_chip(struct comedi_device *dev, int chipset) /* init dma configuration register */ devpriv->dma_cfg[chipset] = 0; - for (i = 0; i < MAX_DMA_CHANNEL; ++i) + 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 < NUM_PFI_CHANNELS; ++i) + for (i = 0; i < NI660X_NUM_PFI_CHANNELS; ++i) ni_660x_write(dev, chipset, 0, NI660X_IO_CFG(i)); } @@ -899,7 +898,7 @@ static int ni_660x_auto_attach(struct comedi_device *dev, if (ret < 0) return ret; - ret = comedi_alloc_subdevices(dev, 2 + NI_660X_MAX_NUM_COUNTERS); + ret = comedi_alloc_subdevices(dev, 2 + NI660X_MAX_COUNTERS); if (ret) return ret; @@ -965,7 +964,7 @@ static int ni_660x_auto_attach(struct comedi_device *dev, s = &dev->subdevices[subdev++]; s->type = COMEDI_SUBD_DIO; s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = NUM_PFI_CHANNELS; + s->n_chan = NI660X_NUM_PFI_CHANNELS; s->maxdata = 1; s->range_table = &range_digital; s->insn_bits= ni_660x_dio_insn_bits; @@ -977,7 +976,7 @@ static int ni_660x_auto_attach(struct comedi_device *dev, */ ni
Re: [PATCH] drivers: staging: unisys: visornic: Fixed block comment coding style warnings
On Wed, Mar 16, 2016 at 07:01:51PM -0700, Gavin O'Leary wrote: > Fixed block comment checkpatch warnings. > > Signed-off-by: Gavin O'Leary > --- > drivers/staging/unisys/visornic/visornic_main.c | 11 ++- > 1 file changed, 6 insertions(+), 5 deletions(-) > > diff --git a/drivers/staging/unisys/visornic/visornic_main.c > b/drivers/staging/unisys/visornic/visornic_main.c > index 0519470..eefbacc 100644 > --- a/drivers/staging/unisys/visornic/visornic_main.c > +++ b/drivers/staging/unisys/visornic/visornic_main.c > @@ -1315,12 +1315,14 @@ visornic_rx(struct uiscmdrsp *cmdrsp) > } > if (found_mc) > break; /* accept packet, dest > -matches a multicast > -address */ > + * matches a multicast > + * address > + */ That looks horrible, don't you think? > } > } else if (skb->pkt_type == PACKET_HOST) { > break; /* accept packet, h_dest must match vnic > -mac address */ > + * mac address > + */ Same here. Please fix up to look better, that's your goal, right? thanks, greg k-h ___ 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()
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? Gustavo ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 32/42] staging: comedi: ni_660x: disable interrupts when detaching driver
Make sure the interrupts are disabled before freeing the irq. 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 2440cb6..c71dae8 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -1064,8 +1064,10 @@ static void ni_660x_detach(struct comedi_device *dev) { struct ni_660x_private *devpriv = dev->private; - if (dev->irq) + if (dev->irq) { + ni_660x_write(dev, 0, 0, NI660X_GLOBAL_INT_CFG); free_irq(dev->irq, dev); + } if (devpriv) { ni_gpct_device_destroy(devpriv->counter_dev); ni_660x_free_mite_rings(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, 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? ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/9] rtlwifi: Fix Smatch warnings
Smatch reports the following: CHECK drivers/net/wireless/realtek/rtlwifi/pci.c drivers/net/wireless/realtek/rtlwifi/pci.c:366 rtl_pci_check_buddy_priv() error: we previously assumed 'tpriv' could be null (see line 368) drivers/net/wireless/realtek/rtlwifi/pci.c:1216 _rtl_pci_init_struct() warn: inconsistent indenting Signed-off-by: Larry Finger --- drivers/net/wireless/realtek/rtlwifi/pci.c | 39 +++--- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.c b/drivers/net/wireless/realtek/rtlwifi/pci.c index 283d608..1ac41b8 100644 --- a/drivers/net/wireless/realtek/rtlwifi/pci.c +++ b/drivers/net/wireless/realtek/rtlwifi/pci.c @@ -359,30 +359,28 @@ static bool rtl_pci_check_buddy_priv(struct ieee80211_hw *hw, struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); bool find_buddy_priv = false; - struct rtl_priv *tpriv = NULL; + struct rtl_priv *tpriv; struct rtl_pci_priv *tpcipriv = NULL; if (!list_empty(&rtlpriv->glb_var->glb_priv_list)) { list_for_each_entry(tpriv, &rtlpriv->glb_var->glb_priv_list, list) { - if (tpriv) { - tpcipriv = (struct rtl_pci_priv *)tpriv->priv; - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"pcipriv->ndis_adapter.funcnumber %x\n", - pcipriv->ndis_adapter.funcnumber); - RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, -"tpcipriv->ndis_adapter.funcnumber %x\n", - tpcipriv->ndis_adapter.funcnumber); - - if ((pcipriv->ndis_adapter.busnumber == -tpcipriv->ndis_adapter.busnumber) && - (pcipriv->ndis_adapter.devnumber == - tpcipriv->ndis_adapter.devnumber) && - (pcipriv->ndis_adapter.funcnumber != - tpcipriv->ndis_adapter.funcnumber)) { - find_buddy_priv = true; - break; - } + tpcipriv = (struct rtl_pci_priv *)tpriv->priv; + RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, +"pcipriv->ndis_adapter.funcnumber %x\n", + pcipriv->ndis_adapter.funcnumber); + RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, +"tpcipriv->ndis_adapter.funcnumber %x\n", + tpcipriv->ndis_adapter.funcnumber); + + if ((pcipriv->ndis_adapter.busnumber == +tpcipriv->ndis_adapter.busnumber) && + (pcipriv->ndis_adapter.devnumber == + tpcipriv->ndis_adapter.devnumber) && + (pcipriv->ndis_adapter.funcnumber != + tpcipriv->ndis_adapter.funcnumber)) { + find_buddy_priv = true; + break; } } } @@ -1213,7 +1211,8 @@ static void _rtl_pci_init_struct(struct ieee80211_hw *hw, /*Tx/Rx related var */ _rtl_pci_init_trx_var(hw); - /*IBSS*/ mac->beacon_interval = 100; + /*IBSS*/ + mac->beacon_interval = 100; /*AMPDU*/ mac->min_space_cfg = 0; -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH] staging/comedi/dt282x: avoid integer overflow warning
On Tuesday, March 15, 2016 2:50 PM, Arnd Bergmann wrote: > On Tuesday 15 March 2016 21:35:40 Hartley Sweeten wrote: >> On Monday, March 14, 2016 3:48 PM, Arnd Bergmann wrote: >>> gcc-6 warns about passing negative signed integer into swab16() >>> in the dt282x driver: >> >> >> >>> The warning makes sense, though the code is correct as far as I >>> can tell. >>> >>> This disambiguates the operation by making the constant expressions >>> we pass here explicitly 'unsigned', which helps to avoid the warning. >>> >>> Signed-off-by: Arnd Bergmann >>> --- >>> drivers/staging/comedi/drivers/dt282x.c | 62 >>> - >>> 1 file changed, 31 insertions(+), 31 deletions(-) >>> >>> diff --git a/drivers/staging/comedi/drivers/dt282x.c >>> b/drivers/staging/comedi/drivers/dt282x.c >>> index 40bf00984fa5..d4d45c759c62 100644 >>> --- a/drivers/staging/comedi/drivers/dt282x.c >>> +++ b/drivers/staging/comedi/drivers/dt282x.c >>> @@ -69,48 +69,48 @@ >>> * Register map >>> */ >>> #define DT2821_ADCSR_REG 0x00 >> -#define DT2821_ADCSR_ADERR (1 << 15) >>> -#define DT2821_ADCSR_ADCLK (1 << 9) >>> -#define DT2821_ADCSR_MUXBUSY (1 << 8) >>> -#define DT2821_ADCSR_ADDONE(1 << 7) >>> -#define DT2821_ADCSR_IADDONE (1 << 6) >>> +#define DT2821_ADCSR_ADERR (1u << 15) >> >> Changing all of these to use the BIT() macro should also avoid the warning. > > Yes, but it won't work for the ones that have more than one bit: > > #define DT2821_SUPCSR_DS_AD_TRIG (3 << 10) Use a helper macro for those bits: #define DT2821_SUPCSR_DS(x) (((x) & 0x3) << 10) #define DT2821_SUPCSR_DS_PIODT2821_SUPCSR_DS(0) #define DT2821_SUPCSR_DS_AD_CLK DT2821_SUPCSR_DS(1) #define DT2821_SUPCSR_DS_DA_CLK DT2821_SUPCSR_DS(2) #define DT2821_SUPCSR_DS_AD_TRIGDT2821_SUPCSR_DS(3) > I considered using BIT() but decided against it for consistency. Your change may fix the gcc-6 issue but it doesn't fix the 28 checkpatch.pl issues: CHECK: Prefer using the BIT macro Regards, Hartley ___ 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 4:22 PM, Joe Perches wrote: > On Thu, 2016-03-17 at 15:43 -0300, Gustavo Padovan wrote: >> 2016-03-17 Gustavo Padovan : >> > 2016-03-17 Joe Perches : >> > > On Thu, 2016-03-17 at 14:30 -0300, Gustavo Padovan wrote: >> > > > >> > > > This function had copies in 3 different files. Unify them in >> > > > kernel.h. >> > > This is only used by gpu/drm. >> > > >> > > I think this is a poor name for a generic function >> > > that would be in kernel.h. >> > > >> > > Isn't there an include file in linux/drm that's >> > > appropriate for this. Maybe drmP.h >> > > >> > > Maybe prefix this function name with drm_ too. >> > No, the next patch adds a user to drivers/staging (which will be moved >> > to drivers/dma-buf) soon. Maybe move to a different header in >> > include/linux/? not sure which one. >> > >> > > >> > > Also, there's this that might conflict: >> > > >> > > arch/powerpc/kernel/signal_32.c:#define to_user_ptr(p) >> > > ptr_to_compat(p) >> > > arch/powerpc/kernel/signal_32.c:#define to_user_ptr(p) >> > > ((unsigned long)(p)) >> > Right, I'll figure out how to replace these two too. >> The powerpc to_user_ptr has a different meaning from the one I'm adding >> in this patch. I propose we just rename powerpc's to_user_ptr to >> __to_user_ptr and leave the rest as is. > > I think that's not a good idea, and you should really check > this concept with the powerpc folk (added to to:s and cc:ed) > > If it were really added, then the function meaning is incorrect. > > This is taking a u64, casting that to (unsigned long/uint_ptr_t), > then converting that to a user pointer. > > Does that naming and use make sense on x86-32 or arm32? > fwiw Gustavo's version of to_user_ptr() is in use on arm32 and arm64.. Not entirely sure what doesn't make sense about it BR, -R ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 01/42] staging: comedi: ni_660x: change IOConfigReg() into a macro
The BUG_ON() in this function is unnecessary. The 'pfi_channel' will always be in range of the subdevice 'n_chan' (NUM_PFI_CHANNELS) which will return a valid 'reg'. Convert the inline function into a simple macro. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_660x.c | 22 -- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index 46647c6..10db2ff 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -156,13 +156,7 @@ enum ni_660x_register { NI660X_NUM_REGS, }; -static inline unsigned IOConfigReg(unsigned pfi_channel) -{ - unsigned reg = NI660X_IO_CFG_0_1 + pfi_channel / 2; - - BUG_ON(reg > NI660X_IO_CFG_38_39); - return reg; -} +#define NI660X_IO_CFG(x) (NI660X_IO_CFG_0_1 + ((x) / 2)) enum ni_660x_register_width { DATA_1B, @@ -893,7 +887,7 @@ static void init_tio_chip(struct comedi_device *dev, int chipset) devpriv->dma_configuration_soft_copies[chipset], NI660X_DMA_CFG); for (i = 0; i < NUM_PFI_CHANNELS; ++i) - ni_660x_write_register(dev, chipset, 0, IOConfigReg(i)); + ni_660x_write_register(dev, chipset, 0, NI660X_IO_CFG(i)); } static int ni_660x_dio_insn_bits(struct comedi_device *dev, @@ -944,22 +938,22 @@ static void ni_660x_select_pfi_output(struct comedi_device *dev, if (idle_chipset != active_chipset) { idle_bits = ni_660x_read_register(dev, idle_chipset, - IOConfigReg(pfi_channel)); + NI660X_IO_CFG(pfi_channel)); idle_bits &= ~pfi_output_select_mask(pfi_channel); idle_bits |= pfi_output_select_bits(pfi_channel, pfi_output_select_high_Z); ni_660x_write_register(dev, idle_chipset, idle_bits, - IOConfigReg(pfi_channel)); + NI660X_IO_CFG(pfi_channel)); } active_bits = ni_660x_read_register(dev, active_chipset, - IOConfigReg(pfi_channel)); + NI660X_IO_CFG(pfi_channel)); active_bits &= ~pfi_output_select_mask(pfi_channel); active_bits |= pfi_output_select_bits(pfi_channel, output_select); ni_660x_write_register(dev, active_chipset, active_bits, - IOConfigReg(pfi_channel)); + NI660X_IO_CFG(pfi_channel)); } static int ni_660x_set_pfi_routing(struct comedi_device *dev, unsigned chan, @@ -1025,10 +1019,10 @@ static int ni_660x_dio_insn_config(struct comedi_device *dev, break; case INSN_CONFIG_FILTER: - val = ni_660x_read_register(dev, 0, IOConfigReg(chan)); + val = ni_660x_read_register(dev, 0, NI660X_IO_CFG(chan)); val &= ~pfi_input_select_mask(chan); val |= pfi_input_select_bits(chan, data[1]); - ni_660x_write_register(dev, 0, val, IOConfigReg(chan)); + ni_660x_write_register(dev, 0, val, NI660X_IO_CFG(chan)); break; default: -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 6/9] rtlwifi: rtl8192se: Fix Smatch warning
Smatch lists the following: CHECK drivers/net/wireless/realtek/rtlwifi/rtl8192se/phy.c drivers/net/wireless/realtek/rtlwifi/rtl8192se/phy.c:648 rtl92s_phy_set_rf_power_state() warn: inconsistent indenting Signed-off-by: Larry Finger --- drivers/net/wireless/realtek/rtlwifi/rtl8192se/phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/phy.c index 4b4612f..82d6375 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/phy.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/phy.c @@ -645,7 +645,7 @@ bool rtl92s_phy_set_rf_power_state(struct ieee80211_hw *hw, rtlpriv->psc.state_inap); ppsc->last_sleep_jiffies = jiffies; _rtl92se_phy_set_rf_sleep(hw); - break; + break; default: RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "switch case not processed\n"); -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/2] rtlwifi: btcoexist: Implement antenna selection
The previous patch added an option to rtl8723be to manually select the antenna for those cases when only a single antenna is present, and the on-board EEPROM is incorrectly programmed. This patch implements the necessary changes in the Bluetooth coexistence driver. Signed-off-by: Larry Finger Cc: Stable [V4.0+] --- .../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 +++- 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c index c43ab59..77cbd10 100644 --- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c +++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c @@ -1203,7 +1203,6 @@ static void btc8723b2ant_set_ant_path(struct btc_coexist *btcoexist, /* Force GNT_BT to low */ btcoexist->btc_write_1byte_bitmask(btcoexist, 0x765, 0x18, 0x0); - btcoexist->btc_write_2byte(btcoexist, 0x948, 0x0); if (board_info->btdm_ant_pos == BTC_ANTENNA_AT_MAIN_PORT) { /* tell firmware "no antenna inverse" */ @@ -1211,19 +1210,25 @@ static void btc8723b2ant_set_ant_path(struct btc_coexist *btcoexist, h2c_parameter[1] = 1; /* ext switch type */ btcoexist->btc_fill_h2c(btcoexist, 0x65, 2, h2c_parameter); + btcoexist->btc_write_2byte(btcoexist, 0x948, 0x0); } else { /* tell firmware "antenna inverse" */ h2c_parameter[0] = 1; h2c_parameter[1] = 1; /* ext switch type */ btcoexist->btc_fill_h2c(btcoexist, 0x65, 2, h2c_parameter); + btcoexist->btc_write_2byte(btcoexist, 0x948, 0x280); } } /* ext switch setting */ if (use_ext_switch) { /* fixed internal switch S1->WiFi, S0->BT */ - btcoexist->btc_write_2byte(btcoexist, 0x948, 0x0); + if (board_info->btdm_ant_pos == BTC_ANTENNA_AT_MAIN_PORT) + btcoexist->btc_write_2byte(btcoexist, 0x948, 0x0); + else + btcoexist->btc_write_2byte(btcoexist, 0x948, 0x280); + switch (antpos_type) { case BTC_ANT_WIFI_AT_MAIN: /* ext switch main at wifi */ diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c index b2791c8..babd149 100644 --- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c +++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c @@ -965,13 +965,38 @@ void exhalbtc_set_chip_type(u8 chip_type) } } -void exhalbtc_set_ant_num(u8 type, u8 ant_num) +void exhalbtc_set_ant_num(struct rtl_priv *rtlpriv, u8 type, u8 ant_num) { if (BT_COEX_ANT_TYPE_PG == type) { gl_bt_coexist.board_info.pg_ant_num = ant_num; gl_bt_coexist.board_info.btdm_ant_num = ant_num; + /* The antenna position: +* Main (default) or Aux for pgAntNum=2 && btdmAntNum =1. +* The antenna position should be determined by +* auto-detect mechanism. +* The following is assumed to main, +* and those must be modified +* if y auto-detect mechanism is ready +*/ + if ((gl_bt_coexist.board_info.pg_ant_num == 2) && + (gl_bt_coexist.board_info.btdm_ant_num == 1)) + gl_bt_coexist.board_info.btdm_ant_pos = + BTC_ANTENNA_AT_MAIN_PORT; + else + gl_bt_coexist.board_info.btdm_ant_pos = + BTC_ANTENNA_AT_MAIN_PORT; } else if (BT_COEX_ANT_TYPE_ANTDIV == type) { gl_bt_coexist.board_info.btdm_ant_num = ant_num; + gl_bt_coexist.board_info.btdm_ant_pos = + BTC_ANTENNA_AT_MAIN_PORT; + } else if (type == BT_COEX_ANT_TYPE_DETECTED) { + gl_bt_coexist.board_info.btdm_ant_num = ant_num; + if (rtlpriv->cfg->mod_params->ant_sel == 1) + gl_bt_coexist.board_info.btdm_ant_pos = + BTC_ANTENNA_AT_AUX_PORT; + else + gl_bt_coexist.board_info.btdm_ant_pos = + BTC_ANTENNA_AT_MAIN_PORT;
[PATCH 40/42] staging: comedi: ni_660x: remove spinlock 'dma_cfg_lock'
This spinlock is only used to protect changes to the private data 'dma_cfg'. Before calling any function that would change the 'dma_cfg' the spinlock 'mite_channel_lock' is also locked. That spinlock is not unlocked until after the 'dma_cfg' change. Remove the redundant spinlock. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_660x.c | 9 - 1 file changed, 9 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index 85c793a..3b57ce5 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -263,8 +263,6 @@ struct ni_660x_private { spinlock_t mite_channel_lock; /* prevents races between interrupt and comedi_poll */ spinlock_t interrupt_lock; - /* protects dma_cfg changes */ - spinlock_t dma_cfg_lock; unsigned int dma_cfg[NI660X_MAX_CHIPS]; unsigned int io_cfg[NI660X_NUM_PFI_CHANNELS]; u64 io_dir; @@ -313,9 +311,7 @@ static inline void ni_660x_set_dma_channel(struct comedi_device *dev, { struct ni_660x_private *devpriv = dev->private; unsigned int chip = counter->chip_index; - unsigned long flags; - spin_lock_irqsave(&devpriv->dma_cfg_lock, flags); devpriv->dma_cfg[chip] &= ~NI660X_DMA_CFG_SEL_MASK(mite_channel); devpriv->dma_cfg[chip] |= NI660X_DMA_CFG_SEL(mite_channel, counter->counter_index); @@ -323,7 +319,6 @@ static inline void ni_660x_set_dma_channel(struct comedi_device *dev, NI660X_DMA_CFG_RESET(mite_channel), NI660X_DMA_CFG); mmiowb(); - spin_unlock_irqrestore(&devpriv->dma_cfg_lock, flags); } static inline void ni_660x_unset_dma_channel(struct comedi_device *dev, @@ -332,14 +327,11 @@ static inline void ni_660x_unset_dma_channel(struct comedi_device *dev, { struct ni_660x_private *devpriv = dev->private; unsigned int chip = counter->chip_index; - unsigned long flags; - spin_lock_irqsave(&devpriv->dma_cfg_lock, flags); devpriv->dma_cfg[chip] &= ~NI660X_DMA_CFG_SEL_MASK(mite_channel); devpriv->dma_cfg[chip] |= NI660X_DMA_CFG_SEL_NONE(mite_channel); ni_660x_write(dev, chip, devpriv->dma_cfg[chip], NI660X_DMA_CFG); mmiowb(); - spin_unlock_irqrestore(&devpriv->dma_cfg_lock, flags); } static int ni_660x_request_mite_channel(struct comedi_device *dev, @@ -500,7 +492,6 @@ static int ni_660x_allocate_private(struct comedi_device *dev) spin_lock_init(&devpriv->mite_channel_lock); spin_lock_init(&devpriv->interrupt_lock); - spin_lock_init(&devpriv->dma_cfg_lock); for (i = 0; i < NI660X_NUM_PFI_CHANNELS; ++i) devpriv->io_cfg[i] = NI_660X_PFI_OUTPUT_COUNTER; -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: RE
Did you get my previous message i sent to you? when and what time can i call you? ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [patch] staging: lustre: checking for NULL instead of IS_ERR
On 2016/03/17, 23:42, "Dan Carpenter" wrote: >lustre_cfg_new() returns error pointers on error, it never returns NULL. > >Signed-off-by: Dan Carpenter > >diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c >b/drivers/staging/lustre/lustre/mgc/mgc_request.c >index 65caffe..b7dc872 100644 >--- a/drivers/staging/lustre/lustre/mgc/mgc_request.c >+++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c >@@ -1282,7 +1282,7 @@ static int mgc_apply_recover_logs(struct obd_device >*mgc, > > rc = -ENOMEM; > lcfg = lustre_cfg_new(LCFG_PARAM, &bufs); >- if (!lcfg) { >+ if (IS_ERR(lcfg)) { > CERROR("mgc: cannot allocate memory\n"); > break; > } Looks good. Thanks for the patch. Reviewed-by: Andreas Dilger Cheers, Andreas -- Andreas Dilger Lustre Principal Architect Intel High Performance Data Division ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: most: hdm-dim2: Remove possible dereference error
On Fri, Mar 18, 2016 at 7:44 PM, Andrey Shvetsov wrote: > On Fri, Mar 18, 2016 at 06:32:15PM +0530, Amitoj Kaur Chawla wrote: >> Commit 3eced21a5afb ("staging: most: hdm-dim2: Replace request_irq >> with devm_request_irq") introduced the following static checker >> warning: >> drivers/staging/most/hdm-dim2/dim2_hdm.c:841 dim2_probe() >> error: 'dev->netinfo_task' dereferencing possible ERR_PTR() >> >> Remove the warning by returning PTR_ERR immediately rather than >> storing in a variable and returning at the end of the function >> since we do not need to free anything. > This patch is not about a warning. > > This patch fixes the bug introduced in the previous patch that has > changed the control flow so that the error code returned by the > kthread_run was overwritten by the "ret = dim2_sysfs_probe" below. > > regards > andy I'll revise the commit message and resend. Thanks, Amitoj ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: r8723au: This patch tries to fix some byte order issues that is found by sparse check.
Hi Jandy, On Thu, Mar 17, 2016 at 7:03 PM, Jandy Gou wrote: > make C=1 M=drivers/staging/rtl8723au/ > > drivers/staging/rtl8723au/hal/rtl8723a_cmd.c:96:38: warning: cast to > restricted __le16 > drivers/staging/rtl8723au/hal/rtl8723a_cmd.c:100:27: warning: cast to > restricted __le32 > > Signed-off-by: Jandy Gou I'm not sure your change is correct. Perhaps you should add temporary variables for h2c_cmd_ex and h2c_cmd while they're cpu-endian? Jes, I'm pretty sure this isn't the first time this has come up. Do you have any ideas for a solution? Or should we ignore this as this driver will eventually be going away? Thanks, Julian Calaby > --- > drivers/staging/rtl8723au/hal/rtl8723a_cmd.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c > b/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c > index 1662c03c..d82fd8a 100644 > --- a/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c > +++ b/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c > @@ -93,11 +93,11 @@ int FillH2CCmd(struct rtw_adapter *padapter, u8 > ElementID, u32 CmdLen, > > if (h2c_cmd & BIT(7)) { > msgbox_ex_addr = REG_HMEBOX_EXT_0 + (h2c_box_num * > EX_MESSAGE_BOX_SIZE); > - h2c_cmd_ex = le16_to_cpu(h2c_cmd_ex); > + le16_to_cpus(&h2c_cmd_ex); > rtl8723au_write16(padapter, msgbox_ex_addr, > h2c_cmd_ex); > } > msgbox_addr = REG_HMEBOX_0 + (h2c_box_num * MESSAGE_BOX_SIZE); > - h2c_cmd = le32_to_cpu(h2c_cmd); > + le32_to_cpus(&h2c_cmd); > rtl8723au_write32(padapter, msgbox_addr, h2c_cmd); > > bcmd_down = true; > -- > 1.9.1 > > > -- > To unsubscribe from this list: send the line "unsubscribe linux-wireless" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Julian Calaby Email: julian.cal...@gmail.com Profile: http://www.google.com/profiles/julian.calaby/ ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: rtl8192e: fixed coding style issues
On Thu, Mar 17, 2016 at 06:21:55PM +, Yousof El-Sayed wrote: > staging: rtl8192e - dot11d.c ??? > > [patch 1/2] Fixed throughout: > spaces preferred around that '+' (ctx:VxV) > > [patch 2/2] Fixed throughout: > Please don't use multiple blank lines What are these? You put 2 patches inside one? Please read the documentation for how to create a patch properly, it's in Documentation/SubmittingPatches. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/5] Drivers: hv: vmbus: Introduce functions for estimating room in the ring buffer
Introduce separate functions for estimating how much can be read from and written to the ring buffer. Signed-off-by: K. Y. Srinivasan --- drivers/hv/ring_buffer.c | 24 include/linux/hyperv.h | 27 +++ 2 files changed, 31 insertions(+), 20 deletions(-) diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c index 085003a..902375b 100644 --- a/drivers/hv/ring_buffer.c +++ b/drivers/hv/ring_buffer.c @@ -38,8 +38,6 @@ void hv_begin_read(struct hv_ring_buffer_info *rbi) u32 hv_end_read(struct hv_ring_buffer_info *rbi) { - u32 read; - u32 write; rbi->ring_buffer->interrupt_mask = 0; mb(); @@ -49,9 +47,7 @@ u32 hv_end_read(struct hv_ring_buffer_info *rbi) * If it is not, we raced and we need to process new * incoming messages. */ - hv_get_ringbuffer_availbytes(rbi, &read, &write); - - return read; + return hv_get_bytes_to_read(rbi); } /* @@ -106,18 +102,13 @@ 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 r_size; - u32 write_loc = rbi->ring_buffer->write_index; - u32 read_loc = rbi->ring_buffer->read_index; u32 pending_sz = rbi->ring_buffer->pending_send_sz; /* If the other end is not blocked on write don't bother. */ if (pending_sz == 0) return false; - r_size = rbi->ring_datasize; - cur_write_sz = write_loc >= read_loc ? r_size - (write_loc - read_loc) : - read_loc - write_loc; + cur_write_sz = hv_get_bytes_to_write(rbi); if (cur_write_sz >= pending_sz) return true; @@ -317,7 +308,6 @@ int hv_ringbuffer_write(struct hv_ring_buffer_info *outring_info, { int i = 0; u32 bytes_avail_towrite; - u32 bytes_avail_toread; u32 totalbytes_towrite = 0; u32 next_write_location; @@ -333,9 +323,7 @@ int hv_ringbuffer_write(struct hv_ring_buffer_info *outring_info, if (lock) spin_lock_irqsave(&outring_info->ring_lock, flags); - hv_get_ringbuffer_availbytes(outring_info, - &bytes_avail_toread, - &bytes_avail_towrite); + bytes_avail_towrite = hv_get_bytes_to_write(outring_info); /* * If there is only room for the packet, assume it is full. @@ -386,7 +374,6 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer, u32 buflen, u32 *buffer_actual_len, u64 *requestid, bool *signal, bool raw) { - u32 bytes_avail_towrite; u32 bytes_avail_toread; u32 next_read_location = 0; u64 prev_indices = 0; @@ -402,10 +389,7 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, *buffer_actual_len = 0; *requestid = 0; - hv_get_ringbuffer_availbytes(inring_info, - &bytes_avail_toread, - &bytes_avail_towrite); - + bytes_avail_toread = hv_get_bytes_to_read(inring_info); /* Make sure there is something to read */ if (bytes_avail_toread < sizeof(desc)) { /* diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index ecd81c3..a6b053c 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -151,6 +151,33 @@ hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi, *read = dsize - *write; } +static inline u32 hv_get_bytes_to_read(struct hv_ring_buffer_info *rbi) +{ + u32 read_loc, write_loc, dsize, read; + + dsize = rbi->ring_datasize; + read_loc = rbi->ring_buffer->read_index; + write_loc = READ_ONCE(rbi->ring_buffer->write_index); + + read = write_loc >= read_loc ? (write_loc - read_loc) : + (dsize - read_loc) + write_loc; + + return read; +} + +static inline u32 hv_get_bytes_to_write(struct hv_ring_buffer_info *rbi) +{ + u32 read_loc, write_loc, dsize, write; + + dsize = rbi->ring_datasize; + read_loc = READ_ONCE(rbi->ring_buffer->read_index); + write_loc = rbi->ring_buffer->write_index; + + write = write_loc >= read_loc ? dsize - (write_loc - read_loc) : + read_loc - write_loc; + return write; +} + /* * VMBUS version is 32 bit entity broken up into * two 16 bit quantities: major_number. minor_number. -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] staging/comedi/dt282x: avoid integer overflow warning
gcc-6 warns about passing negative signed integer into swab16() in the dt282x driver: drivers/staging/comedi/drivers/dt282x.c: In function 'dt282x_load_changain': include/uapi/linux/swab.h:14:33: warning: integer overflow in expression [-Woverflow] (((__u16)(x) & (__u16)0xff00U) >> 8))) ~~~^ include/uapi/linux/swab.h:107:2: note: in expansion of macro '___constant_swab16' ___constant_swab16(x) : \ ^~ include/uapi/linux/byteorder/big_endian.h:34:43: note: in expansion of macro '__swab16' #define __cpu_to_le16(x) ((__force __le16)__swab16((x))) ^~~~ include/linux/byteorder/generic.h:89:21: note: in expansion of macro '__cpu_to_le16' #define cpu_to_le16 __cpu_to_le16 ^ arch/arm/include/asm/io.h:250:6: note: in expansion of macro 'cpu_to_le16' cpu_to_le16(v),__io(p)); }) ^~~ drivers/staging/comedi/drivers/dt282x.c:566:2: note: in expansion of macro 'outw' outw(DT2821_CHANCSR_LLE | DT2821_CHANCSR_NUMB(n), ^~~~ The warning makes sense, though the code is correct as far as I can tell. This disambiguates the operation by making the constant expressions we pass here explicitly 'unsigned', which helps to avoid the warning. As pointed out by Hartley Sweeten, scripts/checkpatch.pl notices that the shifts here are rather unreadable, though the suggested BIT() macro wouldn't work either. I'm changing it to a hexadecimal notation, which hopefully improves readability. I'm leaving the DT2821_CHANCSR_PRESLA alone because it seems wrong. Signed-off-by: Arnd Bergmann --- v2: also reformat to make checkpatch.pl happy drivers/staging/comedi/drivers/dt282x.c | 72 - 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/drivers/staging/comedi/drivers/dt282x.c b/drivers/staging/comedi/drivers/dt282x.c index 40bf00984fa5..991e9f44c18c 100644 --- a/drivers/staging/comedi/drivers/dt282x.c +++ b/drivers/staging/comedi/drivers/dt282x.c @@ -69,48 +69,48 @@ * Register map */ #define DT2821_ADCSR_REG 0x00 -#define DT2821_ADCSR_ADERR (1 << 15) -#define DT2821_ADCSR_ADCLK (1 << 9) -#define DT2821_ADCSR_MUXBUSY (1 << 8) -#define DT2821_ADCSR_ADDONE(1 << 7) -#define DT2821_ADCSR_IADDONE (1 << 6) -#define DT2821_ADCSR_GS(x) (((x) & 0x3) << 4) -#define DT2821_ADCSR_CHAN(x) (((x) & 0xf) << 0) +#define DT2821_ADCSR_ADERR 0x8000u +#define DT2821_ADCSR_ADCLK 0x0200u +#define DT2821_ADCSR_MUXBUSY 0x0100u +#define DT2821_ADCSR_ADDONE0x0080u +#define DT2821_ADCSR_IADDONE 0x0040u +#define DT2821_ADCSR_GS(x)(0x0030u & ((x) << 4)) +#define DT2821_ADCSR_CHAN(x) (0x000fu & (x)) #define DT2821_CHANCSR_REG 0x02 -#define DT2821_CHANCSR_LLE (1 << 15) -#define DT2821_CHANCSR_PRESLA(x) (((x) & 0xf) >> 8) -#define DT2821_CHANCSR_NUMB(x) x) - 1) & 0xf) << 0) +#define DT2821_CHANCSR_LLE 0x8000u +#define DT2821_CHANCSR_PRESLA(x) (((x) & 0xf) >> 8) /* always 0? */ +#define DT2821_CHANCSR_NUMB(x)(0x000fu & ((x) - 1)) #define DT2821_ADDAT_REG 0x04 #define DT2821_DACSR_REG 0x06 -#define DT2821_DACSR_DAERR (1 << 15) -#define DT2821_DACSR_YSEL(x) ((x) << 9) -#define DT2821_DACSR_SSEL (1 << 8) -#define DT2821_DACSR_DACRDY(1 << 7) -#define DT2821_DACSR_IDARDY(1 << 6) -#define DT2821_DACSR_DACLK (1 << 5) -#define DT2821_DACSR_HBOE (1 << 1) -#define DT2821_DACSR_LBOE (1 << 0) +#define DT2821_DACSR_DAERR 0x8000u +#define DT2821_DACSR_YSEL(x) (0x7e00u & (x) << 9) +#define DT2821_DACSR_SSEL 0x0100u +#define DT2821_DACSR_DACRDY0x0080u +#define DT2821_DACSR_IDARDY0x0040u +#define DT2821_DACSR_DACLK 0x0020u +#define DT2821_DACSR_HBOE 0x0002u +#define DT2821_DACSR_LBOE 0x0001u #define DT2821_DADAT_REG 0x08 #define DT2821_DIODAT_REG 0x0a #define DT2821_SUPCSR_REG 0x0c -#define DT2821_SUPCSR_DMAD (1 << 15) -#define DT2821_SUPCSR_ERRINTEN (1 << 14) -#define DT2821_SUPCSR_CLRDMADNE(1 << 13) -#define DT2821_SUPCSR_DDMA (1 << 12) -#define DT2821_SUPCSR_DS_PIO (0 << 10) -#define DT2821_SUPCSR_DS_AD_CLK(1 << 10) -#define DT2821_SUPCSR_DS_DA_CLK(2 << 10) -#define DT2821_SUPCSR_DS_AD_TRIG (3 << 10) -#define DT2821_SUPCSR_BUFFB(1 << 9) -#define DT2821_SUPCSR_SCDN (1 << 8) -#define DT2821_SUPCSR_DACON(1 << 7) -#define DT2821_SUPCSR_ADCINIT (1 << 6) -#define DT2821_SUPCSR_DACINIT (1 << 5) -#define DT2821_SUPCSR_PRLD (1 <
Re: [PATCH] staging/comedi/dt282x: avoid integer overflow warning
On Wednesday 16 March 2016 17:04:15 Hartley Sweeten wrote: > > #define DT2821_SUPCSR_DS_AD_TRIG (3 << 10) > > Use a helper macro for those bits: > > #define DT2821_SUPCSR_DS(x) (((x) & 0x3) << 10) > #define DT2821_SUPCSR_DS_PIODT2821_SUPCSR_DS(0) > #define DT2821_SUPCSR_DS_AD_CLK DT2821_SUPCSR_DS(1) > #define DT2821_SUPCSR_DS_DA_CLK DT2821_SUPCSR_DS(2) > #define DT2821_SUPCSR_DS_AD_TRIGDT2821_SUPCSR_DS(3) > > > I considered using BIT() but decided against it for consistency. > > Your change may fix the gcc-6 issue but it doesn't fix the 28 checkpatch.pl > issues: > CHECK: Prefer using the BIT macro I sent a new version now, and found a better solution that avoids using BIT(). Arnd ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 26/42] staging: comedi: ni_660x: add comments for the spinlock_t definitions
Fix the checkpatch.pl issues: CHECK: spinlock_t definition without comment For aesthetics, rename the 'soft_reg_copy_lock' to clarify what it's used for. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_660x.c | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index 3edea99..2926d26 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -398,11 +398,13 @@ struct ni_660x_private { struct ni_gpct_device *counter_dev; struct mite_dma_descriptor_ring *mite_rings[NI_660X_MAX_NUM_CHIPS][counters_per_chip]; + /* protects mite channel request/release */ spinlock_t mite_channel_lock; - /* interrupt_lock prevents races between interrupt and comedi_poll */ + /* prevents races between interrupt and comedi_poll */ spinlock_t interrupt_lock; + /* protects dma_cfg changes */ + spinlock_t dma_cfg_lock; unsigned int dma_cfg[NI_660X_MAX_NUM_CHIPS]; - spinlock_t soft_reg_copy_lock; unsigned int io_cfg[NUM_PFI_CHANNELS]; u64 io_dir; }; @@ -482,7 +484,7 @@ static inline void ni_660x_set_dma_channel(struct comedi_device *dev, unsigned int chip = counter->chip_index; unsigned long flags; - spin_lock_irqsave(&devpriv->soft_reg_copy_lock, flags); + spin_lock_irqsave(&devpriv->dma_cfg_lock, flags); devpriv->dma_cfg[chip] &= ~NI660X_DMA_CFG_SEL_MASK(mite_channel); devpriv->dma_cfg[chip] |= NI660X_DMA_CFG_SEL(mite_channel, counter->counter_index); @@ -490,7 +492,7 @@ static inline void ni_660x_set_dma_channel(struct comedi_device *dev, NI660X_DMA_CFG_RESET(mite_channel), NI660X_DMA_CFG); mmiowb(); - spin_unlock_irqrestore(&devpriv->soft_reg_copy_lock, flags); + spin_unlock_irqrestore(&devpriv->dma_cfg_lock, flags); } static inline void ni_660x_unset_dma_channel(struct comedi_device *dev, @@ -501,12 +503,12 @@ static inline void ni_660x_unset_dma_channel(struct comedi_device *dev, unsigned int chip = counter->chip_index; unsigned long flags; - spin_lock_irqsave(&devpriv->soft_reg_copy_lock, flags); + spin_lock_irqsave(&devpriv->dma_cfg_lock, flags); devpriv->dma_cfg[chip] &= ~NI660X_DMA_CFG_SEL_MASK(mite_channel); devpriv->dma_cfg[chip] |= NI660X_DMA_CFG_SEL_NONE(mite_channel); ni_660x_write(dev, chip, devpriv->dma_cfg[chip], NI660X_DMA_CFG); mmiowb(); - spin_unlock_irqrestore(&devpriv->soft_reg_copy_lock, flags); + spin_unlock_irqrestore(&devpriv->dma_cfg_lock, flags); } static int ni_660x_request_mite_channel(struct comedi_device *dev, @@ -662,7 +664,7 @@ static int ni_660x_allocate_private(struct comedi_device *dev) spin_lock_init(&devpriv->mite_channel_lock); spin_lock_init(&devpriv->interrupt_lock); - spin_lock_init(&devpriv->soft_reg_copy_lock); + spin_lock_init(&devpriv->dma_cfg_lock); for (i = 0; i < NUM_PFI_CHANNELS; ++i) devpriv->io_cfg[i] = NI_660X_PFI_OUTPUT_COUNTER; -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: rtl8192e: fix line length coding style issue in rtllib_softmac.c
On Fri, Mar 18, 2016 at 10:54:42AM +, Yousof El-Sayed wrote: > This is a patch to the rtllib_softmac.c file that fixes up all instances of > the 'line over 80 characters' warnings found by the checkpatch.pl tool Your changelog should be wrapped, ironic given the contents of your patch :( Please fix up and resend. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 09/42] staging: comedi: ni_660x: cleanup the NI660X_DMA_CFG register helpers
The BUG_ON() checks in the helper functions are not necessary. The mite driver quiries the PCI chip to determine the number of DMA channels. This is then used when a DMA channel is requested so the channel will always be in range. Convert the inline functions used to set the bits in the NI600X_DMA_CFG register into macros. Also convert the associated enum dma_selection. This clarifies the association with the register. Rename the associated 'dma_configuration_soft_copies' member of the private data to allow shorting some of the ugly long lines in the driver. This also fixes a number of checkpatch.pl issues about: WARNING: Prefer 'unsigned int' to bare use of 'unsigned' Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_660x.c | 63 ++-- 1 file changed, 19 insertions(+), 44 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index 30089cd..0b37982 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -157,6 +157,11 @@ enum ni_660x_register { #define NI660X_CLK_CFG_COUNTER_SWAPBIT(21) +#define NI660X_DMA_CFG_SEL(_c, _s) (((_s) & 0x1f) << (8 * (_c))) +#define NI660X_DMA_CFG_SEL_MASK(_c)NI660X_DMA_CFG_SEL((_c), 0x1f) +#define NI660X_DMA_CFG_SEL_NONE(_c)NI660X_DMA_CFG_SEL((_c), 0x1f) +#define NI660X_DMA_CFG_RESET(_c) NI660X_DMA_CFG_SEL((_c), 0x80) + #define NI660X_IO_CFG(x) (NI660X_IO_CFG_0_1 + ((x) / 2)) #define NI660X_IO_CFG_OUT_SEL(_c, _s) (((_s) & 0x3) << (((_c) % 2) ? 0 : 8)) #define NI660X_IO_CFG_OUT_SEL_MASK(_c) NI660X_IO_CFG_OUT_SEL((_c), 0x3) @@ -282,29 +287,6 @@ static const struct ni_660x_register_data ni_660x_reg_data[NI660X_NUM_REGS] = { [NI660X_IO_CFG_38_39] = { 0x7a2, 2 } /* read/write */ }; -/* dma configuration register bits */ -static inline unsigned dma_select_mask(unsigned dma_channel) -{ - BUG_ON(dma_channel >= MAX_DMA_CHANNEL); - return 0x1f << (8 * dma_channel); -} - -enum dma_selection { - dma_selection_none = 0x1f, -}; - -static inline unsigned dma_select_bits(unsigned dma_channel, unsigned selection) -{ - BUG_ON(dma_channel >= MAX_DMA_CHANNEL); - return (selection << (8 * dma_channel)) & dma_select_mask(dma_channel); -} - -static inline unsigned dma_reset_bit(unsigned dma_channel) -{ - BUG_ON(dma_channel >= MAX_DMA_CHANNEL); - return 0x80 << (8 * dma_channel); -} - enum global_interrupt_status_register_bits { Counter_0_Int_Bit = 0x100, Counter_1_Int_Bit = 0x200, @@ -372,7 +354,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_configuration_soft_copies[NI_660X_MAX_NUM_CHIPS]; + unsigned dma_cfg[NI_660X_MAX_NUM_CHIPS]; spinlock_t soft_reg_copy_lock; unsigned short pfi_output_selects[NUM_PFI_CHANNELS]; }; @@ -591,13 +573,12 @@ static inline void ni_660x_set_dma_channel(struct comedi_device *dev, unsigned long flags; spin_lock_irqsave(&devpriv->soft_reg_copy_lock, flags); - devpriv->dma_configuration_soft_copies[chip] &= - ~dma_select_mask(mite_channel); - devpriv->dma_configuration_soft_copies[chip] |= - dma_select_bits(mite_channel, counter->counter_index); - ni_660x_write_register(dev, chip, - devpriv->dma_configuration_soft_copies[chip] | - dma_reset_bit(mite_channel), NI660X_DMA_CFG); + devpriv->dma_cfg[chip] &= ~NI660X_DMA_CFG_SEL_MASK(mite_channel); + devpriv->dma_cfg[chip] |= NI660X_DMA_CFG_SEL(mite_channel, +counter->counter_index); + ni_660x_write_register(dev, chip, devpriv->dma_cfg[chip] | + NI660X_DMA_CFG_RESET(mite_channel), + NI660X_DMA_CFG); mmiowb(); spin_unlock_irqrestore(&devpriv->soft_reg_copy_lock, flags); } @@ -611,12 +592,9 @@ static inline void ni_660x_unset_dma_channel(struct comedi_device *dev, unsigned long flags; spin_lock_irqsave(&devpriv->soft_reg_copy_lock, flags); - devpriv->dma_configuration_soft_copies[chip] &= - ~dma_select_mask(mite_channel); - devpriv->dma_configuration_soft_copies[chip] |= - dma_select_bits(mite_channel, dma_selection_none); - ni_660x_write_register(dev, chip, - devpriv->dma_configuration_soft_copies[chip], + devpriv->dma_cfg[chip] &= ~NI660X_DMA_CFG_SEL_MASK(mite_channel); + devpriv->dma_cfg[chip] |= NI660X_DMA_CFG_SEL_NONE(mite_channel); + ni_660x_write_register(dev, chip, devpriv->dma_cfg[chip], NI660X_DMA_CFG); mmiowb(); s
[PATCH 8/9] rtlwifi: rtl8723be: Fix Smatch warnings
Smatch reports the following: CHECK drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c:1726 _rtl8723be_phy_path_a_rx_iqk() warn: inconsistent indenting drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c:2304 _rtl8723be_phy_lc_calibrate() warn: inconsistent indenting drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c:2609 _rtl8723be_phy_set_rf_power_state() warn: inconsistent indenting CHECK drivers/net/wireless/realtek/rtlwifi/rtl8723be/rf.c drivers/net/wireless/realtek/rtlwifi/rtl8723be/rf.c:306 _rtl8723be_get_txpower_writeval_by_regulatory() warn: inconsistent indenting Signed-off-by: Larry Finger --- drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c | 10 -- drivers/net/wireless/realtek/rtlwifi/rtl8723be/rf.c | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c index b7b73cb..445f681 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c @@ -1723,8 +1723,8 @@ static u8 _rtl8723be_phy_path_a_rx_iqk(struct ieee80211_hw *hw) /* Allen 20131125 */ tmp = (reg_eac & 0x03FF) >> 16; - if ((tmp & 0x200) > 0) - tmp = 0x400 - tmp; + if ((tmp & 0x200) > 0) + tmp = 0x400 - tmp; /* if Tx is OK, check whether Rx is OK */ if (!(reg_eac & BIT(27)) && (((reg_ea4 & 0x03FF) >> 16) != 0x132) && @@ -2301,8 +2301,7 @@ static void _rtl8723be_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t) } else { rtl_write_byte(rtlpriv, REG_TXPAUSE, 0x00); } -RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "\n"); - + RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "\n"); } static void _rtl8723be_phy_set_rfpath_switch(struct ieee80211_hw *hw, @@ -2606,8 +2605,7 @@ static bool _rtl8723be_phy_set_rf_power_state(struct ieee80211_hw *hw, "IPS Set eRf nic enable\n"); rtstatus = rtl_ps_enable_nic(hw); } while (!rtstatus && (initializecount < 10)); - RT_CLEAR_PS_LEVEL(ppsc, - RT_RF_OFF_LEVL_HALT_NIC); + RT_CLEAR_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC); } else { RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, "Set ERFON sleeped:%d ms\n", diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/rf.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/rf.c index 5ed4492..97f5a03 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/rf.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/rf.c @@ -303,8 +303,8 @@ static void _rtl8723be_get_txpower_writeval_by_regulatory( [chnlgroup][index + (rf ? 8 : 0)] & (0x7f << (i * 8))) >> (i * 8)); - if (pwr_diff_limit[i] > pwr_diff) - pwr_diff_limit[i] = pwr_diff; + if (pwr_diff_limit[i] > pwr_diff) + pwr_diff_limit[i] = pwr_diff; } customer_limit = (pwr_diff_limit[3] << 24) | -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 39/42] staging: comedi: ni_660x: remove ni_gpct_to_660x_register[]
enum ni_gpct_register and enum ni_660x_register now have a 1:1 relationship for the NITIO_* registers. The static const array is no longer necessary to find the proper NI660X_* register for a given NITIO_*. Remove it and refactor the register read/write functions. Use the NITIO_* values to init the ni_660x_reg_data[] array and remove the unnecessary NI660X_* enum values. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_660x.c | 307 --- 1 file changed, 74 insertions(+), 233 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index ad67ee5..85c793a 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -43,75 +43,7 @@ /* See Register-Level Programmer Manual page 3.1 */ enum ni_660x_register { - NI660X_G0_AUTO_INC, - NI660X_G1_AUTO_INC, - NI660X_G2_AUTO_INC, - NI660X_G3_AUTO_INC, - NI660X_G0_CMD, - NI660X_G1_CMD, - NI660X_G2_CMD, - NI660X_G3_CMD, - NI660X_G0_HW_SAVE, - NI660X_G1_HW_SAVE, - 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_G1_MODE, - NI660X_G2_MODE, - NI660X_G3_MODE, - NI660X_G0_LOADA, - 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_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_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_G3_INT_ACK, - NI660X_G0_STATUS, - NI660X_G1_STATUS, - NI660X_G2_STATUS, - NI660X_G3_STATUS, - NI660X_G0_INT_ENA, - NI660X_G1_INT_ENA, - NI660X_G2_INT_ENA, - NI660X_G3_INT_ENA, - + /* see enum ni_gpct_register */ NI660X_STC_DIO_PARALLEL_INPUT = NITIO_NUM_REGS, NI660X_STC_DIO_OUTPUT, NI660X_STC_DIO_CONTROL, @@ -172,78 +104,78 @@ struct ni_660x_register_data { }; static const struct ni_660x_register_data ni_660x_reg_data[NI660X_NUM_REGS] = { - [NI660X_G0_INT_ACK] = { 0x004, 2 }, /* write */ - [NI660X_G0_STATUS] = { 0x004, 2 }, /* read */ - [NI660X_G1_INT_ACK] = { 0x006, 2 }, /* write */ - [NI660X_G1_STATUS] = { 0x006, 2 }, /* read */ - [NI660X_G01_STATUS] = { 0x008, 2 }, /* read */ - [NI660X_G0_CMD] = { 0x00c, 2 }, /* write */ + [NITIO_G0_INT_ACK] = { 0x004, 2 }, /* write */ + [NITIO_G0_STATUS] = { 0x004, 2 }, /* read */ + [NITIO_G1_INT_ACK] = { 0x006, 2 }, /* write */ + [NITIO_G1_STATUS] = { 0x006, 2 }, /* read */ + [NITIO_G01_STATUS] = { 0x008, 2 }, /* read */ + [NITIO_G0_CMD] = { 0x00c, 2 }, /* write */ [NI660X_STC_DIO_PARALLEL_INPUT] = { 0x00e, 2 }, /* read */ - [NI660X_G1_CMD] = { 0x00e, 2 }, /* write */ - [NI660X_G0_HW_SAVE] = { 0x010, 4 }, /* read */ - [NI660X_G1_HW_SAVE] = { 0x014, 4 }, /* read */ + [NITIO_G1_CMD] = { 0x00e, 2 }, /* write */ + [NITIO_G0_HW_SAVE] = { 0x010, 4 }, /* read */ + [NITIO_G1_HW_SAVE] = { 0x014, 4 }, /* read */ [NI660X_STC_DIO_OUTPUT] = { 0x014, 2 }, /* write */ [NI660X_STC_DIO_CONTROL]= { 0x016, 2 }, /* write */ - [NI660X_G0_SW_SAVE] = { 0x018, 4 }, /* read */ - [NI660X_G1_SW_SAVE] = { 0x01c, 4 }, /* read */ - [NI660X_G0_MODE]= { 0x034, 2 }, /* write */ - [NI660X_G01_STATUS1]= { 0x036, 2 }, /* read */ - [NI660X_G1_MODE]= { 0x036, 2 }, /* write */ + [NITIO_G0_SW_SAVE] = { 0x018, 4 }, /* read */ + [NITIO_G1_SW_SAVE] = { 0x01c, 4 }, /* read */ + [NITIO_G0_MODE] = { 0x034, 2 }, /* write */ + [NITIO_G01_STATU
Re: [PATCH v9 2/3] kernel.h: add to_user_ptr()
On Thu, Mar 17, 2016 at 4:40 PM, Joe Perches wrote: > On Thu, 2016-03-17 at 16:33 -0400, Rob Clark wrote: >> On Thu, Mar 17, 2016 at 4:22 PM, Joe Perches wrote: >> > On Thu, 2016-03-17 at 15:43 -0300, Gustavo Padovan wrote: >> > > 2016-03-17 Gustavo Padovan : >> > > > 2016-03-17 Joe Perches : >> > > > > On Thu, 2016-03-17 at 14:30 -0300, Gustavo Padovan wrote: >> > > > > > This function had copies in 3 different files. Unify them in >> > > > > > kernel.h. >> > > > > This is only used by gpu/drm. >> > > > > >> > > > > I think this is a poor name for a generic function >> > > > > that would be in kernel.h. >> > > > > >> > > > > Isn't there an include file in linux/drm that's >> > > > > appropriate for this. Maybe drmP.h >> > > > > >> > > > > Maybe prefix this function name with drm_ too. >> > > > No, the next patch adds a user to drivers/staging (which will be moved >> > > > to drivers/dma-buf) soon. Maybe move to a different header in >> > > > include/linux/? not sure which one. >> > > > >> > > > > >> > > > > >> > > > > Also, there's this that might conflict: >> > > > > >> > > > > arch/powerpc/kernel/signal_32.c:#define to_user_ptr(p) >> > > > > ptr_to_compat(p) >> > > > > arch/powerpc/kernel/signal_32.c:#define to_user_ptr(p) >> > > > > ((unsigned long)(p)) >> > > > Right, I'll figure out how to replace these two too. >> > > The powerpc to_user_ptr has a different meaning from the one I'm adding >> > > in this patch. I propose we just rename powerpc's to_user_ptr to >> > > __to_user_ptr and leave the rest as is. >> > I think that's not a good idea, and you should really check >> > this concept with the powerpc folk (added to to:s and cc:ed) >> > >> > If it were really added, then the function meaning is incorrect. >> > >> > This is taking a u64, casting that to (unsigned long/uint_ptr_t), >> > then converting that to a user pointer. >> > >> > Does that naming and use make sense on x86-32 or arm32? >> > >> fwiw Gustavo's version of to_user_ptr() is in use on arm32 and arm64.. >> Not entirely sure what doesn't make sense about it > > 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) BR, -R > As a static function in a single file, it's not > great, but OK, fine, it's static. > > As a global function in kernel.h, it's misleading. > > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: unisys: visornic: Fixed Checkpatch Warnings
On Wed, Mar 16, 2016 at 06:24:47PM -0700, Gavin O'Leary wrote: > Fixed the coding style checkpatch warnings. Which ones? Always be specific. And only fix one type of thing at a time. > > Signed-off-by: Gavin O'Leary > --- > drivers/staging/unisys/visornic/visornic_main.c | 16 ++-- > 1 file changed, 10 insertions(+), 6 deletions(-) > > diff --git a/drivers/staging/unisys/visornic/visornic_main.c > b/drivers/staging/unisys/visornic/visornic_main.c > index 0519470..0366624 100644 > --- a/drivers/staging/unisys/visornic/visornic_main.c > +++ b/drivers/staging/unisys/visornic/visornic_main.c > @@ -1218,8 +1218,9 @@ visornic_rx(struct uiscmdrsp *cmdrsp) > /* length rcvd is greater than firstfrag in this skb rcv buf */ > skb->tail += RCVPOST_BUF_SIZE; /* amount in skb->data */ > skb->data_len = skb->len - RCVPOST_BUF_SIZE;/* amount that > -will be in > -frag_list */ > + * will be in > + * frag_list > + */ Tell me that looks better :( Please fix this properly. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v9 1/3] staging/android: remove redundant comments on sync_merge_data
From: Gustavo Padovan struct sync_merge_data already have documentation on top of the struct definition. No need to duplicate it. Signed-off-by: Gustavo Padovan Reviewed-by: Maarten Lankhorst --- drivers/staging/android/uapi/sync.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/android/uapi/sync.h b/drivers/staging/android/uapi/sync.h index a0cf357..4467c76 100644 --- a/drivers/staging/android/uapi/sync.h +++ b/drivers/staging/android/uapi/sync.h @@ -21,9 +21,9 @@ * @fence: returns the fd of the new fence to userspace */ struct sync_merge_data { - __s32 fd2; /* fd of second fence */ - charname[32]; /* name of new fence */ - __s32 fence; /* fd on newly created fence */ + __s32 fd2; + charname[32]; + __s32 fence; }; /** -- 2.5.0 ___ 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 02:33:50PM -0700, Joe Perches wrote: > 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. Tbh I really don't think we should add 32bit variants and encourage the mispractice of having 32bit user ptrs in ioctl structs and stuff. Anyway, just my bikeshed on top ;-) -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: rtl8192e: fix line length coding style issue in rtllib_softmac.c
This is a patch to the rtllib_softmac.c file that fixes up all instances of the 'line over 80 characters' warnings found by the checkpatch.pl tool Signed-off-by: Yousof El-Sayed --- drivers/staging/rtl8192e/rtllib_softmac.c | 35 +++ 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index cfab715..9ba2230 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -389,7 +389,8 @@ static void rtllib_send_beacon(struct rtllib_device *ieee) if (ieee->beacon_txing && ieee->ieee_up) mod_timer(&ieee->beacon_timer, jiffies + - (msecs_to_jiffies(ieee->current_network.beacon_interval - 5))); + (msecs_to_jiffies + (ieee->current_network.beacon_interval - 5))); } @@ -601,7 +602,8 @@ static void rtllib_softmac_scan_wq(void *data) (ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER; if (ieee->scan_watch_dog++ > MAX_CHANNEL_NUMBER) { - if (!ieee->active_channel_map[ieee->current_network.channel]) + if (!ieee->active_channel_map[ieee-> + current_network.channel]) ieee->current_network.channel = 6; goto out; /* no good chans */ } @@ -1716,8 +1718,9 @@ inline void rtllib_softmac_new_net(struct rtllib_device *ieee, if (ieee->iw_mode == IW_MODE_INFRA) { /* Join the network for the first time */ ieee->AsocRetryCount = 0; - if ((ieee->current_network.qos_data.supported == 1) && - ieee->current_network.bssht.bdSupportHT) + if ((ieee->current_network.qos_data.supported + == 1) && + ieee->current_network.bssht.bdSupportHT) HTResetSelfAndSavePeerSetting(ieee, &(ieee->current_network)); else @@ -2044,8 +2047,8 @@ static short rtllib_sta_ps_sleep(struct rtllib_device *ieee, u64 *time) } *time = ieee->current_network.last_dtim_sta_time - + msecs_to_jiffies(ieee->current_network.beacon_interval * - LPSAwakeIntvl_tmp); + + msecs_to_jiffies(ieee-> + current_network.beacon_interval * LPSAwakeIntvl_tmp); } } @@ -2237,11 +2240,15 @@ inline int rtllib_rx_assoc_resp(struct rtllib_device *ieee, struct sk_buff *skb, ieee->assoc_id = aid; ieee->softmac_stats.rx_ass_ok++; /* station support qos */ - /* Let the register setting default with Legacy station */ - assoc_resp = (struct rtllib_assoc_response_frame *)skb->data; + /* Let the register setting default */ + /* with Legacy station */ + assoc_resp = (struct + rtllib_assoc_response_frame *)skb->data; if (ieee->current_network.qos_data.supported == 1) { - if (rtllib_parse_info_param(ieee, assoc_resp->info_element, - rx_stats->len - sizeof(*assoc_resp), + if (rtllib_parse_info_param + (ieee, assoc_resp->info_element, + rx_stats->len - sizeof + (*assoc_resp), network, rx_stats)) { kfree(network); return 1; @@ -2254,8 +2261,9 @@ inline int rtllib_rx_assoc_resp(struct rtllib_device *ieee, struct sk_buff *skb, network->bssht.bdHTInfoLen); if (ieee->handle_assoc_response != NULL) ieee->handle_assoc_response(ieee->dev, -(struct rtllib_assoc_response_frame *)header, -network); +(struct + rtllib_assoc_response_frame *) + header, network); } kfree(netw
[PATCH] staging: wilc1000: fixed kernel panic when firmware is not started
This patch fixed the problems caused by if firmware is not started. That is why, in nl80211 put current TX power in interface info. If firmware is not started, this function(get_tx_power) does not work. Signed-off-by: Leo Kim --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index b76622d..448a5c8 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -2170,6 +2170,13 @@ static int get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev, int ret; struct wilc_priv *priv = wiphy_priv(wiphy); struct wilc_vif *vif = netdev_priv(priv->dev); + struct wilc *wl; + + wl = vif->wilc; + + /* If firmware is not started, return. */ + if (!wl->initialized) + return -EIO; ret = wilc_get_tx_power(vif, (u8 *)dbm); if (ret) -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 04/42] staging: comedi: ni_660x: remove enum ni_660x_register_direction
This enum is used to define the, unused, 'direction' of each register in struct NI_660xRegisterData. Remove the unused member, as well as the enum. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_660x.c | 203 +++ 1 file changed, 98 insertions(+), 105 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index dbbeb96..409a776 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -158,12 +158,6 @@ enum ni_660x_register { #define NI660X_IO_CFG(x) (NI660X_IO_CFG_0_1 + ((x) / 2)) -enum ni_660x_register_direction { - NI_660x_READ, - NI_660x_WRITE, - NI_660x_READ_WRITE -}; - enum ni_660x_pfi_output_select { pfi_output_select_high_Z = 0, pfi_output_select_counter = 1, @@ -182,109 +176,108 @@ static inline unsigned NI_660X_GPCT_SUBDEV(unsigned index) struct NI_660xRegisterData { int offset; /* Offset from base address from GPCT chip */ - enum ni_660x_register_direction direction; char size; /* 2 or 4 bytes */ }; static const struct NI_660xRegisterData registerData[NI660X_NUM_REGS] = { - [NI660X_G0_INT_ACK] = { 0x004, NI_660x_WRITE, 2 }, - [NI660X_G0_STATUS] = { 0x004, NI_660x_READ, 2 }, - [NI660X_G1_INT_ACK] = { 0x006, NI_660x_WRITE, 2 }, - [NI660X_G1_STATUS] = { 0x006, NI_660x_READ, 2 }, - [NI660X_G01_STATUS] = { 0x008, NI_660x_READ, 2 }, - [NI660X_G0_CMD] = { 0x00c, NI_660x_WRITE, 2 }, - [NI660X_STC_DIO_PARALLEL_INPUT] = { 0x00e, NI_660x_READ, 2 }, - [NI660X_G1_CMD] = { 0x00e, NI_660x_WRITE, 2 }, - [NI660X_G0_HW_SAVE] = { 0x010, NI_660x_READ, 4 }, - [NI660X_G1_HW_SAVE] = { 0x014, NI_660x_READ, 4 }, - [NI660X_STC_DIO_OUTPUT] = { 0x014, NI_660x_WRITE, 2 }, - [NI660X_STC_DIO_CONTROL]= { 0x016, NI_660x_WRITE, 2 }, - [NI660X_G0_SW_SAVE] = { 0x018, NI_660x_READ, 4 }, - [NI660X_G1_SW_SAVE] = { 0x01c, NI_660x_READ, 4 }, - [NI660X_G0_MODE]= { 0x034, NI_660x_WRITE, 2 }, - [NI660X_G01_STATUS1]= { 0x036, NI_660x_READ, 2 }, - [NI660X_G1_MODE]= { 0x036, NI_660x_WRITE, 2 }, - [NI660X_STC_DIO_SERIAL_INPUT] = { 0x038, NI_660x_READ, 2 }, - [NI660X_G0_LOADA] = { 0x038, NI_660x_WRITE, 4 }, - [NI660X_G01_STATUS2]= { 0x03a, NI_660x_READ, 2 }, - [NI660X_G0_LOADB] = { 0x03c, NI_660x_WRITE, 4 }, - [NI660X_G1_LOADA] = { 0x040, NI_660x_WRITE, 4 }, - [NI660X_G1_LOADB] = { 0x044, NI_660x_WRITE, 4 }, - [NI660X_G0_INPUT_SEL] = { 0x048, NI_660x_WRITE, 2 }, - [NI660X_G1_INPUT_SEL] = { 0x04a, NI_660x_WRITE, 2 }, - [NI660X_G0_AUTO_INC]= { 0x088, NI_660x_WRITE, 2 }, - [NI660X_G1_AUTO_INC]= { 0x08a, NI_660x_WRITE, 2 }, - [NI660X_G01_RESET] = { 0x090, NI_660x_WRITE, 2 }, - [NI660X_G0_INT_ENA] = { 0x092, NI_660x_WRITE, 2 }, - [NI660X_G1_INT_ENA] = { 0x096, NI_660x_WRITE, 2 }, - [NI660X_G0_CNT_MODE]= { 0x0b0, NI_660x_WRITE, 2 }, - [NI660X_G1_CNT_MODE]= { 0x0b2, NI_660x_WRITE, 2 }, - [NI660X_G0_GATE2] = { 0x0b4, NI_660x_WRITE, 2 }, - [NI660X_G1_GATE2] = { 0x0b6, NI_660x_WRITE, 2 }, - [NI660X_G0_DMA_CFG] = { 0x0b8, NI_660x_WRITE, 2 }, - [NI660X_G0_DMA_STATUS] = { 0x0b8, NI_660x_READ, 2 }, - [NI660X_G1_DMA_CFG] = { 0x0ba, NI_660x_WRITE, 2 }, - [NI660X_G1_DMA_STATUS] = { 0x0ba, NI_660x_READ, 2 }, - [NI660X_G2_INT_ACK] = { 0x104, NI_660x_WRITE, 2 }, - [NI660X_G2_STATUS] = { 0x104, NI_660x_READ, 2 }, - [NI660X_G3_INT_ACK] = { 0x106, NI_660x_WRITE, 2 }, - [NI660X_G3_STATUS] = { 0x106, NI_660x_READ, 2 }, - [NI660X_G23_STATUS] = { 0x108, NI_660x_READ, 2 }, - [NI660X_G2_CMD] = { 0x10c, NI_660x_WRITE, 2 }, - [NI660X_G3_CMD] = { 0x10e, NI_660x_WRITE, 2 }, - [NI660X_G2_HW_SAVE] = { 0x110, NI_660x_READ, 4 }, - [NI660X_G3_HW_SAVE] = { 0x114, NI_660x_READ, 4 }, - [NI660X_G2_SW_SAVE] = { 0x118, NI_660x_READ, 4 }, - [NI660X_G3_SW_SAVE] = { 0x11c, NI_660x_READ, 4 }, - [NI660X_G2_MODE]= { 0x134, NI_660x_WRITE, 2 }, - [NI660X_G23_STATUS1]= { 0x136, NI_660x_READ, 2 }, - [NI660X_G3_MODE]= { 0x136, NI_660x_WRITE, 2 }, - [NI660X_G2_LOADA]
RE: [PATCH 1/1] scsi: storvsc: Support manual scan of FC hosts on Hyper-V
> -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). Regards, K. Y ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] dma-buf, drm, ion: Propagate error code from dma_buf_start_cpu_access()
On Fri, Mar 18, 2016 at 08:02:39PM +, Chris Wilson wrote: > Drivers, especially i915.ko, can fail during the initial migration of a > dma-buf for CPU access. However, the error code from the driver was not > being propagated back to ioctl and so userspace was blissfully ignorant > of the failure. Rendering corruption ensues. > > Whilst fixing the ioctl to return the error code from > dma_buf_start_cpu_access(), also do the same for > dma_buf_end_cpu_access(). For most drivers, dma_buf_end_cpu_access() > cannot fail. i915.ko however, as most drivers would, wants to avoid being > uninterruptible (as would be required to guarrantee no failure when > flushing the buffer to the device). As userspace already has to handle > errors from the SYNC_IOCTL, take advantage of this to be able to restart > the syscall across signals. > > This fixes a coherency issue for i915.ko as well as reducing the > uninterruptible hold upon its BKL, the struct_mutex. > > Fixes commit c11e391da2a8fe973c3c2398452000bed505851e > Author: Daniel Vetter > Date: Thu Feb 11 20:04:51 2016 -0200 > > dma-buf: Add ioctls to allow userspace to flush > > Testcase: igt/gem_concurrent_blit/*dmabuf*interruptible > Testcase: igt/prime_mmap_coherency/ioctl-errors > Signed-off-by: Chris Wilson > Cc: Tiago Vignatti > Cc: Stéphane Marchesin > Cc: David Herrmann > Cc: Sumit Semwal > Cc: Daniel Vetter > CC: linux-me...@vger.kernel.org > Cc: dri-de...@lists.freedesktop.org > Cc: linaro-mm-...@lists.linaro.org > Cc: intel-...@lists.freedesktop.org > Cc: de...@driverdev.osuosl.org Applied to drm-misc, I'll send a pull to Dave the next few days if no one screams. -Daniel > --- > drivers/dma-buf/dma-buf.c | 17 +++-- > drivers/gpu/drm/i915/i915_gem_dmabuf.c| 15 +-- > drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c | 5 +++-- > drivers/gpu/drm/udl/udl_fb.c | 4 ++-- > drivers/staging/android/ion/ion.c | 6 -- > include/linux/dma-buf.h | 6 +++--- > 6 files changed, 28 insertions(+), 25 deletions(-) > > diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c > index 9810d1df0691..774a60f4309a 100644 > --- a/drivers/dma-buf/dma-buf.c > +++ b/drivers/dma-buf/dma-buf.c > @@ -259,6 +259,7 @@ static long dma_buf_ioctl(struct file *file, > struct dma_buf *dmabuf; > struct dma_buf_sync sync; > enum dma_data_direction direction; > + int ret; > > dmabuf = file->private_data; > > @@ -285,11 +286,11 @@ static long dma_buf_ioctl(struct file *file, > } > > if (sync.flags & DMA_BUF_SYNC_END) > - dma_buf_end_cpu_access(dmabuf, direction); > + ret = dma_buf_end_cpu_access(dmabuf, direction); > else > - dma_buf_begin_cpu_access(dmabuf, direction); > + ret = dma_buf_begin_cpu_access(dmabuf, direction); > > - return 0; > + return ret; > default: > return -ENOTTY; > } > @@ -613,13 +614,17 @@ EXPORT_SYMBOL_GPL(dma_buf_begin_cpu_access); > * > * This call must always succeed. > */ > -void dma_buf_end_cpu_access(struct dma_buf *dmabuf, > - enum dma_data_direction direction) > +int dma_buf_end_cpu_access(struct dma_buf *dmabuf, > +enum dma_data_direction direction) > { > + int ret = 0; > + > WARN_ON(!dmabuf); > > if (dmabuf->ops->end_cpu_access) > - dmabuf->ops->end_cpu_access(dmabuf, direction); > + ret = dmabuf->ops->end_cpu_access(dmabuf, direction); > + > + return ret; > } > EXPORT_SYMBOL_GPL(dma_buf_end_cpu_access); > > diff --git a/drivers/gpu/drm/i915/i915_gem_dmabuf.c > b/drivers/gpu/drm/i915/i915_gem_dmabuf.c > index 1f3eef6fb345..0506016e18e0 100644 > --- a/drivers/gpu/drm/i915/i915_gem_dmabuf.c > +++ b/drivers/gpu/drm/i915/i915_gem_dmabuf.c > @@ -228,25 +228,20 @@ static int i915_gem_begin_cpu_access(struct dma_buf > *dma_buf, enum dma_data_dire > return ret; > } > > -static void i915_gem_end_cpu_access(struct dma_buf *dma_buf, enum > dma_data_direction direction) > +static int i915_gem_end_cpu_access(struct dma_buf *dma_buf, enum > dma_data_direction direction) > { > struct drm_i915_gem_object *obj = dma_buf_to_obj(dma_buf); > struct drm_device *dev = obj->base.dev; > - struct drm_i915_private *dev_priv = to_i915(dev); > - bool was_interruptible; > int ret; > > - mutex_lock(&dev->struct_mutex); > - was_interruptible = dev_priv->mm.interruptible; > - dev_priv->mm.interruptible = false; > + ret = i915_mutex_lock_interruptible(dev); > + if (ret) > + return ret; > > ret = i915_gem_object_set_to_gtt_domain(obj, false); > - > - dev_priv->mm.interruptible = was_interruptible; > mutex_unlock(&dev->struct_mutex); > > - if (unlikely(ret)) > - DRM_E
Re: [PATCH 2/2] isdn: i4l: move active-isdn drivers to staging
Am 07.03.2016 um 07:57 schrieb Holger Schurig: > I know that in Germany a good amount of land-line telephone line are > still using ISDN. [...] > Especially company line are using ISDN still, and there are some Linux > programs that act on then, e.g. Asterisk and derived PBX software has > ISDN support which is actively used. AFAIK none of these uses I4L anymore. Asterisk dropped I4L support with version 2 if my memory is correct and nowadays uses CAPI, mISDN or its own DAHDI interface. -- Tilman Schmidt E-Mail: til...@imap.cc Bonn, Germany Nous, on a des fleurs et des bougies pour nous protéger. signature.asc Description: OpenPGP digital signature ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: skein: threefish_block: Use ror64
Use the inline instead of direct code to improve readability and shorten the code a little. Done with perl: $ perl -p -i -e 's/\((\w+) \>\> (\d+)\) \| \(\1 \<\< \(64 \- \2\)\)/ror64(\1, \2)/g' drivers/staging/skein/threefish_block.c Signed-off-by: Joe Perches --- drivers/staging/skein/threefish_block.c | 2144 +++ 1 file changed, 1072 insertions(+), 1072 deletions(-) diff --git a/drivers/staging/skein/threefish_block.c b/drivers/staging/skein/threefish_block.c index e19ac43..a95563f 100644 --- a/drivers/staging/skein/threefish_block.c +++ b/drivers/staging/skein/threefish_block.c @@ -512,622 +512,622 @@ void threefish_decrypt_256(struct threefish_key *key_ctx, u64 *input, b2 -= k0 + t1; b3 -= k1 + 18; tmp = b3 ^ b0; - b3 = (tmp >> 32) | (tmp << (64 - 32)); + b3 = ror64(tmp, 32); b0 -= b3; tmp = b1 ^ b2; - b1 = (tmp >> 32) | (tmp << (64 - 32)); + b1 = ror64(tmp, 32); b2 -= b1; tmp = b1 ^ b0; - b1 = (tmp >> 58) | (tmp << (64 - 58)); + b1 = ror64(tmp, 58); b0 -= b1; tmp = b3 ^ b2; - b3 = (tmp >> 22) | (tmp << (64 - 22)); + b3 = ror64(tmp, 22); b2 -= b3; tmp = b3 ^ b0; - b3 = (tmp >> 46) | (tmp << (64 - 46)); + b3 = ror64(tmp, 46); b0 -= b3; tmp = b1 ^ b2; - b1 = (tmp >> 12) | (tmp << (64 - 12)); + b1 = ror64(tmp, 12); b2 -= b1; tmp = b1 ^ b0; - b1 = (tmp >> 25) | (tmp << (64 - 25)); + b1 = ror64(tmp, 25); b0 -= b1 + k2; b1 -= k3 + t2; tmp = b3 ^ b2; - b3 = (tmp >> 33) | (tmp << (64 - 33)); + b3 = ror64(tmp, 33); b2 -= b3 + k4 + t0; b3 -= k0 + 17; tmp = b3 ^ b0; - b3 = (tmp >> 5) | (tmp << (64 - 5)); + b3 = ror64(tmp, 5); b0 -= b3; tmp = b1 ^ b2; - b1 = (tmp >> 37) | (tmp << (64 - 37)); + b1 = ror64(tmp, 37); b2 -= b1; tmp = b1 ^ b0; - b1 = (tmp >> 23) | (tmp << (64 - 23)); + b1 = ror64(tmp, 23); b0 -= b1; tmp = b3 ^ b2; - b3 = (tmp >> 40) | (tmp << (64 - 40)); + b3 = ror64(tmp, 40); b2 -= b3; tmp = b3 ^ b0; - b3 = (tmp >> 52) | (tmp << (64 - 52)); + b3 = ror64(tmp, 52); b0 -= b3; tmp = b1 ^ b2; - b1 = (tmp >> 57) | (tmp << (64 - 57)); + b1 = ror64(tmp, 57); b2 -= b1; tmp = b1 ^ b0; - b1 = (tmp >> 14) | (tmp << (64 - 14)); + b1 = ror64(tmp, 14); b0 -= b1 + k1; b1 -= k2 + t1; tmp = b3 ^ b2; - b3 = (tmp >> 16) | (tmp << (64 - 16)); + b3 = ror64(tmp, 16); b2 -= b3 + k3 + t2; b3 -= k4 + 16; tmp = b3 ^ b0; - b3 = (tmp >> 32) | (tmp << (64 - 32)); + b3 = ror64(tmp, 32); b0 -= b3; tmp = b1 ^ b2; - b1 = (tmp >> 32) | (tmp << (64 - 32)); + b1 = ror64(tmp, 32); b2 -= b1; tmp = b1 ^ b0; - b1 = (tmp >> 58) | (tmp << (64 - 58)); + b1 = ror64(tmp, 58); b0 -= b1; tmp = b3 ^ b2; - b3 = (tmp >> 22) | (tmp << (64 - 22)); + b3 = ror64(tmp, 22); b2 -= b3; tmp = b3 ^ b0; - b3 = (tmp >> 46) | (tmp << (64 - 46)); + b3 = ror64(tmp, 46); b0 -= b3; tmp = b1 ^ b2; - b1 = (tmp >> 12) | (tmp << (64 - 12)); + b1 = ror64(tmp, 12); b2 -= b1; tmp = b1 ^ b0; - b1 = (tmp >> 25) | (tmp << (64 - 25)); + b1 = ror64(tmp, 25); b0 -= b1 + k0; b1 -= k1 + t0; tmp = b3 ^ b2; - b3 = (tmp >> 33) | (tmp << (64 - 33)); + b3 = ror64(tmp, 33); b2 -= b3 + k2 + t1; b3 -= k3 + 15; tmp = b3 ^ b0; - b3 = (tmp >> 5) | (tmp << (64 - 5)); + b3 = ror64(tmp, 5); b0 -= b3; tmp = b1 ^ b2; - b1 = (tmp >> 37) | (tmp << (64 - 37)); + b1 = ror64(tmp, 37); b2 -= b1; tmp = b1 ^ b0; - b1 = (tmp >> 23) | (tmp << (64 - 23)); + b1 = ror64(tmp, 23); b0 -= b1; tmp = b3 ^ b2; - b3 = (tmp >> 40) | (tmp << (64 - 40)); + b3 = ror64(tmp, 40); b2 -= b3; tmp = b3 ^ b0; - b3 = (tmp >> 52) | (tmp << (64 - 52)); + b3 = ror64(tmp, 52); b0 -= b3; tmp = b1 ^ b2; - b1 = (tmp >> 57) | (tmp << (64 - 57)); + b1 = ror64(tmp, 57); b2 -= b1; tmp = b1 ^ b0; - b1 = (tmp >> 14) | (tmp << (64 - 14)); + b1 = ror64(tmp, 14); b0 -= b1 + k4; b1 -= k0 + t2; tmp = b3 ^ b2; - b3 = (tmp >> 16) | (tmp << (64 - 16)); + b3 = ror64(tmp, 16); b2 -= b3 + k1 + t0; b3 -= k2 + 14; tmp = b3 ^ b0; - b3 = (tmp >> 32) | (tmp << (64 - 32)); + b3 = ror64(tmp, 32); b0 -= b3; tmp = b1 ^ b2; - b1 = (tmp >> 32) | (tmp << (64 - 32
[PATCH] staging: unisys: visornic: Fixed Checkpatch Warnings
Fixed the coding style checkpatch warnings. Signed-off-by: Gavin O'Leary --- drivers/staging/unisys/visornic/visornic_main.c | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 0519470..0366624 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -1218,8 +1218,9 @@ visornic_rx(struct uiscmdrsp *cmdrsp) /* length rcvd is greater than firstfrag in this skb rcv buf */ skb->tail += RCVPOST_BUF_SIZE; /* amount in skb->data */ skb->data_len = skb->len - RCVPOST_BUF_SIZE;/* amount that - will be in - frag_list */ +* will be in +* frag_list +*/ } else { /* data fits in this skb - no chaining - do * PRECAUTIONARY check @@ -1315,12 +1316,14 @@ visornic_rx(struct uiscmdrsp *cmdrsp) } if (found_mc) break; /* accept packet, dest - matches a multicast - address */ +* matches a multicast +* address +*/ } } else if (skb->pkt_type == PACKET_HOST) { break; /* accept packet, h_dest must match vnic - mac address */ +* mac address +*/ } else if (skb->pkt_type == PACKET_OTHERHOST) { /* something is not right */ dev_err(&devdata->netdev->dev, @@ -1619,7 +1622,8 @@ service_resp_queue(struct uiscmdrsp *cmdrsp, struct visornic_devdata *devdata, struct net_device *netdev; /* TODO: CLIENT ACQUIRE -- Don't really need this at the -* moment */ +* moment +*/ for (;;) { if (!visorchannel_signalremove(devdata->dev->visorchannel, IOCHAN_FROM_IOPART, -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: r8723au: This patch tries to fix some byte order issues that is found by sparse check.
Julian Calaby writes: > Hi Jandy, > > On Thu, Mar 17, 2016 at 7:03 PM, Jandy Gou > wrote: >> make C=1 M=drivers/staging/rtl8723au/ >> >> drivers/staging/rtl8723au/hal/rtl8723a_cmd.c:96:38: warning: cast to >> restricted __le16 >> drivers/staging/rtl8723au/hal/rtl8723a_cmd.c:100:27: warning: cast to >> restricted __le32 >> >> Signed-off-by: Jandy Gou > > I'm not sure your change is correct. Perhaps you should add temporary > variables for h2c_cmd_ex and h2c_cmd while they're cpu-endian? > > Jes, > > I'm pretty sure this isn't the first time this has come up. Do you > have any ideas for a solution? Or should we ignore this as this driver > will eventually be going away? Temp variables as you suggest would be a clean way to accomplish this. Technically this might work, but esthetically this is so gross I wish I had never seen it. There is a reason why we have the byteorder specific types, and le{16,32}_to_cpus() violates that. I am surprised we still have these macros around, tbh I didn't even know they existed. A quick search for le16_to_cpus() shows that it's really very old drivers and some more recent Intel Ethernet drivers that use them - maybe this would be a good time to get rid of them completely. Cheers, Jes ___ 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 15:43 -0300, Gustavo Padovan wrote: > 2016-03-17 Gustavo Padovan : > > 2016-03-17 Joe Perches : > > > On Thu, 2016-03-17 at 14:30 -0300, Gustavo Padovan wrote: > > > > > > > > This function had copies in 3 different files. Unify them in > > > > kernel.h. > > > This is only used by gpu/drm. > > > > > > I think this is a poor name for a generic function > > > that would be in kernel.h. > > > > > > Isn't there an include file in linux/drm that's > > > appropriate for this. Maybe drmP.h > > > > > > Maybe prefix this function name with drm_ too. > > No, the next patch adds a user to drivers/staging (which will be moved > > to drivers/dma-buf) soon. Maybe move to a different header in > > include/linux/? not sure which one. > > > > > > > > Also, there's this that might conflict: > > > > > > arch/powerpc/kernel/signal_32.c:#define to_user_ptr(p) > > > ptr_to_compat(p) > > > arch/powerpc/kernel/signal_32.c:#define to_user_ptr(p) > > > ((unsigned long)(p)) > > Right, I'll figure out how to replace these two too. > The powerpc to_user_ptr has a different meaning from the one I'm adding > in this patch. I propose we just rename powerpc's to_user_ptr to > __to_user_ptr and leave the rest as is. I think that's not a good idea, and you should really check this concept with the powerpc folk (added to to:s and cc:ed) If it were really added, then the function meaning is incorrect. This is taking a u64, casting that to (unsigned long/uint_ptr_t), then converting that to a user pointer. Does that naming and use make sense on x86-32 or arm32? ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rtl8192e: fixed coding style issues
Signed-off-by: Yousof El-Sayed --- drivers/staging/rtl8192e/dot11d.c | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/staging/rtl8192e/dot11d.c b/drivers/staging/rtl8192e/dot11d.c index 4d8fb41..a08bfef 100644 --- a/drivers/staging/rtl8192e/dot11d.c +++ b/drivers/staging/rtl8192e/dot11d.c @@ -50,10 +50,9 @@ void dot11d_init(struct rtllib_device *ieee) pDot11dInfo->State = DOT11D_STATE_NONE; pDot11dInfo->CountryIeLen = 0; - memset(pDot11dInfo->channel_map, 0, MAX_CHANNEL_NUMBER+1); - memset(pDot11dInfo->MaxTxPwrDbmList, 0xFF, MAX_CHANNEL_NUMBER+1); + memset(pDot11dInfo->channel_map, 0, MAX_CHANNEL_NUMBER + 1); + memset(pDot11dInfo->MaxTxPwrDbmList, 0xFF, MAX_CHANNEL_NUMBER + 1); RESET_CIE_WATCHDOG(ieee); - } EXPORT_SYMBOL(dot11d_init); @@ -99,14 +98,13 @@ void Dot11d_Channelmap(u8 channel_plan, struct rtllib_device *ieee) } EXPORT_SYMBOL(Dot11d_Channelmap); - void Dot11d_Reset(struct rtllib_device *ieee) { struct rt_dot11d_info *pDot11dInfo = GET_DOT11D_INFO(ieee); u32 i; - memset(pDot11dInfo->channel_map, 0, MAX_CHANNEL_NUMBER+1); - memset(pDot11dInfo->MaxTxPwrDbmList, 0xFF, MAX_CHANNEL_NUMBER+1); + memset(pDot11dInfo->channel_map, 0, MAX_CHANNEL_NUMBER + 1); + memset(pDot11dInfo->MaxTxPwrDbmList, 0xFF, MAX_CHANNEL_NUMBER + 1); for (i = 1; i <= 11; i++) (pDot11dInfo->channel_map)[i] = 1; for (i = 12; i <= 14; i++) @@ -123,8 +121,8 @@ void Dot11d_UpdateCountryIe(struct rtllib_device *dev, u8 *pTaddr, u8 i, j, NumTriples, MaxChnlNum; struct chnl_txpow_triple *pTriple; - memset(pDot11dInfo->channel_map, 0, MAX_CHANNEL_NUMBER+1); - memset(pDot11dInfo->MaxTxPwrDbmList, 0xFF, MAX_CHANNEL_NUMBER+1); + memset(pDot11dInfo->channel_map, 0, MAX_CHANNEL_NUMBER + 1); + memset(pDot11dInfo->MaxTxPwrDbmList, 0xFF, MAX_CHANNEL_NUMBER + 1); MaxChnlNum = 0; NumTriples = (CoutryIeLen - 3) / 3; pTriple = (struct chnl_txpow_triple *)(pCoutryIe + 3); -- 1.8.3.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: unisys: visornic: Made comments look nicer
Made comments not break coding style guidlines and easier to read. Signed-off-by: Gavin O'Leary --- drivers/staging/unisys/visornic/visornic_main.c | 29 +++-- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 0519470..50ad44e 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -1215,11 +1215,13 @@ visornic_rx(struct uiscmdrsp *cmdrsp) "repost_return failed"); return rx_count; } - /* length rcvd is greater than firstfrag in this skb rcv buf */ - skb->tail += RCVPOST_BUF_SIZE; /* amount in skb->data */ - skb->data_len = skb->len - RCVPOST_BUF_SIZE;/* amount that - will be in - frag_list */ + /* length rcvd is greater than firstfrag in this skb rcv buf*/ + + /*amount in skb->data */ + skb->tail += RCVPOST_BUF_SIZE; + + /* amount that will be in frag_list */ + skb->data_len = skb->len - RCVPOST_BUF_SIZE; } else { /* data fits in this skb - no chaining - do * PRECAUTIONARY check @@ -1313,14 +1315,18 @@ visornic_rx(struct uiscmdrsp *cmdrsp) break; } } + + /* accept packet, dest matches a multicast +* address +*/ if (found_mc) - break; /* accept packet, dest - matches a multicast - address */ + break; } + + /* accept packet, dest matches a multicast address */ } else if (skb->pkt_type == PACKET_HOST) { - break; /* accept packet, h_dest must match vnic - mac address */ + break; + } else if (skb->pkt_type == PACKET_OTHERHOST) { /* something is not right */ dev_err(&devdata->netdev->dev, @@ -1618,8 +1624,7 @@ service_resp_queue(struct uiscmdrsp *cmdrsp, struct visornic_devdata *devdata, unsigned long flags; struct net_device *netdev; - /* TODO: CLIENT ACQUIRE -- Don't really need this at the -* moment */ + /* TODO: CLIENT ACQUIRE -- Don't really need this at the moment */ for (;;) { if (!visorchannel_signalremove(devdata->dev->visorchannel, IOCHAN_FROM_IOPART, -- 1.9.1 ___ 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()
2016-03-17 Gustavo Padovan : > 2016-03-17 Joe Perches : > > > On Thu, 2016-03-17 at 14:30 -0300, Gustavo Padovan wrote: > > > This function had copies in 3 different files. Unify them in > > > kernel.h. > > > > This is only used by gpu/drm. > > > > I think this is a poor name for a generic function > > that would be in kernel.h. > > > > Isn't there an include file in linux/drm that's > > appropriate for this. Maybe drmP.h > > > > Maybe prefix this function name with drm_ too. > > No, the next patch adds a user to drivers/staging (which will be moved > to drivers/dma-buf) soon. Maybe move to a different header in > include/linux/? not sure which one. > > > Also, there's this that might conflict: > > > > arch/powerpc/kernel/signal_32.c:#define to_user_ptr(p) > > ptr_to_compat(p) > > arch/powerpc/kernel/signal_32.c:#define to_user_ptr(p) ((unsigned > > long)(p)) > > Right, I'll figure out how to replace these two too. The powerpc to_user_ptr has a different meaning from the one I'm adding in this patch. I propose we just rename powerpc's to_user_ptr to __to_user_ptr and leave the rest as is. Gustavo ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: comedi: dt282x: tidy up register bit defines
On 17/03/16 17:10, H Hartley Sweeten wrote: Arnd Bergmann pointed out that gcc-6 warns about passing negative signed integer into swab16() due to the macro expansion of 'outw'. It appears that the register map constants are causing the warnings. Actually, it might just be the (1 << 15) ones... Convert all the constants as suggested by checkpatch.pl: CHECK: Prefer using the BIT macro The BIT() macro will make all the constants explicitly 'unsigned', which helps to avoid the warning. Fix the, unsused, DT2821_CHANCSR_PRESLA() macro. The "Present List Address" (PRESLA) bits in the CHANCSR register are read only. This define was meant to extract the bits from the read value. Signed-off-by: H Hartley Sweeten Reported-by: Arnd Bergmann Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dt282x.c | 65 + 1 file changed, 33 insertions(+), 32 deletions(-) Reviewed-by: Ian Abbott -- -=( Ian Abbott @ MEV Ltd.E-mail: )=- -=( Web: http://www.mev.co.uk/ )=- ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] [media] media: rename media unregister function
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. thanks, -- Shuah -- Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) shua...@osg.samsung.com | (970) 217-8978 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v10 2/3] kernel.h: add u64_to_user_ptr()
On Fri, 2016-03-18 at 10:27 -0300, Gustavo Padovan wrote: > From: Gustavo Padovan > > This function had copies in 3 different files. Unify them in > kernel.h. This function might be used more in drm files in a separate patch too: $ git grep -n -E "__user.*\(\s*uintptr_t\s*\)" drivers/gpu/drm drivers/gpu/drm/armada/armada_gem.c:385:ptr = (char __user *)(uintptr_t)args->ptr; drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c:33:return (void __user *)(uintptr_t)address; drivers/gpu/drm/i915/i915_drv.h:3581: return (void __user *)(uintptr_t)address; drivers/gpu/drm/msm/msm_gem_submit.c:33:return (void __user *)(uintptr_t)address; drivers/gpu/drm/nouveau/nouveau_gem.c:471: (void __force __user *)(uintptr_t)user_pbbo_ptr; drivers/gpu/drm/nouveau/nouveau_gem.c:568: void __user *userptr = (void __force __user *)(uintptr_t)user; drivers/gpu/drm/tegra/drm.c:333:(void __user *)(uintptr_t)args->cmdbufs; drivers/gpu/drm/tegra/drm.c:335:(void __user *)(uintptr_t)args->relocs; drivers/gpu/drm/tegra/drm.c:337:(void __user *)(uintptr_t)args->waitchks; drivers/gpu/drm/tegra/drm.c:392:if (copy_from_user(&syncpt, (void __user *)(uintptr_t)args->syncpts, drivers/gpu/drm/vc4/vc4_bo.c:502:(void __user *)(uintptr_t)args->data, drivers/gpu/drm/vc4/vc4_gem.c:123: if (copy_to_user((void __user *)(uintptr_t)get_state->bo, drivers/gpu/drm/vc4/vc4_gem.c:553: (void __user *)(uintptr_t)args->bo_handles, drivers/gpu/drm/vc4/vc4_gem.c:627: (void __user *)(uintptr_t)args->bin_cl, drivers/gpu/drm/vc4/vc4_gem.c:634: (void __user *)(uintptr_t)args->shader_rec, drivers/gpu/drm/vc4/vc4_gem.c:641: (void __user *)(uintptr_t)args->uniforms, drivers/gpu/drm/virtio/virtgpu_ioctl.c:126: user_bo_handles = (void __user *)(uintptr_t)exbuf->bo_handles; drivers/gpu/drm/virtio/virtgpu_ioctl.c:161: if (copy_from_user(buf, (void __user *)(uintptr_t)exbuf->command, ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: refresh TODO for rtl8723au
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. > > Cc: Jes Sorensen > Cc: Larry Finger > Cc: Kalle Valo > Cc: Greg Kroah-Hartman > Cc: Linux Driver Project Developer List > > Cc: Linux Wireless > Signed-off-by: Xose Vazquez Perez > --- > drivers/staging/rtl8723au/TODO | 3 +++ > 1 file changed, 3 insertions(+) Acked-by: Jes Sorensen ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH v2] staging/comedi/dt282x: avoid integer overflow warning
On Wednesday, March 16, 2016 1:51 PM, Arnd Bergmann wrote: > > gcc-6 warns about passing negative signed integer into swab16() > in the dt282x driver: > > drivers/staging/comedi/drivers/dt282x.c: In function 'dt282x_load_changain': > include/uapi/linux/swab.h:14:33: warning: integer overflow in expression > [-Woverflow] > (((__u16)(x) & (__u16)0xff00U) >> 8))) > ~~~^ > include/uapi/linux/swab.h:107:2: note: in expansion of macro > '___constant_swab16' > ___constant_swab16(x) : \ > ^~ > include/uapi/linux/byteorder/big_endian.h:34:43: note: in expansion of macro > '__swab16' > #define __cpu_to_le16(x) ((__force __le16)__swab16((x))) >^~~~ > include/linux/byteorder/generic.h:89:21: note: in expansion of macro > '__cpu_to_le16' > #define cpu_to_le16 __cpu_to_le16 > ^ > arch/arm/include/asm/io.h:250:6: note: in expansion of macro 'cpu_to_le16' > cpu_to_le16(v),__io(p)); }) > ^~~ > drivers/staging/comedi/drivers/dt282x.c:566:2: note: in expansion of macro > 'outw' > outw(DT2821_CHANCSR_LLE | DT2821_CHANCSR_NUMB(n), > ^~~~ Arnd, Is this a gcc-6 specific issue? Seems line this warning should be showing up in a lot of drivers. > The warning makes sense, though the code is correct as far as I > can tell. > > This disambiguates the operation by making the constant expressions > we pass here explicitly 'unsigned', which helps to avoid the warning. > > As pointed out by Hartley Sweeten, scripts/checkpatch.pl notices that > the shifts here are rather unreadable, though the suggested BIT() > macro wouldn't work either. I'm changing it to a hexadecimal notation, > which hopefully improves readability. I'm leaving the DT2821_CHANCSR_PRESLA > alone because it seems wrong. BIT() should work for the ones pointed out by checpatch.pl. I would argue that the hexadecimal notation is still rather unreadable. These ones make my head hurt... -#define DT2821_ADCSR_GS(x) (((x) & 0x3) << 4) +#define DT2821_ADCSR_GS(x)(0x0030u & ((x) << 4)) -#define DT2821_DACSR_YSEL(x) ((x) << 9) +#define DT2821_DACSR_YSEL(x) (0x7e00u & (x) << 9) -#define DT2821_SUPCSR_DS_PIO (0 << 10) -#define DT2821_SUPCSR_DS_AD_CLK(1 << 10) -#define DT2821_SUPCSR_DS_DA_CLK(2 << 10) -#define DT2821_SUPCSR_DS_AD_TRIG (3 << 10) +#define DT2821_SUPCSR_DS_PIO (0x0c00u & (0u << 10)) +#define DT2821_SUPCSR_DS_AD_CLK (0x0c00u & (1u << 10)) +#define DT2821_SUPCSR_DS_DA_CLK (0x0c00u & (2u << 10)) +#define DT2821_SUPCSR_DS_AD_TRIG (0x0c00u & (3u << 10)) Also, most of the comedi drivers use the BIT() macro. Are you planning on changing all of them to use hexadecimal notation? Regards, Hartley ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/9] rtlwifi: rtl8188ee: Fix Smatch warnings
Smatch reports the following: CHECK drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c:1140 rtl88e_dm_check_txpower_tracking() warn: inconsistent indenting CHECK drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c:1906 _rtl88e_phy_lc_calibrate() warn: inconsistent indenting Signed-off-by: Larry Finger --- drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c | 2 +- drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c index ce4da9d..db9a782 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/dm.c @@ -1137,7 +1137,7 @@ void rtl88e_dm_check_txpower_tracking(struct ieee80211_hw *hw) } else { RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, "Schedule TxPowerTracking !!\n"); - dm_txpower_track_cb_therm(hw); + dm_txpower_track_cb_therm(hw); rtlpriv->dm.tm_trigger = 0; } } diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c index a2bb02c..416a9ba 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/phy.c @@ -1903,8 +1903,7 @@ static void _rtl88e_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t) } else { rtl_write_byte(rtlpriv, REG_TXPAUSE, 0x00); } -RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "\n"); - + RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, "\n"); } static void _rtl88e_phy_set_rfpath_switch(struct ieee80211_hw *hw, -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 30/42] staging: comedi: ni_660x: 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_660x.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index 35602cc..2440cb6 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -1067,8 +1067,7 @@ static void ni_660x_detach(struct comedi_device *dev) if (dev->irq) free_irq(dev->irq, dev); if (devpriv) { - if (devpriv->counter_dev) - ni_gpct_device_destroy(devpriv->counter_dev); + ni_gpct_device_destroy(devpriv->counter_dev); ni_660x_free_mite_rings(dev); mite_detach(devpriv->mite); } -- 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, 2016-03-17 at 16:33 -0400, Rob Clark wrote: > On Thu, Mar 17, 2016 at 4:22 PM, Joe Perches wrote: > > On Thu, 2016-03-17 at 15:43 -0300, Gustavo Padovan wrote: > > > 2016-03-17 Gustavo Padovan : > > > > 2016-03-17 Joe Perches : > > > > > On Thu, 2016-03-17 at 14:30 -0300, Gustavo Padovan wrote: > > > > > > This function had copies in 3 different files. Unify them in > > > > > > kernel.h. > > > > > This is only used by gpu/drm. > > > > > > > > > > I think this is a poor name for a generic function > > > > > that would be in kernel.h. > > > > > > > > > > Isn't there an include file in linux/drm that's > > > > > appropriate for this. Maybe drmP.h > > > > > > > > > > Maybe prefix this function name with drm_ too. > > > > No, the next patch adds a user to drivers/staging (which will be moved > > > > to drivers/dma-buf) soon. Maybe move to a different header in > > > > include/linux/? not sure which one. > > > > > > > > > > > > > > > > > > > Also, there's this that might conflict: > > > > > > > > > > arch/powerpc/kernel/signal_32.c:#define to_user_ptr(p) > > > > > ptr_to_compat(p) > > > > > arch/powerpc/kernel/signal_32.c:#define to_user_ptr(p) > > > > > ((unsigned long)(p)) > > > > Right, I'll figure out how to replace these two too. > > > The powerpc to_user_ptr has a different meaning from the one I'm adding > > > in this patch. I propose we just rename powerpc's to_user_ptr to > > > __to_user_ptr and leave the rest as is. > > I think that's not a good idea, and you should really check > > this concept with the powerpc folk (added to to:s and cc:ed) > > > > If it were really added, then the function meaning is incorrect. > > > > This is taking a u64, casting that to (unsigned long/uint_ptr_t), > > then converting that to a user pointer. > > > > Does that naming and use make sense on x86-32 or arm32? > > > fwiw Gustavo's version of to_user_ptr() is in use on arm32 and arm64.. > Not entirely sure what doesn't make sense about it 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; } As a static function in a single file, it's not great, but OK, fine, it's static. As a global function in kernel.h, it's misleading. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 06/42] staging: comedi: ni_660x: cleanup the NI660X_IO_CFG register helpers
Convert the inline functions used to set the bits in the NI600X_IO_CFG registers into macros. Also convert the enum ni_660x_pfi_output_select into defines. This clarifies the association with the register. This also fixes a number of checkpatch.pl issues about: WARNING: Prefer 'unsigned int' to bare use of 'unsigned' Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_660x.c | 81 +++- 1 file changed, 28 insertions(+), 53 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index d76a5b0..75c6032 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -156,14 +156,15 @@ enum ni_660x_register { NI660X_NUM_REGS, }; -#define NI660X_IO_CFG(x) (NI660X_IO_CFG_0_1 + ((x) / 2)) - -enum ni_660x_pfi_output_select { - pfi_output_select_high_Z = 0, - pfi_output_select_counter = 1, - pfi_output_select_do = 2, - num_pfi_output_selects -}; +#define NI660X_IO_CFG(x) (NI660X_IO_CFG_0_1 + ((x) / 2)) +#define NI660X_IO_CFG_OUT_SEL(_c, _s) (((_s) & 0x3) << (((_c) % 2) ? 0 : 8)) +#define NI660X_IO_CFG_OUT_SEL_MASK(_c) NI660X_IO_CFG_OUT_SEL((_c), 0x3) +#define NI660X_IO_CFG_OUT_SEL_HIGH_Z 0 +#define NI660X_IO_CFG_OUT_SEL_COUNTER 1 +#define NI660X_IO_CFG_OUT_SEL_DO 2 +#define NI660X_IO_CFG_OUT_SEL_MAX 3 +#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, @@ -285,34 +286,6 @@ enum clock_config_register_bits { CounterSwap = 0x1 << 21 }; -/* ioconfigreg */ -static inline unsigned ioconfig_bitshift(unsigned pfi_channel) -{ - return (pfi_channel % 2) ? 0 : 8; -} - -static inline unsigned pfi_output_select_mask(unsigned pfi_channel) -{ - return 0x3 << ioconfig_bitshift(pfi_channel); -} - -static inline unsigned pfi_output_select_bits(unsigned pfi_channel, - unsigned output_select) -{ - return (output_select & 0x3) << ioconfig_bitshift(pfi_channel); -} - -static inline unsigned pfi_input_select_mask(unsigned pfi_channel) -{ - return 0x7 << (4 + ioconfig_bitshift(pfi_channel)); -} - -static inline unsigned pfi_input_select_bits(unsigned pfi_channel, -unsigned input_select) -{ - return (input_select & 0x7) << (4 + ioconfig_bitshift(pfi_channel)); -} - /* dma configuration register bits */ static inline unsigned dma_select_mask(unsigned dma_channel) { @@ -808,7 +781,7 @@ static int ni_660x_allocate_private(struct comedi_device *dev) spin_lock_init(&devpriv->interrupt_lock); spin_lock_init(&devpriv->soft_reg_copy_lock); for (i = 0; i < NUM_PFI_CHANNELS; ++i) - devpriv->pfi_output_selects[i] = pfi_output_select_counter; + devpriv->pfi_output_selects[i] = NI660X_IO_CFG_OUT_SEL_COUNTER; return 0; } @@ -896,7 +869,7 @@ static void ni_660x_select_pfi_output(struct comedi_device *dev, unsigned idle_bits; if (board->n_chips > 1) { - if (output_select == pfi_output_select_counter && + 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; @@ -911,10 +884,10 @@ static void ni_660x_select_pfi_output(struct comedi_device *dev, idle_bits = ni_660x_read_register(dev, idle_chipset, NI660X_IO_CFG(pfi_channel)); - idle_bits &= ~pfi_output_select_mask(pfi_channel); + idle_bits &= ~NI660X_IO_CFG_OUT_SEL_MASK(pfi_channel); idle_bits |= - pfi_output_select_bits(pfi_channel, - pfi_output_select_high_Z); + NI660X_IO_CFG_OUT_SEL(pfi_channel, + NI660X_IO_CFG_OUT_SEL_HIGH_Z); ni_660x_write_register(dev, idle_chipset, idle_bits, NI660X_IO_CFG(pfi_channel)); } @@ -922,8 +895,8 @@ static void ni_660x_select_pfi_output(struct comedi_device *dev, active_bits = ni_660x_read_register(dev, active_chipset, NI660X_IO_CFG(pfi_channel)); - active_bits &= ~pfi_output_select_mask(pfi_channel); - active_bits |= pfi_output_select_bits(pfi_channel, output_select); + active_bits &= ~NI660X_IO_CFG_OUT_SEL_MASK(pfi_channel); + active_bits |= NI660X_IO_CFG_OUT_SEL(pfi_channel, output_select); ni_660x_write_register(dev, active_chipset, active_bits, NI66
[PATCH] staging: r8723au: This patch tries to fix some byte order issues that is found by sparse check.
make C=1 M=drivers/staging/rtl8723au/ drivers/staging/rtl8723au/hal/rtl8723a_cmd.c:96:38: warning: cast to restricted __le16 drivers/staging/rtl8723au/hal/rtl8723a_cmd.c:100:27: warning: cast to restricted __le32 Signed-off-by: Jandy Gou --- drivers/staging/rtl8723au/hal/rtl8723a_cmd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c b/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c index 1662c03c..d82fd8a 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c @@ -93,11 +93,11 @@ int FillH2CCmd(struct rtw_adapter *padapter, u8 ElementID, u32 CmdLen, if (h2c_cmd & BIT(7)) { msgbox_ex_addr = REG_HMEBOX_EXT_0 + (h2c_box_num * EX_MESSAGE_BOX_SIZE); - h2c_cmd_ex = le16_to_cpu(h2c_cmd_ex); + le16_to_cpus(&h2c_cmd_ex); rtl8723au_write16(padapter, msgbox_ex_addr, h2c_cmd_ex); } msgbox_addr = REG_HMEBOX_0 + (h2c_box_num * MESSAGE_BOX_SIZE); - h2c_cmd = le32_to_cpu(h2c_cmd); + le32_to_cpus(&h2c_cmd); rtl8723au_write32(padapter, msgbox_addr, h2c_cmd); bcmd_down = true; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 7/9] rtlwifi: rtl8723ae: Fix Smatch warning
On Thu, Mar 17, 2016 at 01:41:02PM -0500, Larry Finger wrote: > 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; Now that we have removed the tab, this can fit on one line. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] [media] media: rename media unregister function
Now that media_device_unregister() also does a cleanup, rename it to media_device_unregister_cleanup(). Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/siano/smsdvb-main.c | 2 +- drivers/media/media-device.c | 4 ++-- drivers/media/pci/saa7134/saa7134-core.c | 2 +- drivers/media/platform/exynos4-is/media-dev.c| 4 ++-- drivers/media/platform/omap3isp/isp.c| 2 +- drivers/media/platform/s3c-camif/camif-core.c| 4 ++-- drivers/media/platform/vsp1/vsp1_drv.c | 2 +- drivers/media/platform/xilinx/xilinx-vipp.c | 4 ++-- drivers/media/usb/au0828/au0828-core.c | 2 +- drivers/media/usb/cx231xx/cx231xx-cards.c| 2 +- drivers/media/usb/dvb-usb-v2/dvb_usb_core.c | 2 +- drivers/media/usb/dvb-usb/dvb-usb-dvb.c | 2 +- drivers/media/usb/em28xx/em28xx-cards.c | 2 +- drivers/media/usb/siano/smsusb.c | 4 ++-- drivers/media/usb/uvc/uvc_driver.c | 2 +- drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c | 4 ++-- drivers/staging/media/omap4iss/iss.c | 2 +- include/media/media-device.h | 6 +++--- include/media/media-entity.h | 2 +- sound/usb/media.c| 2 +- 20 files changed, 28 insertions(+), 28 deletions(-) diff --git a/drivers/media/common/siano/smsdvb-main.c b/drivers/media/common/siano/smsdvb-main.c index 711c389c05e3..26184f84f41b 100644 --- a/drivers/media/common/siano/smsdvb-main.c +++ b/drivers/media/common/siano/smsdvb-main.c @@ -616,7 +616,7 @@ static void smsdvb_media_device_unregister(struct smsdvb_client_t *client) if (!coredev->media_dev) return; - media_device_unregister(coredev->media_dev); + media_device_unregister_cleanup(coredev->media_dev); kfree(coredev->media_dev); coredev->media_dev = NULL; #endif diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c index 070421e4d32e..9076439abc5f 100644 --- a/drivers/media/media-device.c +++ b/drivers/media/media-device.c @@ -822,7 +822,7 @@ printk("%s: mdev=%p\n", __func__, mdev); dev_dbg(mdev->dev, "Media device unregistered\n"); } -void media_device_unregister(struct media_device *mdev) +void media_device_unregister_cleanup(struct media_device *mdev) { printk("%s: mdev=%p\n", __func__, mdev); if (mdev == NULL) @@ -833,7 +833,7 @@ printk("%s: mdev=%p\n", __func__, mdev); mutex_unlock(&mdev->graph_mutex); } -EXPORT_SYMBOL_GPL(media_device_unregister); +EXPORT_SYMBOL_GPL(media_device_unregister_cleanup); static void media_device_release_devres(struct device *dev, void *res) { diff --git a/drivers/media/pci/saa7134/saa7134-core.c b/drivers/media/pci/saa7134/saa7134-core.c index 213dc71f09eb..5f08cb22fb1a 100644 --- a/drivers/media/pci/saa7134/saa7134-core.c +++ b/drivers/media/pci/saa7134/saa7134-core.c @@ -812,7 +812,7 @@ static void saa7134_unregister_media_device(struct saa7134_dev *dev) #ifdef CONFIG_MEDIA_CONTROLLER if (!dev->media_dev) return; - media_device_unregister(dev->media_dev); + media_device_unregister_cleanup(dev->media_dev); kfree(dev->media_dev); dev->media_dev = NULL; #endif diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c index 8c106fda7b84..e968523e0b5c 100644 --- a/drivers/media/platform/exynos4-is/media-dev.c +++ b/drivers/media/platform/exynos4-is/media-dev.c @@ -1501,7 +1501,7 @@ err_clk: err_m_ent: fimc_md_unregister_entities(fmd); err_md: - media_device_unregister(&fmd->media_dev); + media_device_unregister_cleanup(&fmd->media_dev); v4l2_device_unregister(&fmd->v4l2_dev); return ret; } @@ -1520,7 +1520,7 @@ static int fimc_md_remove(struct platform_device *pdev) device_remove_file(&pdev->dev, &dev_attr_subdev_conf_mode); fimc_md_unregister_entities(fmd); fimc_md_pipelines_free(fmd); - media_device_unregister(&fmd->media_dev); + media_device_unregister_cleanup(&fmd->media_dev); fimc_md_put_clocks(fmd); return 0; diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c index cd67edcad8d3..b8fe65fb06cb 100644 --- a/drivers/media/platform/omap3isp/isp.c +++ b/drivers/media/platform/omap3isp/isp.c @@ -1597,7 +1597,7 @@ static void isp_unregister_entities(struct isp_device *isp) omap3isp_stat_unregister_entities(&isp->isp_hist); v4l2_device_unregister(&isp->v4l2_dev); - media_device_unregister(&isp->media_dev); + media_device_unregister_cleanup(&isp->media_dev); } static int isp_link_entity( diff --git a/drivers/media/platform/s3c-camif/camif-core.c b/drivers/media/platform/s3c-camif/camif-core.c index 0159f98da435..303a84d7f4ec 100644 ---
[PATCH 08/42] staging: comedi: ni_660x: remove enum clock_config_register_bits
Remove this enum and add a define for the bit. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_660x.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index ab761aa..30089cd 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -155,6 +155,8 @@ enum ni_660x_register { NI660X_NUM_REGS, }; +#define NI660X_CLK_CFG_COUNTER_SWAPBIT(21) + #define NI660X_IO_CFG(x) (NI660X_IO_CFG_0_1 + ((x) / 2)) #define NI660X_IO_CFG_OUT_SEL(_c, _s) (((_s) & 0x3) << (((_c) % 2) ? 0 : 8)) #define NI660X_IO_CFG_OUT_SEL_MASK(_c) NI660X_IO_CFG_OUT_SEL((_c), 0x3) @@ -280,11 +282,6 @@ static const struct ni_660x_register_data ni_660x_reg_data[NI660X_NUM_REGS] = { [NI660X_IO_CFG_38_39] = { 0x7a2, 2 } /* read/write */ }; -/* kind of ENABLE for the second counter */ -enum clock_config_register_bits { - CounterSwap = 0x1 << 21 -}; - /* dma configuration register bits */ static inline unsigned dma_select_mask(unsigned dma_channel) { @@ -704,7 +701,7 @@ static void set_tio_counterswap(struct comedi_device *dev, int chip) * first chip. */ if (chip) - bits = CounterSwap; + bits = NI660X_CLK_CFG_COUNTER_SWAP; ni_660x_write_register(dev, chip, bits, NI660X_CLK_CFG); } -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] [media] media: rename media unregister function
Em Fri, 18 Mar 2016 16:20:19 +0200 Sakari Ailus escreveu: > 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. After thinking about that, I guess the best is to use kref only if the media_device_*devres functions are used. With this, we don't need to touch at media_device_cleanup(). Just the patch to the ML: https://patchwork.linuxtv.org/patch/33533/ It was tested with HVR-950Q. Regards, Mauro ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2] staging/comedi/dt282x: avoid integer overflow warning
On 16/03/16 20:51, Arnd Bergmann wrote: gcc-6 warns about passing negative signed integer into swab16() in the dt282x driver: drivers/staging/comedi/drivers/dt282x.c: In function 'dt282x_load_changain': include/uapi/linux/swab.h:14:33: warning: integer overflow in expression [-Woverflow] (((__u16)(x) & (__u16)0xff00U) >> 8))) ~~~^ include/uapi/linux/swab.h:107:2: note: in expansion of macro '___constant_swab16' ___constant_swab16(x) : \ ^~ include/uapi/linux/byteorder/big_endian.h:34:43: note: in expansion of macro '__swab16' #define __cpu_to_le16(x) ((__force __le16)__swab16((x))) ^~~~ include/linux/byteorder/generic.h:89:21: note: in expansion of macro '__cpu_to_le16' #define cpu_to_le16 __cpu_to_le16 ^ arch/arm/include/asm/io.h:250:6: note: in expansion of macro 'cpu_to_le16' cpu_to_le16(v),__io(p)); }) ^~~ drivers/staging/comedi/drivers/dt282x.c:566:2: note: in expansion of macro 'outw' outw(DT2821_CHANCSR_LLE | DT2821_CHANCSR_NUMB(n), ^~~~ The warning makes sense, though the code is correct as far as I can tell. This disambiguates the operation by making the constant expressions we pass here explicitly 'unsigned', which helps to avoid the warning. As pointed out by Hartley Sweeten, scripts/checkpatch.pl notices that the shifts here are rather unreadable, though the suggested BIT() macro wouldn't work either. I'm changing it to a hexadecimal notation, which hopefully improves readability. I'm leaving the DT2821_CHANCSR_PRESLA alone because it seems wrong. Signed-off-by: Arnd Bergmann --- v2: also reformat to make checkpatch.pl happy drivers/staging/comedi/drivers/dt282x.c | 72 - 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/drivers/staging/comedi/drivers/dt282x.c b/drivers/staging/comedi/drivers/dt282x.c [snip] -#define DT2821_CHANCSR_LLE (1 << 15) -#define DT2821_CHANCSR_PRESLA(x) (((x) & 0xf) >> 8) -#define DT2821_CHANCSR_NUMB(x) x) - 1) & 0xf) << 0) +#define DT2821_CHANCSR_LLE 0x8000u +#define DT2821_CHANCSR_PRESLA(x) (((x) & 0xf) >> 8) /* always 0? */ The patch is fine, thanks. Just a note on that dodgy-looking '>>' in the DT2821_CHANCSR_PRESLA macro I seems to be a typo in 0f8e8c5ab67a ("staging: comedi: dt282x: tidy up the register map and bit defines"). It should be a left-shift. Fortunately, it isn't used, but we ought to correct it sometime. Reviewed-by: Ian Abbott -- -=( Ian Abbott @ MEV Ltd.E-mail: )=- -=( Web: http://www.mev.co.uk/ )=- ___ 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 14:30 -0300, Gustavo Padovan wrote: > This function had copies in 3 different files. Unify them in > kernel.h. This is only used by gpu/drm. I think this is a poor name for a generic function that would be in kernel.h. Isn't there an include file in linux/drm that's appropriate for this. Maybe drmP.h Maybe prefix this function name with drm_ too. Also, there's this that might conflict: arch/powerpc/kernel/signal_32.c:#define to_user_ptr(p) ptr_to_compat(p) arch/powerpc/kernel/signal_32.c:#define to_user_ptr(p) ((unsigned long)(p)) ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: unisys: visornic: Made comments look nicer
On Wed, Mar 16, 2016 at 08:00:45PM -0700, Gavin O'Leary wrote: > Made comments not break coding style guidlines and easier to read. > > Signed-off-by: Gavin O'Leary > --- > drivers/staging/unisys/visornic/visornic_main.c | 29 > +++-- > 1 file changed, 17 insertions(+), 12 deletions(-) > > diff --git a/drivers/staging/unisys/visornic/visornic_main.c > b/drivers/staging/unisys/visornic/visornic_main.c > index 0519470..50ad44e 100644 > --- a/drivers/staging/unisys/visornic/visornic_main.c > +++ b/drivers/staging/unisys/visornic/visornic_main.c > @@ -1215,11 +1215,13 @@ visornic_rx(struct uiscmdrsp *cmdrsp) > "repost_return failed"); > return rx_count; > } > - /* length rcvd is greater than firstfrag in this skb rcv buf */ > - skb->tail += RCVPOST_BUF_SIZE; /* amount in skb->data */ > - skb->data_len = skb->len - RCVPOST_BUF_SIZE;/* amount that > -will be in > -frag_list */ > + /* length rcvd is greater than firstfrag in this skb rcv buf*/ > + Why the blank line? > + /*amount in skb->data */ /* amount... > + skb->tail += RCVPOST_BUF_SIZE; > + > + /* amount that will be in frag_list */ > + skb->data_len = skb->len - RCVPOST_BUF_SIZE; > } else { > /* data fits in this skb - no chaining - do >* PRECAUTIONARY check > @@ -1313,14 +1315,18 @@ visornic_rx(struct uiscmdrsp *cmdrsp) > break; > } > } > + > + /* accept packet, dest matches a multicast > + * address > + */ Not correct format :( > if (found_mc) > - break; /* accept packet, dest > -matches a multicast > -address */ > + break; > } > + > + /* accept packet, dest matches a multicast address */ Why say it twice? > } else if (skb->pkt_type == PACKET_HOST) { > - break; /* accept packet, h_dest must match vnic > -mac address */ You dropped this comment? Please relax, take a day off, and don't rush this, there's nothing I can do with any patches at the moment with the merge window being opened until 2 weeks from now anyway. greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/2] staging: wilc1000: Removed braces from single block statements
This patch corrects warnings generated by checkpatch.pl by removing braces from single block statements. Signed-ff-by: Roger H. Newell --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 31 +-- drivers/staging/wilc1000/wilc_wlan_cfg.c | 3 +-- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index b76622d..c360797 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -558,11 +558,11 @@ static void CfgConnectResult(enum conn_event enuConnDisconnEvent, if (!pstrWFIDrv->p2p_connect) wlan_channel = INVALID_CHANNEL; - if ((pstrWFIDrv->IFC_UP) && (dev == wl->vif[1]->ndev)) { + if ((pstrWFIDrv->IFC_UP) && (dev == wl->vif[1]->ndev)) pstrDisconnectNotifInfo->reason = 3; - } else if ((!pstrWFIDrv->IFC_UP) && (dev == wl->vif[1]->ndev)) { + else if ((!pstrWFIDrv->IFC_UP) && (dev == wl->vif[1]->ndev)) pstrDisconnectNotifInfo->reason = 1; - } + cfg80211_disconnected(dev, pstrDisconnectNotifInfo->reason, pstrDisconnectNotifInfo->ie, pstrDisconnectNotifInfo->ie_len, false, GFP_KERNEL); @@ -739,18 +739,15 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, wilc_add_wep_key_bss_sta(vif, sme->key, sme->key_len, sme->key_idx); } else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2) { - if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_TKIP) { + if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_TKIP) u8security = ENCRYPT_ENABLED | WPA2 | TKIP; - } else { + else u8security = ENCRYPT_ENABLED | WPA2 | AES; - } } else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_1) { - if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_TKIP) { + if (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_TKIP) u8security = ENCRYPT_ENABLED | WPA | TKIP; - } else { + else u8security = ENCRYPT_ENABLED | WPA | AES; - } - } else { s32Error = -ENOTSUPP; netdev_err(dev, "Not supported cipher\n"); @@ -762,11 +759,10 @@ static int connect(struct wiphy *wiphy, struct net_device *dev, if ((sme->crypto.wpa_versions & NL80211_WPA_VERSION_1) || (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2)) { for (i = 0; i < sme->crypto.n_ciphers_pairwise; i++) { - if (sme->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_TKIP) { + if (sme->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_TKIP) u8security = u8security | TKIP; - } else { + else u8security = u8security | AES; - } } } @@ -1355,9 +1351,8 @@ static void WILC_WFI_CfgParseRxAction(u8 *buf, u32 len) u8 channel_list_attr_index = 0; while (index < len) { - if (buf[index] == GO_INTENT_ATTR_ID) { + if (buf[index] == GO_INTENT_ATTR_ID) buf[index + 3] = (buf[index + 3] & 0x01) | (0x00 << 1); - } if (buf[index] == CHANLIST_ATTR_ID) channel_list_attr_index = index; @@ -1369,9 +1364,8 @@ static void WILC_WFI_CfgParseRxAction(u8 *buf, u32 len) if (channel_list_attr_index) { for (i = channel_list_attr_index + 3; i < ((channel_list_attr_index + 3) + buf[channel_list_attr_index + 1]); i++) { if (buf[i] == 0x51) { - for (j = i + 2; j < ((i + 2) + buf[i + 1]); j++) { + for (j = i + 2; j < ((i + 2) + buf[i + 1]); j++) buf[j] = wlan_channel; - } break; } } @@ -1409,9 +1403,8 @@ static void WILC_WFI_CfgParseTxAction(u8 *buf, u32 len, bool bOperChan, u8 iftyp if (channel_list_attr_index) { for (i = channel_list_attr_index + 3; i < ((channel_list_attr_index + 3) + buf[channel_list_attr_index + 1]); i++) {
[PATCH 2/2] staging: wilc1000: Replaced comparison to NULL statements
This patch corrects checks generated by checkpatch.pl by replacing comparison to null statements with equivalent statements in the form "x" or "!x" Signed-off-by: Roger H. Newell --- drivers/staging/wilc1000/host_interface.c | 2 +- drivers/staging/wilc1000/wilc_wlan_cfg.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 0a922c7..5c0125a 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -1647,7 +1647,7 @@ static int Handle_Key(struct wilc_vif *vif, up(&hif_drv->sem_test_key_block); } else if (pstrHostIFkeyAttr->action & ADDKEY) { pu8keybuf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL); - if (pu8keybuf == NULL) { + if (!pu8keybuf) { ret = -ENOMEM; goto _WPARxGtk_end_case_; } diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c b/drivers/staging/wilc1000/wilc_wlan_cfg.c index b9711ca..926fc16 100644 --- a/drivers/staging/wilc1000/wilc_wlan_cfg.c +++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c @@ -230,7 +230,7 @@ static int wilc_wlan_cfg_set_str(u8 *frame, u32 offset, u16 id, u8 *str, u32 siz buf[1] = (u8)(id >> 8); buf[2] = (u8)size; - if ((str != NULL) && (size != 0)) + if ((str) && (size != 0)) memcpy(&buf[3], str, size); return (size + 3); @@ -251,7 +251,7 @@ static int wilc_wlan_cfg_set_bin(u8 *frame, u32 offset, u16 id, u8 *b, u32 size) buf[2] = (u8)size; buf[3] = (u8)(size >> 8); - if ((b != NULL) && (size != 0)) { + if ((b) && (size != 0)) { memcpy(&buf[4], b, size); for (i = 0; i < size; i++) checksum += buf[i + 4]; -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 36/42] staging: comedi: ni_660x: default DIO channels with subdevice init
For aesthetics, move the initialization of the default routing for the DIO channels so it happens when the subdevice is initialized. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_660x.c | 27 +-- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index 5969723..cf25892 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -996,6 +996,19 @@ 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; +/* + * Default the DIO channels as: + * chan 0-7: DIO inputs + * chan 8-39: counter signal inputs + */ + for (i = 0; i < s->n_chan; ++i) { + unsigned int source = (i < 8) ? NI_660X_PFI_OUTPUT_DIO + : NI_660X_PFI_OUTPUT_COUNTER; + + ni_660x_set_pfi_routing(dev, i, source); + ni_660x_select_pfi_output(dev, i, 0); /* high-z */ + } + /* Counter subdevices (4 NI TIO General Purpose Counters per chip) */ for (i = 0; i < NI660X_MAX_COUNTERS; ++i) { s = &dev->subdevices[subdev++]; @@ -1028,20 +1041,6 @@ static int ni_660x_auto_attach(struct comedi_device *dev, } } -/* - * Default the DIO channels as: - * chan 0-7: DIO inputs - * chan 8-39: counter signal inputs - */ - for (i = 0; i < NI660X_NUM_PFI_CHANNELS; ++i) { - if (i < 8) - ni_660x_set_pfi_routing(dev, i, NI_660X_PFI_OUTPUT_DIO); - else - ni_660x_set_pfi_routing(dev, i, - NI_660X_PFI_OUTPUT_COUNTER); - ni_660x_select_pfi_output(dev, i, 0); /* high-z */ - } - /* * To be safe, set counterswap bits on tio chips after all the counter * outputs have been set to high impedance mode. -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 03/42] staging: comedi: ni_660x: remove enum ni_register_width
All the registers are defined struct NI_660xRegisterData and they are either 2 or 4 bytes in size. Remove the enum and just use a char member to define the size as 2 or 4 bytes. Simplify the ni_660x_{write,read}_register() functions and remove the unnecessary BUG() in each. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_660x.c | 226 ++- 1 file changed, 103 insertions(+), 123 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index 10bb839..dbbeb96 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -158,12 +158,6 @@ enum ni_660x_register { #define NI660X_IO_CFG(x) (NI660X_IO_CFG_0_1 + ((x) / 2)) -enum ni_660x_register_width { - DATA_1B, - DATA_2B, - DATA_4B -}; - enum ni_660x_register_direction { NI_660x_READ, NI_660x_WRITE, @@ -189,108 +183,108 @@ static inline unsigned NI_660X_GPCT_SUBDEV(unsigned index) struct NI_660xRegisterData { int offset; /* Offset from base address from GPCT chip */ enum ni_660x_register_direction direction; - enum ni_660x_register_width size; /* 1 byte, 2 bytes, or 4 bytes */ + char size; /* 2 or 4 bytes */ }; static const struct NI_660xRegisterData registerData[NI660X_NUM_REGS] = { - [NI660X_G0_INT_ACK] = {0x004, NI_660x_WRITE, DATA_2B}, - [NI660X_G0_STATUS] = {0x004, NI_660x_READ, DATA_2B}, - [NI660X_G1_INT_ACK] = {0x006, NI_660x_WRITE, DATA_2B}, - [NI660X_G1_STATUS] = {0x006, NI_660x_READ, DATA_2B}, - [NI660X_G01_STATUS] = {0x008, NI_660x_READ, DATA_2B}, - [NI660X_G0_CMD] = {0x00c, NI_660x_WRITE, DATA_2B}, - [NI660X_STC_DIO_PARALLEL_INPUT] = {0x00e, NI_660x_READ, DATA_2B}, - [NI660X_G1_CMD] = {0x00e, NI_660x_WRITE, DATA_2B}, - [NI660X_G0_HW_SAVE] = {0x010, NI_660x_READ, DATA_4B}, - [NI660X_G1_HW_SAVE] = {0x014, NI_660x_READ, DATA_4B}, - [NI660X_STC_DIO_OUTPUT] = {0x014, NI_660x_WRITE, DATA_2B}, - [NI660X_STC_DIO_CONTROL]= {0x016, NI_660x_WRITE, DATA_2B}, - [NI660X_G0_SW_SAVE] = {0x018, NI_660x_READ, DATA_4B}, - [NI660X_G1_SW_SAVE] = {0x01c, NI_660x_READ, DATA_4B}, - [NI660X_G0_MODE]= {0x034, NI_660x_WRITE, DATA_2B}, - [NI660X_G01_STATUS1]= {0x036, NI_660x_READ, DATA_2B}, - [NI660X_G1_MODE]= {0x036, NI_660x_WRITE, DATA_2B}, - [NI660X_STC_DIO_SERIAL_INPUT] = {0x038, NI_660x_READ, DATA_2B}, - [NI660X_G0_LOADA] = {0x038, NI_660x_WRITE, DATA_4B}, - [NI660X_G01_STATUS2]= {0x03a, NI_660x_READ, DATA_2B}, - [NI660X_G0_LOADB] = {0x03c, NI_660x_WRITE, DATA_4B}, - [NI660X_G1_LOADA] = {0x040, NI_660x_WRITE, DATA_4B}, - [NI660X_G1_LOADB] = {0x044, NI_660x_WRITE, DATA_4B}, - [NI660X_G0_INPUT_SEL] = {0x048, NI_660x_WRITE, DATA_2B}, - [NI660X_G1_INPUT_SEL] = {0x04a, NI_660x_WRITE, DATA_2B}, - [NI660X_G0_AUTO_INC]= {0x088, NI_660x_WRITE, DATA_2B}, - [NI660X_G1_AUTO_INC]= {0x08a, NI_660x_WRITE, DATA_2B}, - [NI660X_G01_RESET] = {0x090, NI_660x_WRITE, DATA_2B}, - [NI660X_G0_INT_ENA] = {0x092, NI_660x_WRITE, DATA_2B}, - [NI660X_G1_INT_ENA] = {0x096, NI_660x_WRITE, DATA_2B}, - [NI660X_G0_CNT_MODE]= {0x0b0, NI_660x_WRITE, DATA_2B}, - [NI660X_G1_CNT_MODE]= {0x0b2, NI_660x_WRITE, DATA_2B}, - [NI660X_G0_GATE2] = {0x0b4, NI_660x_WRITE, DATA_2B}, - [NI660X_G1_GATE2] = {0x0b6, NI_660x_WRITE, DATA_2B}, - [NI660X_G0_DMA_CFG] = {0x0b8, NI_660x_WRITE, DATA_2B}, - [NI660X_G0_DMA_STATUS] = {0x0b8, NI_660x_READ, DATA_2B}, - [NI660X_G1_DMA_CFG] = {0x0ba, NI_660x_WRITE, DATA_2B}, - [NI660X_G1_DMA_STATUS] = {0x0ba, NI_660x_READ, DATA_2B}, - [NI660X_G2_INT_ACK] = {0x104, NI_660x_WRITE, DATA_2B}, - [NI660X_G2_STATUS] = {0x104, NI_660x_READ, DATA_2B}, - [NI660X_G3_INT_ACK] = {0x106, NI_660x_WRITE, DATA_2B}, - [NI660X_G3_STATUS] = {0x106, NI_660x_READ, DATA_2B}, - [NI660X_G23_STATUS] = {0x108, NI_660x_READ, DATA_2B}, - [NI660X_G2_CMD] = {0x10c, NI_660x_WRITE, DATA_2B}, - [NI660X_G3_CMD] = {0x10e, NI_660x_WRITE, DATA_2B}, - [NI660X_G2_HW_SAVE] = {0x110, NI_660x_READ, DATA_4B}, - [NI660X_G3_HW_SAVE] = {0x114, NI_660x_READ, DATA_4B}, - [NI660X_G2_SW_SAVE] = {0x118,
Re: [PATCH] [media] media: rename media unregister function
Hello Mauro, On 03/18/2016 10:05 AM, Mauro Carvalho Chehab wrote: > Now that media_device_unregister() also does a cleanup, rename it > to media_device_unregister_cleanup(). > I believe there should be a Suggested-by Sakari Ailus tag here. > Signed-off-by: Mauro Carvalho Chehab The patch looks good and I agree that makes things more clear. Reviewed-by: Javier Martinez Canillas 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 v9 2/3] kernel.h: add to_user_ptr()
2016-03-17 Joe Perches : > On Thu, 2016-03-17 at 14:30 -0300, Gustavo Padovan wrote: > > This function had copies in 3 different files. Unify them in > > kernel.h. > > This is only used by gpu/drm. > > I think this is a poor name for a generic function > that would be in kernel.h. > > Isn't there an include file in linux/drm that's > appropriate for this. Maybe drmP.h > > Maybe prefix this function name with drm_ too. No, the next patch adds a user to drivers/staging (which will be moved to drivers/dma-buf) soon. Maybe move to a different header in include/linux/? not sure which one. > Also, there's this that might conflict: > > arch/powerpc/kernel/signal_32.c:#define to_user_ptr(p) > ptr_to_compat(p) > arch/powerpc/kernel/signal_32.c:#define to_user_ptr(p) ((unsigned > long)(p)) Right, I'll figure out how to replace these two too. Gustavo ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: refresh TODO for rtl8723au
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. Cc: Jes Sorensen Cc: Larry Finger Cc: Kalle Valo Cc: Greg Kroah-Hartman Cc: Linux Driver Project Developer List Cc: Linux Wireless Signed-off-by: Xose Vazquez Perez --- drivers/staging/rtl8723au/TODO | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/rtl8723au/TODO b/drivers/staging/rtl8723au/TODO index f5d57d3..42b86e4 100644 --- a/drivers/staging/rtl8723au/TODO +++ b/drivers/staging/rtl8723au/TODO @@ -9,5 +9,8 @@ TODO: - merge Realtek's bugfixes and new features into the driver - switch to use MAC80211 +A mac80211 driver for this hardware already was integrated at +drivers/net/wireless/realtek/rtl8xxxu/ + Please send any patches to Greg Kroah-Hartman , Jes Sorensen , and Larry Finger . -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: most: hdm-dim2: Remove possible dereference error
Commit 3eced21a5afb ("staging: most: hdm-dim2: Replace request_irq with devm_request_irq") introduced the following static checker warning: drivers/staging/most/hdm-dim2/dim2_hdm.c:841 dim2_probe() error: 'dev->netinfo_task' dereferencing possible ERR_PTR() Remove the warning by returning PTR_ERR immediately rather than storing in a variable and returning at the end of the function since we do not need to free anything. Signed-off-by: Amitoj Kaur Chawla --- drivers/staging/most/hdm-dim2/dim2_hdm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c index 0dc86ad..a364495 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hdm.c +++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c @@ -771,7 +771,7 @@ static int dim2_probe(struct platform_device *pdev) dev->netinfo_task = kthread_run(&deliver_netinfo_thread, (void *)dev, "dim2_netinfo"); if (IS_ERR(dev->netinfo_task)) - ret = PTR_ERR(dev->netinfo_task); + return PTR_ERR(dev->netinfo_task); for (i = 0; i < DMA_CHANNELS; i++) { struct most_channel_capability *cap = dev->capabilities + i; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: unisys: visornic: Made comments look nicer
Made comments not break coding style guidlines and easier to read. Signed-off-by: Gavin O'Leary --- drivers/staging/unisys/visornic/visornic_main.c | 29 +++-- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 0519470..50ad44e 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -1215,11 +1215,13 @@ visornic_rx(struct uiscmdrsp *cmdrsp) "repost_return failed"); return rx_count; } - /* length rcvd is greater than firstfrag in this skb rcv buf */ - skb->tail += RCVPOST_BUF_SIZE; /* amount in skb->data */ - skb->data_len = skb->len - RCVPOST_BUF_SIZE;/* amount that - will be in - frag_list */ + /* length rcvd is greater than firstfrag in this skb rcv buf*/ + + /*amount in skb->data */ + skb->tail += RCVPOST_BUF_SIZE; + + /* amount that will be in frag_list */ + skb->data_len = skb->len - RCVPOST_BUF_SIZE; } else { /* data fits in this skb - no chaining - do * PRECAUTIONARY check @@ -1313,14 +1315,18 @@ visornic_rx(struct uiscmdrsp *cmdrsp) break; } } + + /* accept packet, dest matches a multicast +* address +*/ if (found_mc) - break; /* accept packet, dest - matches a multicast - address */ + break; } + + /* accept packet, dest matches a multicast address */ } else if (skb->pkt_type == PACKET_HOST) { - break; /* accept packet, h_dest must match vnic - mac address */ + break; + } else if (skb->pkt_type == PACKET_OTHERHOST) { /* something is not right */ dev_err(&devdata->netdev->dev, @@ -1618,8 +1624,7 @@ service_resp_queue(struct uiscmdrsp *cmdrsp, struct visornic_devdata *devdata, unsigned long flags; struct net_device *netdev; - /* TODO: CLIENT ACQUIRE -- Don't really need this at the -* moment */ + /* TODO: CLIENT ACQUIRE -- Don't really need this at the moment */ for (;;) { if (!visorchannel_signalremove(devdata->dev->visorchannel, IOCHAN_FROM_IOPART, -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: most: hdm-dim2: Remove possible dereference error
On Fri, Mar 18, 2016 at 06:32:15PM +0530, Amitoj Kaur Chawla wrote: > Commit 3eced21a5afb ("staging: most: hdm-dim2: Replace request_irq > with devm_request_irq") introduced the following static checker > warning: > drivers/staging/most/hdm-dim2/dim2_hdm.c:841 dim2_probe() > error: 'dev->netinfo_task' dereferencing possible ERR_PTR() > > Remove the warning by returning PTR_ERR immediately rather than > storing in a variable and returning at the end of the function > since we do not need to free anything. This patch is not about a warning. This patch fixes the bug introduced in the previous patch that has changed the control flow so that the error code returned by the kthread_run was overwritten by the "ret = dim2_sysfs_probe" below. regards andy ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 12/42] staging: comedi: ni_660x: tidy up ni_660x_read_register()
Rename this function to help shorten some of the long lines. Remove the inline, let the compiler figure it out. Change the 'unsigned' parameters to 'unsigned int' to fix the checkpatch.pl issues: WARNING: Prefer 'unsigned int' to bare use of 'unsigned' Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_660x.c | 22 ++ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index aa40ab6..cd101bb 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -516,9 +516,9 @@ static void ni_660x_write(struct comedi_device *dev, writel(bits, dev->mmio + addr); } -static inline unsigned ni_660x_read_register(struct comedi_device *dev, -unsigned chip, -enum ni_660x_register reg) +static unsigned int ni_660x_read(struct comedi_device *dev, +unsigned int chip, +enum ni_660x_register reg) { unsigned int addr = GPCT_OFFSET[chip] + ni_660x_reg_data[reg].offset; @@ -544,7 +544,7 @@ static unsigned ni_gpct_read_register(struct ni_gpct *counter, enum ni_660x_register ni_660x_register = ni_gpct_to_660x_register(reg); unsigned chip = counter->chip_index; - return ni_660x_read_register(dev, chip, ni_660x_register); + return ni_660x_read(dev, chip, ni_660x_register); } static inline struct mite_dma_descriptor_ring *mite_ring(struct ni_660x_private @@ -812,7 +812,7 @@ static int ni_660x_dio_insn_bits(struct comedi_device *dev, } /* on return, data[1] contains the value of the digital * input and output lines. */ - data[1] = (ni_660x_read_register(dev, 0, NI660X_DIO32_INPUT) >> + data[1] = (ni_660x_read(dev, 0, NI660X_DIO32_INPUT) >> base_bitfield_channel); return insn->n; @@ -843,9 +843,8 @@ static void ni_660x_select_pfi_output(struct comedi_device *dev, } if (idle_chipset != active_chipset) { - idle_bits = - ni_660x_read_register(dev, idle_chipset, - NI660X_IO_CFG(pfi_channel)); + 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, @@ -854,9 +853,8 @@ static void ni_660x_select_pfi_output(struct comedi_device *dev, NI660X_IO_CFG(pfi_channel)); } - active_bits = - ni_660x_read_register(dev, active_chipset, - NI660X_IO_CFG(pfi_channel)); + 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, @@ -927,7 +925,7 @@ static int ni_660x_dio_insn_config(struct comedi_device *dev, break; case INSN_CONFIG_FILTER: - val = ni_660x_read_register(dev, 0, NI660X_IO_CFG(chan)); + val = ni_660x_read(dev, 0, NI660X_IO_CFG(chan)); val &= ~NI660X_IO_CFG_IN_SEL_MASK(chan); val |= NI660X_IO_CFG_IN_SEL(chan, data[1]); ni_660x_write(dev, 0, val, NI660X_IO_CFG(chan)); -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 05/42] staging: comedi: ni_660x: rename CamelCase 'NI_660xRegisterData'
Rename this CamelCase struct and the associated 'registerData' variable. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_660x.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index 409a776..d76a5b0 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -174,12 +174,12 @@ static inline unsigned NI_660X_GPCT_SUBDEV(unsigned index) return NI_660X_GPCT_SUBDEV_0 + index; } -struct NI_660xRegisterData { +struct ni_660x_register_data { int offset; /* Offset from base address from GPCT chip */ char size; /* 2 or 4 bytes */ }; -static const struct NI_660xRegisterData registerData[NI660X_NUM_REGS] = { +static const struct ni_660x_register_data ni_660x_reg_data[NI660X_NUM_REGS] = { [NI660X_G0_INT_ACK] = { 0x004, 2 }, /* write */ [NI660X_G0_STATUS] = { 0x004, 2 }, /* read */ [NI660X_G1_INT_ACK] = { 0x006, 2 }, /* write */ @@ -564,9 +564,9 @@ static inline void ni_660x_write_register(struct comedi_device *dev, unsigned chip, unsigned bits, enum ni_660x_register reg) { - unsigned int addr = GPCT_OFFSET[chip] + registerData[reg].offset; + unsigned int addr = GPCT_OFFSET[chip] + ni_660x_reg_data[reg].offset; - if (registerData[reg].size == 2) + if (ni_660x_reg_data[reg].size == 2) writew(bits, dev->mmio + addr); else writel(bits, dev->mmio + addr); @@ -576,9 +576,9 @@ static inline unsigned ni_660x_read_register(struct comedi_device *dev, unsigned chip, enum ni_660x_register reg) { - unsigned int addr = GPCT_OFFSET[chip] + registerData[reg].offset; + unsigned int addr = GPCT_OFFSET[chip] + ni_660x_reg_data[reg].offset; - if (registerData[reg].size == 2) + if (ni_660x_reg_data[reg].size == 2) return readw(dev->mmio + addr); return readl(dev->mmio + addr); } -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 34/42] staging: comedi: ni_660x: allocate counters early in (*auto_attach)
The ni_gpct_device_construct() could fail allocating the memory for device and its counters. For aesthetics, call the function before initializing the subdevices. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_660x.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index afe62bf..6366303 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -914,6 +914,16 @@ static int ni_660x_auto_attach(struct comedi_device *dev, ni_660x_init_tio_chips(dev, board->n_chips); + n_counters = board->n_chips * NI660X_COUNTERS_PER_CHIP; + gpct_dev = ni_gpct_device_construct(dev, + ni_660x_gpct_write, + ni_660x_gpct_read, + ni_gpct_variant_660x, + n_counters); + if (!gpct_dev) + return -ENOMEM; + devpriv->counter_dev = gpct_dev; + ret = comedi_alloc_subdevices(dev, 2 + NI660X_MAX_COUNTERS); if (ret) return ret; @@ -986,16 +996,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; - n_counters = board->n_chips * NI660X_COUNTERS_PER_CHIP; - gpct_dev = ni_gpct_device_construct(dev, - ni_660x_gpct_write, - ni_660x_gpct_read, - ni_gpct_variant_660x, - n_counters); - if (!gpct_dev) - return -ENOMEM; - devpriv->counter_dev = gpct_dev; - /* Counter subdevices (4 NI TIO General Purpose Counters per chip) */ for (i = 0; i < NI660X_MAX_COUNTERS; ++i) { s = &dev->subdevices[subdev++]; -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: netlogic: removed 1 multiple assignment checkpatch warning
Hi, I haven’t received any feedback as to whether my patch has been accepted. Would request someone to kindly help me out. Maybe you could weigh in here Greg? Regards, Parth Sane > On 15-Mar-2016, at 10:16 PM, laerdevstud...@gmail.com wrote: > > From: Parth Sane > > Fixed multiple assignment checkpatch warning by rearranging code. > > Signed-off-by: Parth Sane > > --- > drivers/staging/netlogic/platform_net.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/staging/netlogic/platform_net.c > b/drivers/staging/netlogic/platform_net.c > index 7806c2b..daee1b2 100644 > --- a/drivers/staging/netlogic/platform_net.c > +++ b/drivers/staging/netlogic/platform_net.c > @@ -86,7 +86,8 @@ static void xlr_resource_init(struct resource *res, int > offset, int irq) > > res++; > res->name = "gmac"; > - res->start = res->end = irq; > + res->end = irq; > + res->start = res->end; > res->flags = IORESOURCE_IRQ; > } > > -- > 2.1.4 > signature.asc Description: Message signed with OpenPGP using GPGMail ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: netlogic: removed 1 multiple assignment checkpatch warning
On Sat, Mar 19, 2016 at 2:04 PM, Parth Sane wrote: > Hi, > I haven’t received any feedback as to whether my patch has been accepted. > Would request someone to kindly help me out. Maybe you could weigh in here > Greg? > Regards, > Parth Sane >> On 15-Mar-2016, at 10:16 PM, laerdevstud...@gmail.com wrote: >> >> From: Parth Sane >> >> Fixed multiple assignment checkpatch warning by rearranging code. >> >> Signed-off-by: Parth Sane >> >> --- >> drivers/staging/netlogic/platform_net.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/staging/netlogic/platform_net.c >> b/drivers/staging/netlogic/platform_net.c >> index 7806c2b..daee1b2 100644 >> --- a/drivers/staging/netlogic/platform_net.c >> +++ b/drivers/staging/netlogic/platform_net.c >> @@ -86,7 +86,8 @@ static void xlr_resource_init(struct resource *res, int >> offset, int irq) >> >> res++; >> res->name = "gmac"; >> - res->start = res->end = irq; >> + res->end = irq; >> + res->start = res->end; >> res->flags = IORESOURCE_IRQ; >> } >> >> -- >> 2.1.4 >> > > > ___ > devel mailing list > de...@linuxdriverproject.org > http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel > This patch is only 4 days old. It's likely in Gregs queue and you just have to wait a bit longer. I don't think you need the From: line in the body of the patch. The Signed-off-by: should suffice. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: netlogic: removed 1 multiple assignment checkpatch warning
Hi Roger, Can I submit more patches similarly until this has been accepted? I’ll be sure to remove the from part in my next patch(I hope I don’t have to submit the earlier patch again).Thanks for your wise comments! Regards, Parth Sane > On 19-Mar-2016, at 10:33 PM, Roger H Newell wrote: > > On Sat, Mar 19, 2016 at 2:04 PM, Parth Sane wrote: >> Hi, >> I haven’t received any feedback as to whether my patch has been accepted. >> Would request someone to kindly help me out. Maybe you could weigh in here >> Greg? >> Regards, >> Parth Sane >>> On 15-Mar-2016, at 10:16 PM, laerdevstud...@gmail.com wrote: >>> >>> From: Parth Sane >>> >>> Fixed multiple assignment checkpatch warning by rearranging code. >>> >>> Signed-off-by: Parth Sane >>> >>> --- >>> drivers/staging/netlogic/platform_net.c | 3 ++- >>> 1 file changed, 2 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/staging/netlogic/platform_net.c >>> b/drivers/staging/netlogic/platform_net.c >>> index 7806c2b..daee1b2 100644 >>> --- a/drivers/staging/netlogic/platform_net.c >>> +++ b/drivers/staging/netlogic/platform_net.c >>> @@ -86,7 +86,8 @@ static void xlr_resource_init(struct resource *res, int >>> offset, int irq) >>> >>> res++; >>> res->name = "gmac"; >>> - res->start = res->end = irq; >>> + res->end = irq; >>> + res->start = res->end; >>> res->flags = IORESOURCE_IRQ; >>> } >>> >>> -- >>> 2.1.4 >>> >> >> >> ___ >> devel mailing list >> de...@linuxdriverproject.org >> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel >> > > This patch is only 4 days old. It's likely in Gregs queue and you just > have to wait a bit longer. I don't think you need the From: line in > the body of the patch. The Signed-off-by: should suffice. signature.asc Description: Message signed with OpenPGP using GPGMail ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: netlogic: removed 1 multiple assignment checkpatch warning
On Sat, Mar 19, 2016 at 10:04:23PM +0530, Parth Sane wrote: > Hi, > I haven’t received any feedback as to whether my patch has been accepted. > Would request someone to kindly help me out. Maybe you could weigh in here > Greg? > Regards, > Parth Sane > > On 15-Mar-2016, at 10:16 PM, laerdevstud...@gmail.com wrote: 4 days later in the middle of a merge window when I can't add any new patches to my queue? Please be patient, I will get to this after 4.6-rc1 is out. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: netlogic: removed 1 multiple assignment checkpatch warning
Hi, Thanks for getting back to me Greg! I’m still learning, so thanks again for bearing with me! Regards, Parth Sane > On 19-Mar-2016, at 10:43 PM, Greg KH wrote: > > On Sat, Mar 19, 2016 at 10:04:23PM +0530, Parth Sane wrote: >> Hi, >> I haven’t received any feedback as to whether my patch has been accepted. >> Would request someone to kindly help me out. Maybe you could weigh in here >> Greg? >> Regards, >> Parth Sane >>> On 15-Mar-2016, at 10:16 PM, laerdevstud...@gmail.com wrote: > > 4 days later in the middle of a merge window when I can't add any new > patches to my queue? Please be patient, I will get to this after > 4.6-rc1 is out. > > thanks, > > greg k-h signature.asc Description: Message signed with OpenPGP using GPGMail ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 29/42] staging: comedi: ni_660x: tidy up the counter subdevices init
For aesthetics, add some whitespace to the subdevice init and use a couple local variables to make the code easier to follow. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_660x.c | 59 +--- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index 80499d6..35602cc 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -864,6 +864,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; + struct ni_gpct_device *gpct_dev; unsigned int n_counters; int subdev; int ret; @@ -977,46 +978,50 @@ static int ni_660x_auto_attach(struct comedi_device *dev, ni_660x_write(dev, 0, 0, NI660X_STC_DIO_CONTROL); n_counters = board->n_chips * NI660X_COUNTERS_PER_CHIP; - devpriv->counter_dev = ni_gpct_device_construct(dev, -ni_660x_gpct_write, -ni_660x_gpct_read, -ni_gpct_variant_660x, -n_counters); - if (!devpriv->counter_dev) + gpct_dev = ni_gpct_device_construct(dev, + ni_660x_gpct_write, + ni_660x_gpct_read, + ni_gpct_variant_660x, + n_counters); + if (!gpct_dev) return -ENOMEM; + devpriv->counter_dev = gpct_dev; + + /* Counter subdevices (4 NI TIO General Purpose Counters per chip) */ for (i = 0; i < NI660X_MAX_COUNTERS; ++i) { s = &dev->subdevices[subdev++]; if (i < n_counters) { - s->type = COMEDI_SUBD_COUNTER; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE | + struct ni_gpct *counter = &gpct_dev->counters[i]; + + counter->chip_index = i / NI660X_COUNTERS_PER_CHIP; + counter->counter_index = i % NI660X_COUNTERS_PER_CHIP; + + s->type = COMEDI_SUBD_COUNTER; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL | SDF_CMD_READ; - s->n_chan = 3; - s->maxdata = 0x; - s->insn_read = ni_tio_insn_read; - s->insn_write = ni_tio_insn_write; - s->insn_config = ni_tio_insn_config; - s->do_cmd = &ni_660x_cmd; - s->len_chanlist = 1; - s->do_cmdtest = ni_tio_cmdtest; - s->cancel = &ni_660x_cancel; - s->poll = &ni_660x_input_poll; + s->n_chan = 3; + s->maxdata = 0x; + s->insn_read= ni_tio_insn_read; + s->insn_write = ni_tio_insn_write; + s->insn_config = ni_tio_insn_config; + s->len_chanlist = 1; + s->do_cmd = ni_660x_cmd; + s->do_cmdtest = ni_tio_cmdtest; + s->cancel = ni_660x_cancel; + s->poll = ni_660x_input_poll; + s->buf_change = ni_660x_buf_change; s->async_dma_dir = DMA_BIDIRECTIONAL; - s->buf_change = &ni_660x_buf_change; - s->private = &devpriv->counter_dev->counters[i]; - - devpriv->counter_dev->counters[i].chip_index = - i / NI660X_COUNTERS_PER_CHIP; - devpriv->counter_dev->counters[i].counter_index = - i % NI660X_COUNTERS_PER_CHIP; + s->private = counter; } else { - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; } } + for (i = 0; i < board->n_chips; ++i) init_tio_chip(dev, i); for (i = 0; i < n_counters; ++i) - ni_tio_init_counter(&devpriv->counter_dev->counters[i]); + ni_tio_init_counter(&gpct_dev->counters[i]); /* * Default the DIO channels as: -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 5/9] rtlwifi: rtl8192ee: Fix Smatch warning
Smatch lists the following: CHECK drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c:371 rtl92ee_rx_query_desc() warn: inconsistent indenting Signed-off-by: Larry Finger --- drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c index 24eff8e..35e6bf7 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.c @@ -368,7 +368,7 @@ bool rtl92ee_rx_query_desc(struct ieee80211_hw *hw, status->decrypted = !GET_RX_DESC_SWDEC(pdesc); status->rate = (u8)GET_RX_DESC_RXMCS(pdesc); status->isampdu = (bool)(GET_RX_DESC_PAGGR(pdesc) == 1); - status->timestamp_low = GET_RX_DESC_TSFL(pdesc); + status->timestamp_low = GET_RX_DESC_TSFL(pdesc); status->is_cck = RTL92EE_RX_HAL_IS_CCK_RATE(status->rate); status->macid = GET_RX_DESC_MACID(pdesc); -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v10 1/3] staging/android: remove redundant comments on sync_merge_data
From: Gustavo Padovan struct sync_merge_data already have documentation on top of the struct definition. No need to duplicate it. Signed-off-by: Gustavo Padovan Reviewed-by: Maarten Lankhorst --- drivers/staging/android/uapi/sync.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/android/uapi/sync.h b/drivers/staging/android/uapi/sync.h index a0cf357..4467c76 100644 --- a/drivers/staging/android/uapi/sync.h +++ b/drivers/staging/android/uapi/sync.h @@ -21,9 +21,9 @@ * @fence: returns the fd of the new fence to userspace */ struct sync_merge_data { - __s32 fd2; /* fd of second fence */ - charname[32]; /* name of new fence */ - __s32 fence; /* fd on newly created fence */ + __s32 fd2; + charname[32]; + __s32 fence; }; /** -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v9 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 | 75 - drivers/staging/android/uapi/sync.h | 36 +- 2 files changed, 66 insertions(+), 45 deletions(-) diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c index 3a8f210..1d9c530 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,62 @@ 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) -
RE: [PATCH v2] staging/comedi/dt282x: avoid integer overflow warning
On Thursday, March 17, 2016 9:09 AM, Arnd Bergmann wrote: > On Thursday 17 March 2016 15:47:57 Hartley Sweeten wrote: >> On Wednesday, March 16, 2016 1:51 PM, Arnd Bergmann wrote: >> >> Is this a gcc-6 specific issue? Seems line this warning should be showing >> up in a lot of drivers. > > Yes, I did not see this before moving to gcc-6.0, but this is the only driver > I've encountered the warning for, in around 7000 randconfig builds. Weird... > Feel free to come up with a different patch. I've put the patch on > my 'submitted' stack for now and will get back to it after 4.7-rc1 if > the warning remains. I'll post an alternate patch shortly that is more consistent with the other comedi drivers. If you could test that it fixes the gcc-6 issue that would be great! Thanks, Hartley ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: comedi: ni_mio_common: fix the ni_write[blw]() functions
On Fri, Mar 18, 2016 at 05:38:45PM +, Hartley Sweeten wrote: > On Wednesday, March 16, 2016 3:22 AM, Ian Abbott wrote: > > On 15/03/16 21:48, H Hartley Sweeten wrote: > >> Memory mapped io (dev->mmio) should not also be writing to the ioport > >> (dev->iobase) registers. Add the missing 'else' to these functions. > >> > >> Signed-off-by: H Hartley Sweeten > >> Cc: Ian Abbott > >> Cc: Greg Kroah-Hartman > >> --- > >> drivers/staging/comedi/drivers/ni_mio_common.c | 12 ++-- > >> 1 file changed, 6 insertions(+), 6 deletions(-) > > > > Please add: > > > > Fixes: 0953ee4acca0 ("staging: comedi: ni_mio_common: checkpatch.pl > > cleanup (else not useful)") > > Cc: # 3.17+ > > > > Reviewed-by: Ian Abbott > > Ugh... Looks like I broke it. > > Greg, > > Would you like me to repost this with the Fixes/Cc added or do you got it? I got it, no problem. greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 35/42] staging: comedi: ni_660x: initialize the counter with the subdevice init
Remove the extra for loop and just initialize the counter as the subdevices are created. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_660x.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index 6366303..5969723 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -1021,14 +1021,13 @@ static int ni_660x_auto_attach(struct comedi_device *dev, s->buf_change = ni_660x_buf_change; s->async_dma_dir = DMA_BIDIRECTIONAL; s->private = counter; + + ni_tio_init_counter(counter); } else { s->type = COMEDI_SUBD_UNUSED; } } - for (i = 0; i < n_counters; ++i) - ni_tio_init_counter(&gpct_dev->counters[i]); - /* * Default the DIO channels as: * chan 0-7: DIO inputs -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v10 2/3] kernel.h: add u64_to_user_ptr()
From: Gustavo Padovan This function had copies in 3 different files. Unify them in kernel.h. Cc: Joe Perches Cc: Andrew Morton Cc: David Airlie Cc: Daniel Vetter Cc: Rob Clark Signed-off-by: Gustavo Padovan --- drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 11 +++ drivers/gpu/drm/i915/i915_drv.h | 5 - drivers/gpu/drm/i915/i915_gem.c | 14 +++--- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 14 +++--- drivers/gpu/drm/msm/msm_gem_submit.c | 11 +++ include/linux/kernel.h | 5 + 6 files changed, 25 insertions(+), 35 deletions(-) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c index 1aba01a..5420bc5 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c @@ -28,11 +28,6 @@ #define BO_LOCKED 0x4000 #define BO_PINNED 0x2000 -static inline void __user *to_user_ptr(u64 address) -{ - return (void __user *)(uintptr_t)address; -} - static struct etnaviv_gem_submit *submit_create(struct drm_device *dev, struct etnaviv_gpu *gpu, size_t nr) { @@ -351,21 +346,21 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data, cmdbuf->exec_state = args->exec_state; cmdbuf->ctx = file->driver_priv; - ret = copy_from_user(bos, to_user_ptr(args->bos), + ret = copy_from_user(bos, u64_to_user_ptr(args->bos), args->nr_bos * sizeof(*bos)); if (ret) { ret = -EFAULT; goto err_submit_cmds; } - ret = copy_from_user(relocs, to_user_ptr(args->relocs), + ret = copy_from_user(relocs, u64_to_user_ptr(args->relocs), args->nr_relocs * sizeof(*relocs)); if (ret) { ret = -EFAULT; goto err_submit_cmds; } - ret = copy_from_user(stream, to_user_ptr(args->stream), + ret = copy_from_user(stream, u64_to_user_ptr(args->stream), args->stream_size); if (ret) { ret = -EFAULT; diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index b0847b9..c446895 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -3564,11 +3564,6 @@ static inline i915_reg_t i915_vgacntrl_reg(struct drm_device *dev) return VGACNTRL; } -static inline void __user *to_user_ptr(u64 address) -{ - return (void __user *)(uintptr_t)address; -} - static inline unsigned long msecs_to_jiffies_timeout(const unsigned int m) { unsigned long j = msecs_to_jiffies(m); diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index bb44bad..cd11790 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -324,7 +324,7 @@ i915_gem_phys_pwrite(struct drm_i915_gem_object *obj, { struct drm_device *dev = obj->base.dev; void *vaddr = obj->phys_handle->vaddr + args->offset; - char __user *user_data = to_user_ptr(args->data_ptr); + char __user *user_data = u64_to_user_ptr(args->data_ptr); int ret = 0; /* We manually control the domain here and pretend that it @@ -605,7 +605,7 @@ i915_gem_shmem_pread(struct drm_device *dev, int needs_clflush = 0; struct sg_page_iter sg_iter; - user_data = to_user_ptr(args->data_ptr); + user_data = u64_to_user_ptr(args->data_ptr); remain = args->size; obj_do_bit17_swizzling = i915_gem_object_needs_bit17_swizzle(obj); @@ -692,7 +692,7 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data, return 0; if (!access_ok(VERIFY_WRITE, - to_user_ptr(args->data_ptr), + u64_to_user_ptr(args->data_ptr), args->size)) return -EFAULT; @@ -783,7 +783,7 @@ i915_gem_gtt_pwrite_fast(struct drm_device *dev, if (ret) goto out_unpin; - user_data = to_user_ptr(args->data_ptr); + user_data = u64_to_user_ptr(args->data_ptr); remain = args->size; offset = i915_gem_obj_ggtt_offset(obj) + args->offset; @@ -907,7 +907,7 @@ i915_gem_shmem_pwrite(struct drm_device *dev, int needs_clflush_before = 0; struct sg_page_iter sg_iter; - user_data = to_user_ptr(args->data_ptr); + user_data = u64_to_user_ptr(args->data_ptr); remain = args->size; obj_do_bit17_swizzling = i915_gem_object_needs_bit17_swizzle(obj); @@ -1036,12 +1036,12 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data, return 0; if (!access_ok(VERIFY_READ, - to_user_ptr(args->data_ptr), + u64_to_user_ptr(args->data_ptr), args->size)) return -EFAULT; if (likely(
Re: [PATCH] media: add GFP flag to media_*() that could get called in atomic context
Em Wed, 16 Mar 2016 10:28:35 +0200 Sakari Ailus escreveu: > Hi Mauro, > > On Tue, Mar 15, 2016 at 12:55:35PM -0300, Mauro Carvalho Chehab wrote: > > Em Mon, 14 Mar 2016 14:09:09 +0200 > > Sakari Ailus escreveu: > > > > > Hi Mauro, > > > ... > > > Notify callbacks, perhaps not, but the list is still protected by the > > > spinlock. It perhaps is not likely that another process would change it > > > but > > > I don't think we can rely on that. > > > > I can see only 2 risks protected by the lock: > > > > 1) mdev gets freed while an entity is being created. This is a problem > >with the current memory protection schema we're using. I guess the > >only way to fix it is to use kref for > > mdev/entities/interfaces/links/pads. > >This change doesn't make it better or worse. > >Also, I don't think we have such risk with the current devices. > > > > 2) a notifier may be inserted or removed by another driver, while the > >loop is running. > > > > To avoid (2), I see 3 alternatives: > > > > a) keep the loop as proposed on this patch. As the list is navigated using > > list_for_each_entry_safe(), I guess[1] it should be safe to remove/add > > new notify callbacks there while the loop is running by some other process. > > > > list_for_each_entry_safe() does not protect against concurrent access, only > against adding and removing list entries by the same user. List access > serialisation is still needed, whether you use _safe() functions or not. > > > > > [1] It *is* safe if the change were done inside the loop - but I'm not > > 100% sure that it is safe if some other CPU touches the notify list. > > Indeed. > > > > > b) Unlock/relock the spinlock every time: > > > > /* previous code that locks mdev->lock spinlock */ > > > > /* invoke entity_notify callbacks */ > > list_for_each_entry_safe(notify, next, &mdev->entity_notify, list) { > > spin_unlock(&mdev->lock); > > (notify)->notify(entity, notify->notify_data); > > spin_lock(&mdev->lock); > > } > > > > spin_unlock(&mdev->lock); > > > > c) use a separate lock for the notify list -this seems to be an overkill. > > > > d) Protect it with the graph traversal mutex. That sounds the worse idea, > >IMHO, as we'll be abusing the lock. > > I'd simply replace the spinlock with a mutex here. As we want to get rid of > the graph mutex anyway in the long run, let's not mix the two as they're > well separated now. As long as the mutex users do not sleep (i.e. the > notify() callback) the mutex is about as fast to use as the spinlock. It could work. I added such patch on an experimental branch, where I'm addressing a few troubles with au0828 unbind logic: https://git.linuxtv.org/mchehab/experimental.git/log/?h=au0828-unbind-fixes The patch itself is at: https://git.linuxtv.org/mchehab/experimental.git/commit/?h=au0828-unbind-fixes&id=dba4d41bdfa6bb8dc51cb0f692102919b2b7c8b4 At least for au0828, it seems to work fine. Regards, Mauro ___ 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 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? Thanks, James ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: netlogic: Fixed alignment of parantheseis checkpatch warning
From: Ubuntu Fixed alignment of paranthesis as per checkpatch. Signed-off-by: Parth Sane --- drivers/staging/netlogic/platform_net.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/netlogic/platform_net.c b/drivers/staging/netlogic/platform_net.c index daee1b2..82af021 100644 --- a/drivers/staging/netlogic/platform_net.c +++ b/drivers/staging/netlogic/platform_net.c @@ -121,9 +121,7 @@ static struct platform_device *gmac_controller2_init(void *gmac0_addr) ndata1.tx_stnid[mac] = FMN_STNID_GMAC1_TX0 + mac; ndata1.phy_addr[mac] = mac + 4 + 0x10; - xlr_resource_init(&xlr_net1_res[mac * 2], - xlr_gmac_offsets[mac + 4], - xlr_gmac_irqs[mac + 4]); + xlr_resource_init(&xlr_net1_res[mac * 2], xlr_gmac_offsets[mac + 4], xlr_gmac_irqs[mac + 4]); } xlr_net_dev1.num_resources = 8; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: netlogic: Fixed alignment of parantheseis checkpatch warning
Fixed alignment of paranthesis as per checkpatch. Signed-off-by: Parth Sane --- drivers/staging/netlogic/platform_net.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/netlogic/platform_net.c b/drivers/staging/netlogic/platform_net.c index daee1b2..82af021 100644 --- a/drivers/staging/netlogic/platform_net.c +++ b/drivers/staging/netlogic/platform_net.c @@ -121,9 +121,7 @@ static struct platform_device *gmac_controller2_init(void *gmac0_addr) ndata1.tx_stnid[mac] = FMN_STNID_GMAC1_TX0 + mac; ndata1.phy_addr[mac] = mac + 4 + 0x10; - xlr_resource_init(&xlr_net1_res[mac * 2], - xlr_gmac_offsets[mac + 4], - xlr_gmac_irqs[mac + 4]); + xlr_resource_init(&xlr_net1_res[mac * 2], xlr_gmac_offsets[mac + 4], xlr_gmac_irqs[mac + 4]); } xlr_net_dev1.num_resources = 8; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] staging: most: hdm-dim2: Remove possible dereference error
Commit 3eced21a5afb ("staging: most: hdm-dim2: Replace request_irq with devm_request_irq") introduced the following static checker warning: drivers/staging/most/hdm-dim2/dim2_hdm.c:841 dim2_probe() error: 'dev->netinfo_task' dereferencing possible ERR_PTR() Remove the bug introduced by the commit due to change in control flow by returning PTR_ERR immediately rather than returning at the end of the function since we do not need to free anything. Signed-off-by: Amitoj Kaur Chawla --- Changes in v2: -Revised commit message drivers/staging/most/hdm-dim2/dim2_hdm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c index 0dc86ad..a364495 100644 --- a/drivers/staging/most/hdm-dim2/dim2_hdm.c +++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c @@ -771,7 +771,7 @@ static int dim2_probe(struct platform_device *pdev) dev->netinfo_task = kthread_run(&deliver_netinfo_thread, (void *)dev, "dim2_netinfo"); if (IS_ERR(dev->netinfo_task)) - ret = PTR_ERR(dev->netinfo_task); + return PTR_ERR(dev->netinfo_task); for (i = 0; i < DMA_CHANNELS; i++) { struct most_channel_capability *cap = dev->capabilities + i; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Add tw5864 driver
On Mon, Mar 14, 2016 at 03:55:14AM +0200, Andrey Utkin wrote: > From: Andrey Utkin > > Support for boards based on Techwell TW5864 chip which provides > multichannel video & audio grabbing and encoding (H.264, MJPEG, > ADPCM G.726). > > Signed-off-by: Andrey Utkin > Tested-by: Andrey Utkin > --- > MAINTAINERS |7 + > drivers/staging/media/Kconfig|2 + > drivers/staging/media/Makefile |1 + > drivers/staging/media/tw5864/Kconfig | 11 + > drivers/staging/media/tw5864/Makefile|3 + > drivers/staging/media/tw5864/tw5864-bs.h | 154 ++ > drivers/staging/media/tw5864/tw5864-config.c | 359 + > drivers/staging/media/tw5864/tw5864-core.c | 453 ++ > drivers/staging/media/tw5864/tw5864-h264.c | 183 +++ > drivers/staging/media/tw5864/tw5864-reg.h| 2200 > ++ > drivers/staging/media/tw5864/tw5864-tables.h | 237 +++ > drivers/staging/media/tw5864/tw5864-video.c | 1364 > drivers/staging/media/tw5864/tw5864.h| 280 > include/linux/pci_ids.h |1 + > 14 files changed, 5255 insertions(+) > create mode 100644 drivers/staging/media/tw5864/Kconfig > create mode 100644 drivers/staging/media/tw5864/Makefile > create mode 100644 drivers/staging/media/tw5864/tw5864-bs.h > create mode 100644 drivers/staging/media/tw5864/tw5864-config.c > create mode 100644 drivers/staging/media/tw5864/tw5864-core.c > create mode 100644 drivers/staging/media/tw5864/tw5864-h264.c > create mode 100644 drivers/staging/media/tw5864/tw5864-reg.h > create mode 100644 drivers/staging/media/tw5864/tw5864-tables.h > create mode 100644 drivers/staging/media/tw5864/tw5864-video.c > create mode 100644 drivers/staging/media/tw5864/tw5864.h > > diff --git a/MAINTAINERS b/MAINTAINERS > index 409509d..7bb1fa9 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -11195,6 +11195,13 @@ T: git git://linuxtv.org/media_tree.git > S: Odd fixes > F: drivers/media/usb/tm6000/ > > +TW5864 VIDEO4LINUX DRIVER > +M: Bluecherry Maintainers I wonder if this the right thing to do. Generally speaking a maintainer is a person and not a corporate. > +M: Andrey Utkin > +L: linux-me...@vger.kernel.org > +S: Supported > +F: drivers/staging/media/tw5864/ > + > --- /dev/null > +++ b/drivers/staging/media/tw5864/tw5864-bs.h > @@ -0,0 +1,154 @@ > +/* > + * TW5864 driver - Exp-Golomb code functions > + * > + * Copyright (C) 2015 Bluecherry, LLC > + * Author: Andrey Utkin You don't need to state your name here. It is written in git log. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 42/42] staging: comedi: ni_660x: update the MODULE_DESCRIPTION
Change the generic MODULE_DESCRIPTION text to something more useful. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_660x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index 73ccd62..4345bdc 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -940,5 +940,5 @@ static struct pci_driver ni_660x_pci_driver = { module_comedi_pci_driver(ni_660x_driver, ni_660x_pci_driver); MODULE_AUTHOR("Comedi http://www.comedi.org";); -MODULE_DESCRIPTION("Comedi low-level driver"); +MODULE_DESCRIPTION("Comedi driver for NI 660x counter/timer boards"); MODULE_LICENSE("GPL"); -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 13/42] staging: comedi: ni_660x: tidy up ni_gpct_{write, read}_register()
Rename these functions so they have namespace associated with the driver. Fix the checkpatch.pl issues: WARNING: Prefer 'unsigned int' to bare use of 'unsigned' Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_660x.c | 16 +++- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index cd101bb..e0532f4 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -527,24 +527,22 @@ static unsigned int ni_660x_read(struct comedi_device *dev, return readl(dev->mmio + addr); } -static void ni_gpct_write_register(struct ni_gpct *counter, unsigned bits, - enum ni_gpct_register reg) +static void ni_660x_gpct_write(struct ni_gpct *counter, unsigned int bits, + enum ni_gpct_register reg) { struct comedi_device *dev = counter->counter_dev->dev; enum ni_660x_register ni_660x_register = ni_gpct_to_660x_register(reg); - unsigned chip = counter->chip_index; - ni_660x_write(dev, chip, bits, ni_660x_register); + ni_660x_write(dev, counter->chip_index, bits, ni_660x_register); } -static unsigned ni_gpct_read_register(struct ni_gpct *counter, +static unsigned int ni_660x_gpct_read(struct ni_gpct *counter, enum ni_gpct_register reg) { struct comedi_device *dev = counter->counter_dev->dev; enum ni_660x_register ni_660x_register = ni_gpct_to_660x_register(reg); - unsigned chip = counter->chip_index; - return ni_660x_read(dev, chip, ni_660x_register); + return ni_660x_read(dev, counter->chip_index, ni_660x_register); } static inline struct mite_dma_descriptor_ring *mite_ring(struct ni_660x_private @@ -999,8 +997,8 @@ static int ni_660x_auto_attach(struct comedi_device *dev, ni_660x_write(dev, 0, 0, NI660X_STC_DIO_CONTROL); devpriv->counter_dev = ni_gpct_device_construct(dev, -&ni_gpct_write_register, -&ni_gpct_read_register, +ni_660x_gpct_write, +ni_660x_gpct_read, ni_gpct_variant_660x, ni_660x_num_counters (dev)); -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 16/42] staging: comedi: ni_660x: fix block comment issues
Fix the checkpatch.pl issues about: WARNING: Block comments use * on subsequent lines WARNING: Block comments use a trailing */ on a separate line Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_660x.c | 17 +++-- 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index 232c897..0183497 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -48,8 +48,7 @@ enum ni_660x_constants { }; #define NUM_PFI_CHANNELS 40 -/* really there are only up to 3 dma channels, but the register layout allows -for 4 */ +/* there are only up to 3 dma channels, but the register layout allows for 4 */ #define MAX_DMA_CHANNEL 4 /* See Register-Level Programmer Manual page 3.1 */ @@ -985,8 +984,11 @@ static int ni_660x_auto_attach(struct comedi_device *dev, 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 - output enables in stc dio control reg */ + + /* +* 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); devpriv->counter_dev = ni_gpct_device_construct(dev, @@ -1040,8 +1042,11 @@ static int ni_660x_auto_attach(struct comedi_device *dev, NI660X_IO_CFG_OUT_SEL_COUNTER); ni_660x_select_pfi_output(dev, i, NI660X_IO_CFG_OUT_SEL_HIGH_Z); } - /* to be safe, set counterswap bits on tio chips after all the counter - outputs have been set to high impedance mode */ + + /* +* To be safe, set counterswap bits on tio chips after all the counter +* outputs have been set to high impedance mode. +*/ for (i = 0; i < board->n_chips; ++i) set_tio_counterswap(dev, i); -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Drivers: hv: vmbus: handle various crash scenarios
2016-03-18 13:33+0100, Vitaly Kuznetsov: > 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. (Any chance of learning about this behavior from the spec?) > 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. (Yeah, seems better than hv_setup_vmbus_irq(NULL) or other hacks.) > 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. What if HV already set the pending message bit on current message, do we get any guarantees that clearing once after UNLOAD_RESPONSE is enough? > Signed-off-by: Vitaly Kuznetsov > --- I had a question about NULL below. (Parenthesised rants aren't related to r-b tag. ;) > 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) { (I'd feel a bit safer if this was bounded by some timeout, but all scenarios where this would make a difference are unplausible ... queue_work() not working while the rest is fine is the best one.) > + if (completion_done(&vmbus_connection.unload_event)) { > + unloaded = true; (No need to set unloaded when you break.) > + break; > + } > + > if (READ_ONCE(msg->header.message_type) == HVMSG_NONE) { > mdelay(10); > continue; > @@ -530,9 +542,17 @@ static void vmbus_wait_for_unload(void) (I'm not a huge fan of the unloaded variable; what about remembering the header/msgtype here ... > unloaded = true; > > vmbus_signal_eom(msg); and checking its value here?) > + } > > - 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]; Can't this be NULL? > + msg = (struct hv_message *)page_addr + VMBUS_MESSAGE_SINT; > + msg->header.message_type = HVMSG_NONE; > } (And, this block belongs to a separate function. ;]) ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: netlogic: Fixed alignment of parantheseis checkpatch warning
On Sat, 2016-03-19 at 18:35 +, Parth Sane wrote: > Fixed alignment of paranthesis as per checkpatch. Please run your proposed patches through checkpatch. > diff --git a/drivers/staging/netlogic/platform_net.c > b/drivers/staging/netlogic/platform_net.c [] > @@ -121,9 +121,7 @@ static struct platform_device *gmac_controller2_init(void > *gmac0_addr) > ndata1.tx_stnid[mac] = FMN_STNID_GMAC1_TX0 + mac; > ndata1.phy_addr[mac] = mac + 4 + 0x10; > > - xlr_resource_init(&xlr_net1_res[mac * 2], > - xlr_gmac_offsets[mac + 4], > - xlr_gmac_irqs[mac + 4]); > + xlr_resource_init(&xlr_net1_res[mac * 2], xlr_gmac_offsets[mac > + 4], xlr_gmac_irqs[mac + 4]); More typical is to avoid exceeding 80 columns and wrap this line like: xlr_resource_init(&xlr_net1_res[mac * 2], xlr_gmac_offsets[mac + 4], xlr_gmac_irqs[mac + 4]); Indenting the 2nd and 3rd lines with 4 tabs and 2 spaces ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 23/42] staging: comedi: ni_660x: tidy up ni_660x_set_pfi_routing()
Use the comedi.h provided constants (enum ni_660x_pfi_routing) instead of defining new ones for the output sources. Use a switch to clarify the channel/source validation. For aesthetics, rename the private data members 'pfi_output_selects' and 'pfi_direction_bits'. Remove the 'min_counter_pfi_chan' and 'max_dio_pfi_chan' from enum ni_660x_constants. The open coded values make the code easier to follow. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_660x.c | 65 +--- 1 file changed, 27 insertions(+), 38 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index f614927..3415a15 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -42,8 +42,6 @@ #include "ni_tio.h" enum ni_660x_constants { - min_counter_pfi_chan = 8, - max_dio_pfi_chan = 31, counters_per_chip = 4 }; @@ -172,10 +170,6 @@ enum ni_660x_register { #define NI660X_IO_CFG(x) (NI660X_IO_CFG_0_1 + ((x) / 2)) #define NI660X_IO_CFG_OUT_SEL(_c, _s) (((_s) & 0x3) << (((_c) % 2) ? 0 : 8)) #define NI660X_IO_CFG_OUT_SEL_MASK(_c) NI660X_IO_CFG_OUT_SEL((_c), 0x3) -#define NI660X_IO_CFG_OUT_SEL_HIGH_Z 0 -#define NI660X_IO_CFG_OUT_SEL_COUNTER 1 -#define NI660X_IO_CFG_OUT_SEL_DO 2 -#define NI660X_IO_CFG_OUT_SEL_MAX 3 #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) @@ -331,7 +325,6 @@ static const struct ni_660x_board ni_660x_boards[] = { struct ni_660x_private { struct mite_struct *mite; struct ni_gpct_device *counter_dev; - u64 pfi_direction_bits; struct mite_dma_descriptor_ring *mite_rings[NI_660X_MAX_NUM_CHIPS][counters_per_chip]; spinlock_t mite_channel_lock; @@ -339,7 +332,8 @@ struct ni_660x_private { spinlock_t interrupt_lock; unsigned int dma_cfg[NI_660X_MAX_NUM_CHIPS]; spinlock_t soft_reg_copy_lock; - unsigned short pfi_output_selects[NUM_PFI_CHANNELS]; + unsigned int io_cfg[NUM_PFI_CHANNELS]; + u64 io_dir; }; static enum ni_660x_register ni_gpct_to_660x_register(enum ni_gpct_register reg) @@ -728,7 +722,7 @@ static int ni_660x_allocate_private(struct comedi_device *dev) spin_lock_init(&devpriv->interrupt_lock); spin_lock_init(&devpriv->soft_reg_copy_lock); for (i = 0; i < NUM_PFI_CHANNELS; ++i) - devpriv->pfi_output_selects[i] = NI660X_IO_CFG_OUT_SEL_COUNTER; + devpriv->io_cfg[i] = NI_660X_PFI_OUTPUT_COUNTER; return 0; } @@ -817,7 +811,7 @@ static void ni_660x_select_pfi_output(struct comedi_device *dev, unsigned int bits; if (board->n_chips > 1) { - if (out_sel == NI660X_IO_CFG_OUT_SEL_COUNTER && + if (out_sel == NI_660X_PFI_OUTPUT_COUNTER && chan >= 8 && chan <= 23) { /* counters 4-7 pfi channels */ active_chip = 1; @@ -833,8 +827,7 @@ static void ni_660x_select_pfi_output(struct comedi_device *dev, /* 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); + bits |= NI660X_IO_CFG_OUT_SEL(chan, 0); /* high-z */ ni_660x_write(dev, idle_chip, bits, NI660X_IO_CFG(chan)); } @@ -850,22 +843,21 @@ static int ni_660x_set_pfi_routing(struct comedi_device *dev, { struct ni_660x_private *devpriv = dev->private; - if (source > NI660X_IO_CFG_OUT_SEL_MAX) - return -EINVAL; - if (source == NI660X_IO_CFG_OUT_SEL_HIGH_Z) - return -EINVAL; - if (chan < min_counter_pfi_chan) { - if (source == NI660X_IO_CFG_OUT_SEL_COUNTER) + switch (source) { + case NI_660X_PFI_OUTPUT_COUNTER: + if (chan < 8) return -EINVAL; - } else if (chan > max_dio_pfi_chan) { - if (source == NI660X_IO_CFG_OUT_SEL_DO) + break; + case NI_660X_PFI_OUTPUT_DIO: + if (chan > 31) return -EINVAL; + default: + return -EINVAL; } - devpriv->pfi_output_selects[chan] = source; - if (devpriv->pfi_direction_bits & (1ULL << chan)) - ni_660x_select_pfi_output(dev, chan, - devpriv->pfi_output_selects[chan]); + devpriv->io_cfg[chan] = source; + if (devpriv->io_dir & (1ULL << chan)) + ni_660x_select_pfi_output(dev, chan, devpriv->io_cfg[chan]);
[PATCH] Staging: rtl8192e: fix line length coding style issue in rtllib_softmac.c
This is a patch to the rtllib_softmac.c file that fixes up all instances of the 'line over 80 characters' warnings found by the checkpatch.pl tool. Signed-off-by: Yousof El-Sayed --- drivers/staging/rtl8192e/rtllib_softmac.c | 35 +++ 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index cfab715..9ba2230 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -389,7 +389,8 @@ static void rtllib_send_beacon(struct rtllib_device *ieee) if (ieee->beacon_txing && ieee->ieee_up) mod_timer(&ieee->beacon_timer, jiffies + - (msecs_to_jiffies(ieee->current_network.beacon_interval - 5))); + (msecs_to_jiffies + (ieee->current_network.beacon_interval - 5))); } @@ -601,7 +602,8 @@ static void rtllib_softmac_scan_wq(void *data) (ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER; if (ieee->scan_watch_dog++ > MAX_CHANNEL_NUMBER) { - if (!ieee->active_channel_map[ieee->current_network.channel]) + if (!ieee->active_channel_map[ieee-> + current_network.channel]) ieee->current_network.channel = 6; goto out; /* no good chans */ } @@ -1716,8 +1718,9 @@ inline void rtllib_softmac_new_net(struct rtllib_device *ieee, if (ieee->iw_mode == IW_MODE_INFRA) { /* Join the network for the first time */ ieee->AsocRetryCount = 0; - if ((ieee->current_network.qos_data.supported == 1) && - ieee->current_network.bssht.bdSupportHT) + if ((ieee->current_network.qos_data.supported + == 1) && + ieee->current_network.bssht.bdSupportHT) HTResetSelfAndSavePeerSetting(ieee, &(ieee->current_network)); else @@ -2044,8 +2047,8 @@ static short rtllib_sta_ps_sleep(struct rtllib_device *ieee, u64 *time) } *time = ieee->current_network.last_dtim_sta_time - + msecs_to_jiffies(ieee->current_network.beacon_interval * - LPSAwakeIntvl_tmp); + + msecs_to_jiffies(ieee-> + current_network.beacon_interval * LPSAwakeIntvl_tmp); } } @@ -2237,11 +2240,15 @@ inline int rtllib_rx_assoc_resp(struct rtllib_device *ieee, struct sk_buff *skb, ieee->assoc_id = aid; ieee->softmac_stats.rx_ass_ok++; /* station support qos */ - /* Let the register setting default with Legacy station */ - assoc_resp = (struct rtllib_assoc_response_frame *)skb->data; + /* Let the register setting default */ + /* with Legacy station */ + assoc_resp = (struct + rtllib_assoc_response_frame *)skb->data; if (ieee->current_network.qos_data.supported == 1) { - if (rtllib_parse_info_param(ieee, assoc_resp->info_element, - rx_stats->len - sizeof(*assoc_resp), + if (rtllib_parse_info_param + (ieee, assoc_resp->info_element, + rx_stats->len - sizeof + (*assoc_resp), network, rx_stats)) { kfree(network); return 1; @@ -2254,8 +2261,9 @@ inline int rtllib_rx_assoc_resp(struct rtllib_device *ieee, struct sk_buff *skb, network->bssht.bdHTInfoLen); if (ieee->handle_assoc_response != NULL) ieee->handle_assoc_response(ieee->dev, -(struct rtllib_assoc_response_frame *)header, -network); +(struct + rtllib_assoc_response_frame *) + header, network); } kfree(net
staging: most: warning: ‘mbo’ may be used uninitialized in this function
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? Other callers initialize the pointer to NULL, and check the returned length. > mutex_unlock(&c->io_mutex); > if (filp->f_flags & O_NONBLOCK) > return -EAGAIN; Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] drivers: staging: unisys: visornic: Fixed block comment coding style warnings
Fixed block comment checkpatch warnings. Signed-off-by: Gavin O'Leary --- drivers/staging/unisys/visornic/visornic_main.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c index 0519470..eefbacc 100644 --- a/drivers/staging/unisys/visornic/visornic_main.c +++ b/drivers/staging/unisys/visornic/visornic_main.c @@ -1315,12 +1315,14 @@ visornic_rx(struct uiscmdrsp *cmdrsp) } if (found_mc) break; /* accept packet, dest - matches a multicast - address */ +* matches a multicast +* address +*/ } } else if (skb->pkt_type == PACKET_HOST) { break; /* accept packet, h_dest must match vnic - mac address */ +* mac address +*/ } else if (skb->pkt_type == PACKET_OTHERHOST) { /* something is not right */ dev_err(&devdata->netdev->dev, @@ -1618,8 +1620,7 @@ service_resp_queue(struct uiscmdrsp *cmdrsp, struct visornic_devdata *devdata, unsigned long flags; struct net_device *netdev; - /* TODO: CLIENT ACQUIRE -- Don't really need this at the -* moment */ + /* TODO: CLIENT ACQUIRE -- Don't really need this at the moment */ for (;;) { if (!visorchannel_signalremove(devdata->dev->visorchannel, IOCHAN_FROM_IOPART, -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel