[PATCH 22/42] staging: comedi: ni_660x: tidy up ni_660x_dio_insn_bits()

2016-03-19 Thread H Hartley Sweeten
Use some local variables to clarify this function.

This (*insn_bits) function is a bit different from most comedi drivers.
Add some comments to clarify why the shifts are used.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_660x.c | 31 ---
 1 file changed, 20 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_660x.c 
b/drivers/staging/comedi/drivers/ni_660x.c
index f24009c..f614927 100644
--- a/drivers/staging/comedi/drivers/ni_660x.c
+++ b/drivers/staging/comedi/drivers/ni_660x.c
@@ -780,21 +780,30 @@ static void init_tio_chip(struct comedi_device *dev, int 
chipset)
 
 static int ni_660x_dio_insn_bits(struct comedi_device *dev,
 struct comedi_subdevice *s,
-struct comedi_insn *insn, unsigned int *data)
+struct comedi_insn *insn,
+unsigned int *data)
 {
-   unsigned int base_bitfield_channel = CR_CHAN(insn->chanspec);
+   unsigned int shift = CR_CHAN(insn->chanspec);
+   unsigned int mask = data[0] << shift;
+   unsigned int bits = data[1] << shift;
 
-   /*  Check if we have to write some bits */
-   if (data[0]) {
-   s->state &= ~(data[0] << base_bitfield_channel);
-   s->state |= (data[0] & data[1]) << base_bitfield_channel;
-   /* Write out the new digital output lines */
+   /*
+* There are 40 channels in this subdevice but only 32 are usable
+* as DIO. The shift adjusts the mask/bits to account for the base
+* channel in insn->chanspec. The state update can then be handled
+* normally for the 32 usable channels.
+*/
+   if (mask) {
+   s->state &= ~mask;
+   s->state |= (bits & mask);
ni_660x_write(dev, 0, s->state, NI660X_DIO32_OUTPUT);
}
-   /* on return, data[1] contains the value of the digital
-* input and output lines. */
-   data[1] = (ni_660x_read(dev, 0, NI660X_DIO32_INPUT) >>
-   base_bitfield_channel);
+
+   /*
+* Return the input channels, shifted back to account for the base
+* channel.
+*/
+   data[1] = ni_660x_read(dev, 0, NI660X_DIO32_INPUT) >> shift;
 
return insn->n;
 }
-- 
2.6.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 11/42] staging: comedi: ni_660x: tidy up ni_660x_write_register()

2016-03-19 Thread H Hartley Sweeten
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 | 42 +++-
 1 file changed, 20 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_660x.c 
b/drivers/staging/comedi/drivers/ni_660x.c
index 773147a..aa40ab6 100644
--- a/drivers/staging/comedi/drivers/ni_660x.c
+++ b/drivers/staging/comedi/drivers/ni_660x.c
@@ -504,9 +504,9 @@ static enum ni_660x_register ni_gpct_to_660x_register(enum 
ni_gpct_register reg)
}
 }
 
-static inline void ni_660x_write_register(struct comedi_device *dev,
- unsigned chip, unsigned bits,
- enum ni_660x_register reg)
+static void ni_660x_write(struct comedi_device *dev,
+ unsigned int chip, unsigned int bits,
+ enum ni_660x_register reg)
 {
unsigned int addr = GPCT_OFFSET[chip] + ni_660x_reg_data[reg].offset;
 
@@ -534,7 +534,7 @@ static void ni_gpct_write_register(struct ni_gpct *counter, 
unsigned bits,
enum ni_660x_register ni_660x_register = ni_gpct_to_660x_register(reg);
unsigned chip = counter->chip_index;
 
-   ni_660x_write_register(dev, chip, bits, ni_660x_register);
+   ni_660x_write(dev, chip, bits, ni_660x_register);
 }
 
 static unsigned ni_gpct_read_register(struct ni_gpct *counter,
@@ -569,9 +569,9 @@ static inline void ni_660x_set_dma_channel(struct 
comedi_device *dev,
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);
+   ni_660x_write(dev, chip, devpriv->dma_cfg[chip] |
+ NI660X_DMA_CFG_RESET(mite_channel),
+ NI660X_DMA_CFG);
mmiowb();
spin_unlock_irqrestore(>soft_reg_copy_lock, flags);
 }
@@ -587,8 +587,7 @@ static inline void ni_660x_unset_dma_channel(struct 
comedi_device *dev,
spin_lock_irqsave(>soft_reg_copy_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_register(dev, chip, devpriv->dma_cfg[chip],
-  NI660X_DMA_CFG);
+   ni_660x_write(dev, chip, devpriv->dma_cfg[chip], NI660X_DMA_CFG);
mmiowb();
spin_unlock_irqrestore(>soft_reg_copy_lock, flags);
 }
@@ -674,7 +673,7 @@ static void set_tio_counterswap(struct comedi_device *dev, 
int chip)
if (chip)
bits = NI660X_CLK_CFG_COUNTER_SWAP;
 
-   ni_660x_write_register(dev, chip, bits, NI660X_CLK_CFG);
+   ni_660x_write(dev, chip, bits, NI660X_CLK_CFG);
 }
 
 static void ni_660x_handle_gpct_interrupt(struct comedi_device *dev,
@@ -793,10 +792,9 @@ static void init_tio_chip(struct comedi_device *dev, int 
chipset)
devpriv->dma_cfg[chipset] = 0;
for (i = 0; i < MAX_DMA_CHANNEL; ++i)
devpriv->dma_cfg[chipset] |= NI660X_DMA_CFG_SEL_NONE(i);
-   ni_660x_write_register(dev, chipset, devpriv->dma_cfg[chipset],
-  NI660X_DMA_CFG);
+   ni_660x_write(dev, chipset, devpriv->dma_cfg[chipset], NI660X_DMA_CFG);
for (i = 0; i < NUM_PFI_CHANNELS; ++i)
-   ni_660x_write_register(dev, chipset, 0, NI660X_IO_CFG(i));
+   ni_660x_write(dev, chipset, 0, NI660X_IO_CFG(i));
 }
 
 static int ni_660x_dio_insn_bits(struct comedi_device *dev,
@@ -810,7 +808,7 @@ static int ni_660x_dio_insn_bits(struct comedi_device *dev,
s->state &= ~(data[0] << base_bitfield_channel);
s->state |= (data[0] & data[1]) << base_bitfield_channel;
/* Write out the new digital output lines */
-   ni_660x_write_register(dev, 0, s->state, NI660X_DIO32_OUTPUT);
+   ni_660x_write(dev, 0, s->state, NI660X_DIO32_OUTPUT);
}
/* on return, data[1] contains the value of the digital
 * input and output lines. */
@@ -852,8 +850,8 @@ static void ni_660x_select_pfi_output(struct comedi_device 
*dev,
idle_bits |=
NI660X_IO_CFG_OUT_SEL(pfi_channel,
  NI660X_IO_CFG_OUT_SEL_HIGH_Z);
-   ni_660x_write_register(dev, idle_chipset, idle_bits,
-  

RE: [PATCH] Drivers: hv: vmbus: handle various crash scenarios

2016-03-19 Thread KY Srinivasan


> -Original Message-
> From: Vitaly Kuznetsov [mailto:vkuzn...@redhat.com]
> Sent: Friday, March 18, 2016 5:33 AM
> To: de...@linuxdriverproject.org
> Cc: linux-ker...@vger.kernel.org; KY Srinivasan ;
> Haiyang Zhang ; Alex Ng (LIS)
> ; Radim Krcmar ; Cathy
> Avery 
> Subject: [PATCH] Drivers: hv: vmbus: handle various crash scenarios
> 
> Kdump keeps biting. Turns out CHANNELMSG_UNLOAD_RESPONSE is always
> delivered to CPU0 regardless of what CPU we're sending
> CHANNELMSG_UNLOAD
> from. vmbus_wait_for_unload() doesn't account for the fact that in case
> we're crashing on some other CPU and CPU0 is still alive and operational
> CHANNELMSG_UNLOAD_RESPONSE will be delivered there completing
> vmbus_connection.unload_event, our wait on the current CPU will never
> end.

What was the host you were testing on?

K. Y
> 
> Do the following:
> 1) Check for completion_done() in the loop. In case interrupt handler is
>still alive we'll get the confirmation we need.
> 
> 2) Always read CPU0's message page as CHANNELMSG_UNLOAD_RESPONSE
> will be
>delivered there. We can race with still-alive interrupt handler doing
>the same but we don't care as we're checking completion_done() now.
> 
> 3) Cleanup message pages on all CPUs. This is required (at least for the
>current CPU as we're clearing CPU0 messages now but we may want to
> bring
>up additional CPUs on crash) as new messages won't be delivered till we
>consume what's pending. On boot we'll place message pages somewhere
> else
>and we won't be able to read stale messages.
> 
> Signed-off-by: Vitaly Kuznetsov 
> ---
>  drivers/hv/channel_mgmt.c | 30 +-
>  1 file changed, 25 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
> index b10e8f74..5f37057 100644
> --- a/drivers/hv/channel_mgmt.c
> +++ b/drivers/hv/channel_mgmt.c
> @@ -512,14 +512,26 @@ static void init_vp_index(struct vmbus_channel
> *channel, const uuid_le *type_gui
> 
>  static void vmbus_wait_for_unload(void)
>  {
> - int cpu = smp_processor_id();
> - void *page_addr = hv_context.synic_message_page[cpu];
> + int cpu;
> + void *page_addr = hv_context.synic_message_page[0];
>   struct hv_message *msg = (struct hv_message *)page_addr +
> VMBUS_MESSAGE_SINT;
>   struct vmbus_channel_message_header *hdr;
>   bool unloaded = false;
> 
> - while (1) {
> + /*
> +  * CHANNELMSG_UNLOAD_RESPONSE is always delivered to CPU0.
> When we're
> +  * crashing on a different CPU let's hope that IRQ handler on CPU0 is
> +  * still functional and vmbus_unload_response() will complete
> +  * vmbus_connection.unload_event. If not, the last thing we can do
> is
> +  * read message page for CPU0 regardless of what CPU we're on.
> +  */
> + while (!unloaded) {
> + if (completion_done(_connection.unload_event)) {
> + unloaded = true;
> + break;
> + }
> +
>   if (READ_ONCE(msg->header.message_type) ==
> HVMSG_NONE) {
>   mdelay(10);
>   continue;
> @@ -530,9 +542,17 @@ static void vmbus_wait_for_unload(void)
>   unloaded = true;
> 
>   vmbus_signal_eom(msg);
> + }
> 
> - if (unloaded)
> - break;
> + /*
> +  * We're crashing and already got the UNLOAD_RESPONSE, cleanup
> all
> +  * maybe-pending messages on all CPUs to be able to receive new
> +  * messages after we reconnect.
> +  */
> + for_each_online_cpu(cpu) {
> + page_addr = hv_context.synic_message_page[cpu];
> + msg = (struct hv_message *)page_addr +
> VMBUS_MESSAGE_SINT;
> + msg->header.message_type = HVMSG_NONE;
>   }
>  }
> 
> --
> 2.5.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: most: Remove volatile usage

2016-03-19 Thread Greg KH
On Sat, Mar 12, 2016 at 02:11:10PM +0530, PrasannaKumar Muralidharan wrote:
> From: PrasannaKumar Muralidharan 
> 
> Remove unnecessary use of volatile for 'request_counter' and
> 'service_counter' members.
> 
> Signed-off-by: PrasannaKumar Muralidharan 
> ---
>  drivers/staging/most/hdm-dim2/dim2_hal.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.h 
> b/drivers/staging/most/hdm-dim2/dim2_hal.h
> index 1c924e8..ee10ed9 100644
> --- a/drivers/staging/most/hdm-dim2/dim2_hal.h
> +++ b/drivers/staging/most/hdm-dim2/dim2_hal.h
> @@ -40,10 +40,10 @@ struct dim_ch_state_t {
>  
>  struct int_ch_state {
>   /* changed only in interrupt context */
> - volatile int request_counter;
> + int request_counter;

Are you sure you can just remove these markings?  Does the code work the
same?  What is properly locking these values?  Why were they marked this
way in the first place?

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 9/9] rtlwifi: rtl8821ae: Fix Smatch warnings

2016-03-19 Thread Larry Finger
Smatch reports the following:

  CHECK   drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c:1960 
rtl8812ae_dm_txpower_tracking_callback_thermalmeter() warn: inconsistent 
indenting
  CHECK   drivers/net/wireless/realtek/rtlwifi/rtl8821ae/trx.c
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c:455 
phy_get_tx_swing_8812A() warn: inconsistent indenting
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c:517 
phy_get_tx_swing_8812A() warn: inconsistent indenting

Signed-off-by: Larry Finger 
---
 drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c  | 6 +++---
 drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c
index 7b13962..636f3d1 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c
@@ -1957,9 +1957,9 @@ void rtl8812ae_dm_txpower_tracking_callback_thermalmeter(
rtldm->swing_idx_ofdm_base[p] =
rtldm->swing_idx_ofdm[p];
 
-   RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
-"pDM_Odm->RFCalibrateInfo.ThermalValue =%d 
ThermalValue= %d\n",
-rtldm->thermalvalue, thermal_value);
+   RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD,
+"pDM_Odm->RFCalibrateInfo.ThermalValue =%d 
ThermalValue= %d\n",
+rtldm->thermalvalue, thermal_value);
/*Record last Power Tracking Thermal Value*/
rtldm->thermalvalue = thermal_value;
}
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
index 74165b3..ddf74d5 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
@@ -418,9 +418,9 @@ u32 phy_get_tx_swing_8812A(struct ieee80211_hw *hw, u8  
band,
out = 0x16A; /* -3 dB */
}
} else {
-   u32 swing = 0, swing_a = 0, swing_b = 0;
+   u32 swing = 0, swing_a = 0, swing_b = 0;
 
-   if (band == BAND_ON_2_4G) {
+   if (band == BAND_ON_2_4G) {
if (reg_swing_2g == auto_temp) {
efuse_shadow_read(hw, 1, 0xC6, (u32 *));
swing = (swing == 0xFF) ? 0x00 : swing;
@@ -514,7 +514,7 @@ u32 phy_get_tx_swing_8812A(struct ieee80211_hw *hw, u8  
band,
 
RT_TRACE(rtlpriv, COMP_SCAN, DBG_LOUD,
 "<=== PHY_GetTxBBSwing_8812A, out = 0x%X\n", out);
-return out;
+   return out;
 }
 
 void rtl8821ae_phy_switch_wirelessband(struct ieee80211_hw *hw, u8 band)
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3] staging: netlogic: Fixed alignment of parentheseis checkpatch warning

2016-03-19 Thread Parth Sane
Hi,
Thanks for pointing out that the changes have been done. Nevertheless this was 
a good learning exercise. How do I check which changes have already been done? 
I’m planning to send in another patch on a blank line warning on the same file. 
I don’t want to overburden the mailing list by repeating work. I apologise for 
any inconvenience.
Regards,
Parth Sane




signature.asc
Description: Message signed with OpenPGP using GPGMail
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: netlogic: Fixed alignment of parentheseis checkpatch warning line#186

2016-03-19 Thread Parth Sane
Fixed checkpatch warnings about parenthesis alignment at line #186.

Signed-off-by: Parth Sane 

---
 drivers/staging/netlogic/platform_net.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/netlogic/platform_net.c 
b/drivers/staging/netlogic/platform_net.c
index c967543..a2941a0 100644
--- a/drivers/staging/netlogic/platform_net.c
+++ b/drivers/staging/netlogic/platform_net.c
@@ -183,8 +183,8 @@ static void xls_gmac_init(void)
ndata0.phy_addr[mac] = mac + 0x10;
 
xlr_resource_init(_net0_res[mac * 2],
-   xlr_gmac_offsets[mac],
-   xlr_gmac_irqs[mac]);
+ xlr_gmac_offsets[mac],
+ xlr_gmac_irqs[mac]);
}
xlr_net_dev0.num_resources = 8;
platform_device_register(_net_dev0);
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: comedi: dt282x: tidy up register bit defines

2016-03-19 Thread Arnd Bergmann
On Thursday 17 March 2016 10:10:40 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 
> 

Tested-by: Arnd Bergmann 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: netlogic: Fixed alignment of parantheseis checkpatch warning

2016-03-19 Thread Parth Sane
Fixed alignment of paranthesis as per checkpatch. Please ignore earlier sent 
patch for paranthesis check and use this one. 
Signed-off-by: Parth Sane 

---
 drivers/staging/netlogic/platform_net.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/netlogic/platform_net.c 
b/drivers/staging/netlogic/platform_net.c
index daee1b2..dde20d5 100644
--- a/drivers/staging/netlogic/platform_net.c
+++ b/drivers/staging/netlogic/platform_net.c
@@ -120,10 +120,9 @@ static struct platform_device *gmac_controller2_init(void 
*gmac0_addr)
for (mac = 0; mac < 4; mac++) {
ndata1.tx_stnid[mac] = FMN_STNID_GMAC1_TX0 + mac;
ndata1.phy_addr[mac] = mac + 4 + 0x10;
-
xlr_resource_init(_net1_res[mac * 2],
-   xlr_gmac_offsets[mac + 4],
-   xlr_gmac_irqs[mac + 4]);
+ 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


Re: staging: most: warning: ‘mbo’ may be used uninitialized in this function

2016-03-19 Thread Dan Carpenter
On Fri, Mar 18, 2016 at 01:41:19PM +0100, Geert Uytterhoeven wrote:
> > @@ -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(>io_mutex);
> > -   if (c->stacked_mbo) {
> > -   mbo = c->stacked_mbo;
> > -   goto start_copy;
> > -   }
> > -   while ((!kfifo_out(>fifo, , 1)) && (c->dev)) {
> > +   while (c->dev && !kfifo_peek(>fifo, )) {
> 
> 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.
> 

It looks like a false positive to me.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] [media] media: rename media unregister function

2016-03-19 Thread Shuah Khan
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.

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: staging: add Lustre file system client support

2016-03-19 Thread Dan Carpenter
Hello Peng Tao,

The patch d7e09d0397e8: "staging: add Lustre file system client
support" from May 2, 2013, leads to the following static checker
warning:

drivers/staging/lustre/lustre/obdecho/echo_client.c:1040 
cl_echo_enqueue0()
error: 'lck' dereferencing possible ERR_PTR()

drivers/staging/lustre/lustre/obdecho/echo_client.c
  1034  
  1035  lck = cl_lock_request(env, io, descr, "ec enqueue", eco);
  ^^^
This can return either an ERR_PTR or NULL.  It's not clear from the
documentation what that means.  There is actually some documentation
for this function though so that's good.


  1036  if (lck) {
^^^
Ugh.  Success handling.

  1037  struct echo_client_obd *ec = eco->eo_dev->ed_ec;
  1038  struct echo_lock *el;
  1039  
  1040  rc = cl_wait(env, lck);
  1041  if (rc == 0) {
^^^
More success handling and nested indents.  If we flip these around to
test for failure instead the code becomes much clearer.

  1042  el = cl2echo_lock(cl_lock_at(lck, 
_device_type));
  1043  spin_lock(>ec_lock);
  1044  if (list_empty(>el_chain)) {
  1045  list_add(>el_chain, >ec_locks);
  1046  el->el_cookie = ++ec->ec_unique;
  1047  }
  1048  atomic_inc(>el_refcount);
  1049  *cookie = el->el_cookie;
  1050  spin_unlock(>ec_lock);
  1051  } else {
  1052  cl_lock_release(env, lck, "ec enqueue", 
current);
  1053  }
  1054  }
  1055  return rc;
  1056  }

regards,
dan carpenter
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: rtl8192e: fixed coding style issues

2016-03-19 Thread Yousof El-Sayed
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

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


Re: [PATCH v2] staging/comedi/dt282x: avoid integer overflow warning

2016-03-19 Thread Arnd Bergmann
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.

> > 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))

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.

> Also, most of the comedi drivers use the BIT() macro. Are you planning on
> changing all of them to use hexadecimal notation?

No.

Arnd
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [lustre-devel] [patch] staging: lustre: checking for NULL instead of IS_ERR

2016-03-19 Thread Dilger, Andreas
On 2016/03/18, 13:28, "lustre-devel on behalf of Dilger, Andreas"
 wrote:

>On 2016/03/17, 23:42, "Dan Carpenter"  wrote:
>
>>lustre_cfg_new() returns error pointers on error, it never returns NULL.

Hmm, looking at the broader context, I see there are other callers of
lustre_cfg_new() that are checking for NULL, and in some cases not
checking the return code at all.

I'm not sure why Peng Tao changed the return value of this function to
ERR_PTR() instead of NULL, but it may be better to have lustre_cfg_new()
return NULL on failure to avoid changing more code, and because it is
essentially an alloc+init function and the only error it could ever
return is -ENOMEM and typically allocator functions return NULL.

Cheers, Andreas

>>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, );
>>- 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
>
>
>___
>lustre-devel mailing list
>lustre-de...@lists.lustre.org
>http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
>


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


[PATCH 15/42] staging: comedi: ni_660x: remove BUG_ON() in ni_660x_request_mite_channel()

2016-03-19 Thread H Hartley Sweeten
This BUG_ON() happens if a mite DMA channel is already requested when an
ansynchronous command is started for one of the counter subdevices.

The comedi core will only call the (*do_cmd) if the subdevice is not busy.
In this driver, the (*cancel) for the subdevice will always release any
requested mite DMA channel.

Remove the BUG_ON() which can never occur.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_660x.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/ni_660x.c 
b/drivers/staging/comedi/drivers/ni_660x.c
index 79678af..232c897 100644
--- a/drivers/staging/comedi/drivers/ni_660x.c
+++ b/drivers/staging/comedi/drivers/ni_660x.c
@@ -599,7 +599,6 @@ static int ni_660x_request_mite_channel(struct 
comedi_device *dev,
struct mite_channel *mite_chan;
 
spin_lock_irqsave(>mite_channel_lock, flags);
-   BUG_ON(counter->mite_chan);
mite_chan = mite_request_channel(devpriv->mite,
 mite_ring(devpriv, counter));
if (!mite_chan) {
-- 
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-19 Thread Radim Krcmar
2016-03-18 16:53+0100, Vitaly Kuznetsov:
> Radim Krcmar  writes:
>> 2016-03-18 13:33+0100, Vitaly Kuznetsov:
>>> @@ -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?)
>>
> 
> Sure, but we'll have to use a variable for that ... why would it be
> better than 'unloaded'?

It's easier to understand IMO,

  x = mem   |  x = mem
  if *x == sth  |  z = *x
u = true|
  eoi() |  eoi()
  if u  |  if z == sth
break   |   break

And you can replace msg with the new variable,

 z = *mem
 eoi()
 if z == sth
   break

>> Can't this be NULL?
> 
> It can't, we allocate it from hv_synic_alloc() (and we don't support cpu
> onlining/offlining on WS2012R2+).

Reviewed-by: Radim Krčmář 

Thanks.

>>> +   msg = (struct hv_message *)page_addr + VMBUS_MESSAGE_SINT;
>>> +   msg->header.message_type = HVMSG_NONE;
>>> }
>>
>> (And, this block belongs to a separate function. ;])
> 
> I thought about moving it to hv_crash_handler() but then I decided to
> leave it here as the need for this fixup is rather an artifact of how we
> recieve the message. But I'm flexible here)

Ok, clearing all VCPUs made me think that it would be generally useful.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v9 2/3] kernel.h: add to_user_ptr()

2016-03-19 Thread Gustavo Padovan
From: Gustavo Padovan 

This function had copies in 3 different files. Unify them in kernel.h.

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 | 5 -
 drivers/gpu/drm/i915/i915_drv.h  | 5 -
 drivers/gpu/drm/msm/msm_gem_submit.c | 5 -
 include/linux/kernel.h   | 5 +
 4 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c 
b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
index 1aba01a..b1fafb6 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)
 {
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/msm/msm_gem_submit.c 
b/drivers/gpu/drm/msm/msm_gem_submit.c
index 6d7cd3f..e9c8b96 100644
--- a/drivers/gpu/drm/msm/msm_gem_submit.c
+++ b/drivers/gpu/drm/msm/msm_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 msm_gem_submit *submit_create(struct drm_device *dev,
struct msm_gpu *gpu, int nr)
 {
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index f31638c..c0a6001 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -53,6 +53,11 @@
 
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
 
+static inline void __user *to_user_ptr(u64 address)
+{
+   return (void __user *)(uintptr_t)address;
+}
+
 /*
  * This looks more complex than it should be. But we need to
  * get the type for the ~ right in round_down (it needs to be
-- 
2.5.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: rtl8192e: fixed coding style issues

2016-03-19 Thread Greg KH
On Thu, Mar 17, 2016 at 04:55:37PM +, Yousof El-Sayed wrote:
> Signed-off-by: Yousof El-Sayed 

I can't take patches without any changelog entry, sorry.

And be specific about what and why you are changing anything, "coding
style issues" is very vague.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [GIT PULL] Staging driver patches for 4.6-rc1

2016-03-19 Thread Greg KH
On Thu, Mar 17, 2016 at 10:19:04PM -0700, Linus Torvalds wrote:
> On Thu, Mar 17, 2016 at 8:25 PM, Greg KH  wrote:
> > Ok, the diffstat below seems "odd" in that I had done a merge with my
> > char-misc tree to resolve some merge issues a while ago, and that tree
> > is now in your tree, so the diffstat shouldn't be showing it (I updated
> > my master branch), but somehow it is.
> 
> When there isn't a single well-defined common base for the merge
> (which happens when you cross-merge, but also if you have multiple
> different bases internally and then merge inside one branch), the "git
> diff" output will pick one of the (multiple) common bases, and use
> that as the base of the diff.
> 
> That usually works fine, but it can also give wildly wrong diffstat
> results, simply because the only way to get the final real diff would
> be to just do the merge.

Ah, ok, that makes more sense, thanks.

> > Also, there are a number of conflicts here when merging with your tree.
> > both modified:   drivers/media/dvb-frontends/mn88473.c
> > deleted by them: drivers/staging/dgap/dgap.c
> > both modified:   
> > drivers/staging/lustre/lnet/libcfs/linux/linux-crypto.c
> > both modified:   
> > drivers/staging/media/davinci_vpfe/davinci_vpfe_user.h
> > both modified:   include/linux/irqdomain.h
> >
> > I can fix these up and resend this with a merged tree pull request if
> > you want me to, it's your call.
> 
> No, all good. I've already merged it, I'm just waiting for the build
> test to finish before pushing out the end result.
> 
> You might want to double-check the end result, but nothing looked
> particularly odd.

All looks good, thanks for doing the merge.

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 25/42] staging: comedi: ni_660x: refactor ni_gpct_to_660x_register()

2016-03-19 Thread H Hartley Sweeten
Convert this big switch into an array and refactor ni_660x_gpct_{write,read}()
functions to use the array to find the register offset.

All the TIO (GPCT) registers are included in the array except for NITIO_G0_ABZ
and NITIO_G1_ABZ. These registers only exist on the ni_pcimio m-series boards
and this driver will never read/write them.

Just in case someone adds a new entry to the enum ni_gpct_register in ni_tio.h,
add a dev_warn() for any unhandled registers.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_660x.c | 236 ---
 1 file changed, 89 insertions(+), 147 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_660x.c 
b/drivers/staging/comedi/drivers/ni_660x.c
index 6f84946..3edea99 100644
--- a/drivers/staging/comedi/drivers/ni_660x.c
+++ b/drivers/staging/comedi/drivers/ni_660x.c
@@ -279,6 +279,77 @@ static const struct ni_660x_register_data 
ni_660x_reg_data[NI660X_NUM_REGS] = {
[NI660X_IO_CFG_38_39]   = { 0x7a2, 2 }  /* read/write */
 };
 
+static const enum ni_660x_register ni_gpct_to_660x_register[] = {
+   [NITIO_G0_AUTO_INC] = NI660X_G0_AUTO_INC,
+   [NITIO_G1_AUTO_INC] = NI660X_G1_AUTO_INC,
+   [NITIO_G2_AUTO_INC] = NI660X_G2_AUTO_INC,
+   [NITIO_G3_AUTO_INC] = NI660X_G3_AUTO_INC,
+   [NITIO_G0_CMD]  = NI660X_G0_CMD,
+   [NITIO_G1_CMD]  = NI660X_G1_CMD,
+   [NITIO_G2_CMD]  = NI660X_G2_CMD,
+   [NITIO_G3_CMD]  = NI660X_G3_CMD,
+   [NITIO_G0_HW_SAVE]  = NI660X_G0_HW_SAVE,
+   [NITIO_G1_HW_SAVE]  = NI660X_G1_HW_SAVE,
+   [NITIO_G2_HW_SAVE]  = NI660X_G2_HW_SAVE,
+   [NITIO_G3_HW_SAVE]  = NI660X_G3_HW_SAVE,
+   [NITIO_G0_SW_SAVE]  = NI660X_G0_SW_SAVE,
+   [NITIO_G1_SW_SAVE]  = NI660X_G1_SW_SAVE,
+   [NITIO_G2_SW_SAVE]  = NI660X_G2_SW_SAVE,
+   [NITIO_G3_SW_SAVE]  = NI660X_G3_SW_SAVE,
+   [NITIO_G0_MODE] = NI660X_G0_MODE,
+   [NITIO_G1_MODE] = NI660X_G1_MODE,
+   [NITIO_G2_MODE] = NI660X_G2_MODE,
+   [NITIO_G3_MODE] = NI660X_G3_MODE,
+   [NITIO_G0_LOADA]= NI660X_G0_LOADA,
+   [NITIO_G1_LOADA]= NI660X_G1_LOADA,
+   [NITIO_G2_LOADA]= NI660X_G2_LOADA,
+   [NITIO_G3_LOADA]= NI660X_G3_LOADA,
+   [NITIO_G0_LOADB]= NI660X_G0_LOADB,
+   [NITIO_G1_LOADB]= NI660X_G1_LOADB,
+   [NITIO_G2_LOADB]= NI660X_G2_LOADB,
+   [NITIO_G3_LOADB]= NI660X_G3_LOADB,
+   [NITIO_G0_INPUT_SEL]= NI660X_G0_INPUT_SEL,
+   [NITIO_G1_INPUT_SEL]= NI660X_G1_INPUT_SEL,
+   [NITIO_G2_INPUT_SEL]= NI660X_G2_INPUT_SEL,
+   [NITIO_G3_INPUT_SEL]= NI660X_G3_INPUT_SEL,
+   [NITIO_G0_CNT_MODE] = NI660X_G0_CNT_MODE,
+   [NITIO_G1_CNT_MODE] = NI660X_G1_CNT_MODE,
+   [NITIO_G2_CNT_MODE] = NI660X_G2_CNT_MODE,
+   [NITIO_G3_CNT_MODE] = NI660X_G3_CNT_MODE,
+   [NITIO_G0_GATE2]= NI660X_G0_GATE2,
+   [NITIO_G1_GATE2]= NI660X_G1_GATE2,
+   [NITIO_G2_GATE2]= NI660X_G2_GATE2,
+   [NITIO_G3_GATE2]= NI660X_G3_GATE2,
+   [NITIO_G01_STATUS]  = NI660X_G01_STATUS,
+   [NITIO_G23_STATUS]  = NI660X_G23_STATUS,
+   [NITIO_G01_RESET]   = NI660X_G01_RESET,
+   [NITIO_G23_RESET]   = NI660X_G23_RESET,
+   [NITIO_G01_STATUS1] = NI660X_G01_STATUS1,
+   [NITIO_G23_STATUS1] = NI660X_G23_STATUS1,
+   [NITIO_G01_STATUS2] = NI660X_G01_STATUS2,
+   [NITIO_G23_STATUS2] = NI660X_G23_STATUS2,
+   [NITIO_G0_DMA_CFG]  = NI660X_G0_DMA_CFG,
+   [NITIO_G1_DMA_CFG]  = NI660X_G1_DMA_CFG,
+   [NITIO_G2_DMA_CFG]  = NI660X_G2_DMA_CFG,
+   [NITIO_G3_DMA_CFG]  = NI660X_G3_DMA_CFG,
+   [NITIO_G0_DMA_STATUS]   = NI660X_G0_DMA_STATUS,
+   [NITIO_G1_DMA_STATUS]   = NI660X_G1_DMA_STATUS,
+   [NITIO_G2_DMA_STATUS]   = NI660X_G2_DMA_STATUS,
+   [NITIO_G3_DMA_STATUS]   = NI660X_G3_DMA_STATUS,
+   [NITIO_G0_INT_ACK]  = NI660X_G0_INT_ACK,
+   [NITIO_G1_INT_ACK]  = NI660X_G1_INT_ACK,
+   [NITIO_G2_INT_ACK]  = NI660X_G2_INT_ACK,
+   [NITIO_G3_INT_ACK]  = NI660X_G3_INT_ACK,
+   [NITIO_G0_STATUS]   = NI660X_G0_STATUS,
+   [NITIO_G1_STATUS]   = NI660X_G1_STATUS,
+   

[PATCH 10/42] staging: comedi: ni_660x: cleanup the NI660X_GLOBAL_INT_{STATUS, CFG}

2016-03-19 Thread H Hartley Sweeten
Remove the enums global_interrupt_{status,config}_register_bits and
add defines for the CamelCase values.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_660x.c | 27 ++-
 1 file changed, 10 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_660x.c 
b/drivers/staging/comedi/drivers/ni_660x.c
index 0b37982..773147a 100644
--- a/drivers/staging/comedi/drivers/ni_660x.c
+++ b/drivers/staging/comedi/drivers/ni_660x.c
@@ -157,6 +157,14 @@ enum ni_660x_register {
 
 #define NI660X_CLK_CFG_COUNTER_SWAPBIT(21)
 
+#define NI660X_GLOBAL_INT_COUNTER0 BIT(8)
+#define NI660X_GLOBAL_INT_COUNTER1 BIT(9)
+#define NI660X_GLOBAL_INT_COUNTER2 BIT(10)
+#define NI660X_GLOBAL_INT_COUNTER3 BIT(11)
+#define NI660X_GLOBAL_INT_CASCADE  BIT(29)
+#define NI660X_GLOBAL_INT_GLOBAL_POL   BIT(30)
+#define NI660X_GLOBAL_INT_GLOBAL   BIT(31)
+
 #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)
@@ -287,21 +295,6 @@ static const struct ni_660x_register_data 
ni_660x_reg_data[NI660X_NUM_REGS] = {
[NI660X_IO_CFG_38_39]   = { 0x7a2, 2 }  /* read/write */
 };
 
-enum global_interrupt_status_register_bits {
-   Counter_0_Int_Bit = 0x100,
-   Counter_1_Int_Bit = 0x200,
-   Counter_2_Int_Bit = 0x400,
-   Counter_3_Int_Bit = 0x800,
-   Cascade_Int_Bit = 0x2000,
-   Global_Int_Bit = 0x8000
-};
-
-enum global_interrupt_config_register_bits {
-   Cascade_Int_Enable_Bit = 0x2000,
-   Global_Int_Polarity_Bit = 0x4000,
-   Global_Int_Enable_Bit = 0x8000
-};
-
 /* Offset of the GPCT chips from the base-address of the card */
 /* First chip is at base-address + 0x00, etc. */
 static const unsigned GPCT_OFFSET[2] = { 0x0, 0x800 };
@@ -1072,9 +1065,9 @@ static int ni_660x_auto_attach(struct comedi_device *dev,
return ret;
}
dev->irq = pcidev->irq;
-   global_interrupt_config_bits = Global_Int_Enable_Bit;
+   global_interrupt_config_bits = NI660X_GLOBAL_INT_GLOBAL;
if (board->n_chips > 1)
-   global_interrupt_config_bits |= Cascade_Int_Enable_Bit;
+   global_interrupt_config_bits |= NI660X_GLOBAL_INT_CASCADE;
ni_660x_write_register(dev, 0, global_interrupt_config_bits,
   NI660X_GLOBAL_INT_CFG);
 
-- 
2.6.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH] staging: lustre: really make lustre dependent on LNet

2016-03-19 Thread Simmons, James A.
>A patch intended to add a dependency on LNET for lustre didn't
>actually do that and instead allowed configurations that contain
>lustre with lnet but without IPv4 support that subsequently
>fail to link:
>
>warning: (LUSTRE_FS) selects LNET which has unmet direct dependencies (STAGING 
>&& INET && m && MODULES)
>ERROR: "kernel_sendmsg" [drivers/staging/lustre/lnet/lnet/lnet.ko] undefined!
>ERROR: "sock_create_lite" [drivers/staging/lustre/lnet/lnet/lnet.ko] undefined!
>ERROR: "sock_release" [drivers/staging/lustre/lnet/lnet/lnet.ko] undefined!
>ERROR: "release_sock" [drivers/staging/lustre/lnet/klnds/socklnd/ksocklnd.ko] 
>undefined!
>ERROR: "kernel_sendmsg" 
>[drivers/staging/lustre/lnet/klnds/socklnd/ksocklnd.ko] undefined!
>ERROR: "tcp_sendpage" [drivers/staging/lustre/lnet/klnds/socklnd/ksocklnd.ko] 
>undefined!
>
>This adds the one-line change that was evidently missing from the
>commit, doing what was intended there to have a correct set of dependencies.
>
>Signed-off-by: Arnd Bergmann 
>Fixes: b08bb6bb5af5 ("staging: lustre: make lustre dependent on LNet")

Thanks for fixing that. I was surprised that select didn't manage the 
configuration automatically.

Acked-by: James Simmons 

>---
> drivers/staging/lustre/lustre/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/staging/lustre/lustre/Kconfig 
>b/drivers/staging/lustre/lustre/Kconfig
>index a09b51ce8265..8ac7cd4d6fdb 100644
>--- a/drivers/staging/lustre/lustre/Kconfig
>+++ b/drivers/staging/lustre/lustre/Kconfig
>@@ -1,7 +1,7 @@
> config LUSTRE_FS
>   tristate "Lustre file system client support"
>   depends on m && !MIPS && !XTENSA && !SUPERH
>-  select LNET
>+  depends on LNET
>   select CRYPTO
>   select CRYPTO_CRC32
>   select CRYPTO_CRC32_PCLMUL if X86
>-- 
>2.7.0
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 02/42] staging: comedi: ni_660x: remove struct NI_660xRegisterData 'name'

2016-03-19 Thread H Hartley Sweeten
This member of the struct is not used, and just takes up space. Remove it.
Instead, add the enum ni_660x_register indexes to the table to clarify, and
document, the entries.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_660x.c | 197 +++
 1 file changed, 98 insertions(+), 99 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_660x.c 
b/drivers/staging/comedi/drivers/ni_660x.c
index 10db2ff..10bb839 100644
--- a/drivers/staging/comedi/drivers/ni_660x.c
+++ b/drivers/staging/comedi/drivers/ni_660x.c
@@ -187,111 +187,110 @@ static inline unsigned NI_660X_GPCT_SUBDEV(unsigned 
index)
 }
 
 struct NI_660xRegisterData {
-   const char *name;   /*  Register Name */
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 */
 };
 
 static const struct NI_660xRegisterData registerData[NI660X_NUM_REGS] = {
-   {"G0 Interrupt Acknowledge", 0x004, NI_660x_WRITE, DATA_2B},
-   {"G0 Status Register", 0x004, NI_660x_READ, DATA_2B},
-   {"G1 Interrupt Acknowledge", 0x006, NI_660x_WRITE, DATA_2B},
-   {"G1 Status Register", 0x006, NI_660x_READ, DATA_2B},
-   {"G01 Status Register ", 0x008, NI_660x_READ, DATA_2B},
-   {"G0 Command Register", 0x00C, NI_660x_WRITE, DATA_2B},
-   {"STC DIO Parallel Input", 0x00E, NI_660x_READ, DATA_2B},
-   {"G1 Command Register", 0x00E, NI_660x_WRITE, DATA_2B},
-   {"G0 HW Save Register", 0x010, NI_660x_READ, DATA_4B},
-   {"G1 HW Save Register", 0x014, NI_660x_READ, DATA_4B},
-   {"STC DIO Output", 0x014, NI_660x_WRITE, DATA_2B},
-   {"STC DIO Control", 0x016, NI_660x_WRITE, DATA_2B},
-   {"G0 SW Save Register", 0x018, NI_660x_READ, DATA_4B},
-   {"G1 SW Save Register", 0x01C, NI_660x_READ, DATA_4B},
-   {"G0 Mode Register", 0x034, NI_660x_WRITE, DATA_2B},
-   {"G01 Joint Status 1 Register", 0x036, NI_660x_READ, DATA_2B},
-   {"G1 Mode Register", 0x036, NI_660x_WRITE, DATA_2B},
-   {"STC DIO Serial Input", 0x038, NI_660x_READ, DATA_2B},
-   {"G0 Load A Register", 0x038, NI_660x_WRITE, DATA_4B},
-   {"G01 Joint Status 2 Register", 0x03A, NI_660x_READ, DATA_2B},
-   {"G0 Load B Register", 0x03C, NI_660x_WRITE, DATA_4B},
-   {"G1 Load A Register", 0x040, NI_660x_WRITE, DATA_4B},
-   {"G1 Load B Register", 0x044, NI_660x_WRITE, DATA_4B},
-   {"G0 Input Select Register", 0x048, NI_660x_WRITE, DATA_2B},
-   {"G1 Input Select Register", 0x04A, NI_660x_WRITE, DATA_2B},
-   {"G0 Autoincrement Register", 0x088, NI_660x_WRITE, DATA_2B},
-   {"G1 Autoincrement Register", 0x08A, NI_660x_WRITE, DATA_2B},
-   {"G01 Joint Reset Register", 0x090, NI_660x_WRITE, DATA_2B},
-   {"G0 Interrupt Enable", 0x092, NI_660x_WRITE, DATA_2B},
-   {"G1 Interrupt Enable", 0x096, NI_660x_WRITE, DATA_2B},
-   {"G0 Counting Mode Register", 0x0B0, NI_660x_WRITE, DATA_2B},
-   {"G1 Counting Mode Register", 0x0B2, NI_660x_WRITE, DATA_2B},
-   {"G0 Second Gate Register", 0x0B4, NI_660x_WRITE, DATA_2B},
-   {"G1 Second Gate Register", 0x0B6, NI_660x_WRITE, DATA_2B},
-   {"G0 DMA Config Register", 0x0B8, NI_660x_WRITE, DATA_2B},
-   {"G0 DMA Status Register", 0x0B8, NI_660x_READ, DATA_2B},
-   {"G1 DMA Config Register", 0x0BA, NI_660x_WRITE, DATA_2B},
-   {"G1 DMA Status Register", 0x0BA, NI_660x_READ, DATA_2B},
-   {"G2 Interrupt Acknowledge", 0x104, NI_660x_WRITE, DATA_2B},
-   {"G2 Status Register", 0x104, NI_660x_READ, DATA_2B},
-   {"G3 Interrupt Acknowledge", 0x106, NI_660x_WRITE, DATA_2B},
-   {"G3 Status Register", 0x106, NI_660x_READ, DATA_2B},
-   {"G23 Status Register", 0x108, NI_660x_READ, DATA_2B},
-   {"G2 Command Register", 0x10C, NI_660x_WRITE, DATA_2B},
-   {"G3 Command Register", 0x10E, NI_660x_WRITE, DATA_2B},
-   {"G2 HW Save Register", 0x110, NI_660x_READ, DATA_4B},
-   {"G3 HW Save Register", 0x114, NI_660x_READ, DATA_4B},
-   {"G2 SW Save Register", 0x118, NI_660x_READ, DATA_4B},
-   {"G3 SW Save Register", 0x11C, NI_660x_READ, DATA_4B},
-   {"G2 Mode Register", 0x134, NI_660x_WRITE, DATA_2B},
-   {"G23 Joint Status 1 Register", 0x136, NI_660x_READ, DATA_2B},
-   {"G3 Mode Register", 0x136, NI_660x_WRITE, DATA_2B},
-   {"G2 Load A Register", 0x138, NI_660x_WRITE, DATA_4B},
-   {"G23 Joint Status 2 Register", 0x13A, NI_660x_READ, DATA_2B},
-   {"G2 Load B Register", 0x13C, NI_660x_WRITE, DATA_4B},
-   {"G3 Load A Register", 0x140, NI_660x_WRITE, DATA_4B},
-   {"G3 Load B Register", 0x144, NI_660x_WRITE, DATA_4B},
-   {"G2 Input Select Register", 0x148, NI_660x_WRITE, DATA_2B},
-   {"G3 Input Select Register", 0x14A, NI_660x_WRITE, DATA_2B},
-   

[patch] staging: lustre: checking for NULL instead of IS_ERR

2016-03-19 Thread Dan Carpenter
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, );
-   if (!lcfg) {
+   if (IS_ERR(lcfg)) {
CERROR("mgc: cannot allocate memory\n");
break;
}
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 07/42] staging: comedi: ni_660x: tidy up multi-line comment

2016-03-19 Thread H Hartley Sweeten
Reformat the multi-line comment in the kernel CodingStyle.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_660x.c | 25 -
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_660x.c 
b/drivers/staging/comedi/drivers/ni_660x.c
index 75c6032..ab761aa 100644
--- a/drivers/staging/comedi/drivers/ni_660x.c
+++ b/drivers/staging/comedi/drivers/ni_660x.c
@@ -1,17 +1,16 @@
 /*
-  comedi/drivers/ni_660x.c
-  Hardware driver for NI 660x devices
-
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-*/
+ * Hardware driver for NI 660x devices
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
 
 /*
  * Driver: ni_660x
-- 
2.6.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [GIT PULL] Staging driver patches for 4.6-rc1

2016-03-19 Thread Linus Torvalds
On Thu, Mar 17, 2016 at 8:25 PM, Greg KH  wrote:
> Ok, the diffstat below seems "odd" in that I had done a merge with my
> char-misc tree to resolve some merge issues a while ago, and that tree
> is now in your tree, so the diffstat shouldn't be showing it (I updated
> my master branch), but somehow it is.

When there isn't a single well-defined common base for the merge
(which happens when you cross-merge, but also if you have multiple
different bases internally and then merge inside one branch), the "git
diff" output will pick one of the (multiple) common bases, and use
that as the base of the diff.

That usually works fine, but it can also give wildly wrong diffstat
results, simply because the only way to get the final real diff would
be to just do the merge.

> Also, there are a number of conflicts here when merging with your tree.
> both modified:   drivers/media/dvb-frontends/mn88473.c
> deleted by them: drivers/staging/dgap/dgap.c
> both modified:   
> drivers/staging/lustre/lnet/libcfs/linux/linux-crypto.c
> both modified:   
> drivers/staging/media/davinci_vpfe/davinci_vpfe_user.h
> both modified:   include/linux/irqdomain.h
>
> I can fix these up and resend this with a merged tree pull request if
> you want me to, it's your call.

No, all good. I've already merged it, I'm just waiting for the build
test to finish before pushing out the end result.

You might want to double-check the end result, but nothing looked
particularly odd.

 Linus
___
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

2016-03-19 Thread KY Srinivasan


> -Original Message-
> From: James Bottomley [mailto:james.bottom...@hansenpartnership.com]
> Sent: Wednesday, March 16, 2016 4:41 PM
> To: KY Srinivasan ; Martin K. Petersen
> 
> 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 23:15 +, KY Srinivasan wrote:
> >
> > > -Original Message-
> > > From: James Bottomley
> [mailto:james.bottom...@hansenpartnership.com
> > > ]
> > > Sent: Wednesday, March 16, 2016 4:08 PM
> > > To: Martin K. Petersen ; KY Srinivasan
> > > 
> > > Cc: Christoph Hellwig ;
> > > gre...@linuxfoundation.org;
> > > linux-ker...@vger.kernel.org; de...@linuxdriverproject.org;
> > > oher...@suse.com; jbottom...@parallels.com;
> > > linux-s...@vger.kernel.org;
> > > a...@canonical.com; vkuzn...@redhat.com; jasow...@redhat.com;
> > > h...@suse.de
> > > Subject: Re: [PATCH 1/1] scsi: storvsc: Support manual scan of FC
> > > hosts on
> > > Hyper-V
> > >
> > > On Wed, 2016-03-16 at 18:34 -0400, Martin K. Petersen wrote:
> > > > > > > > > "KY" == KY Srinivasan  writes:
> > > >
> > > > KY> How would I get the sysfs files under fc_host if I don't use
> > > > the
> > > > FC
> > > > KY> transport.  The customer scripts expect these sysfs files.
> > > >
> > > > Right, but I was interested in finding out why they need those
> > > > files. And whether an alternative to the FC transport would be a
> > > > better solution.
> > >
> > > If it's just the wwn file (or a set of other values), we might be
> > > able
> > > to separate that bit out of the FC transport class so you can use
> > > it
> > > independently ... do you have a full list of the files being used?
> >
> > Wwn files are what we can support on Hyper-V and that is what I want
> > to support (to address customer requirements).
> 
> There is no wwn file.  These are all the possible attributes they could
> use; which one(s) do you want:
> 
>   /*
>* Setup SCSI Host Attributes.
>*/
>   SETUP_HOST_ATTRIBUTE_RD(node_name);
>   SETUP_HOST_ATTRIBUTE_RD(port_name);
>   SETUP_HOST_ATTRIBUTE_RD(permanent_port_name);
>   SETUP_HOST_ATTRIBUTE_RD(supported_classes);
>   SETUP_HOST_ATTRIBUTE_RD(supported_fc4s);
>   SETUP_HOST_ATTRIBUTE_RD(supported_speeds);
>   SETUP_HOST_ATTRIBUTE_RD(maxframe_size);
>   if (ft->vport_create) {
>   SETUP_HOST_ATTRIBUTE_RD_NS(max_npiv_vports);
>   SETUP_HOST_ATTRIBUTE_RD_NS(npiv_vports_inuse);
>   }
>   SETUP_HOST_ATTRIBUTE_RD(serial_number);
>   SETUP_HOST_ATTRIBUTE_RD(manufacturer);
>   SETUP_HOST_ATTRIBUTE_RD(model);
>   SETUP_HOST_ATTRIBUTE_RD(model_description);
>   SETUP_HOST_ATTRIBUTE_RD(hardware_version);
>   SETUP_HOST_ATTRIBUTE_RD(driver_version);
>   SETUP_HOST_ATTRIBUTE_RD(firmware_version);
>   SETUP_HOST_ATTRIBUTE_RD(optionrom_version);
> 
>   SETUP_HOST_ATTRIBUTE_RD(port_id);
>   SETUP_HOST_ATTRIBUTE_RD(port_type);
>   SETUP_HOST_ATTRIBUTE_RD(port_state);
>   SETUP_HOST_ATTRIBUTE_RD(active_fc4s);
>   SETUP_HOST_ATTRIBUTE_RD(speed);
>   SETUP_HOST_ATTRIBUTE_RD(fabric_name);
>   SETUP_HOST_ATTRIBUTE_RD(symbolic_name);
>   SETUP_HOST_ATTRIBUTE_RW(system_hostname);
> 
>   /* Transport-managed attributes */
>   SETUP_PRIVATE_HOST_ATTRIBUTE_RW(dev_loss_tmo);
>   SETUP_PRIVATE_HOST_ATTRIBUTE_RW(tgtid_bind_type);
>   if (ft->issue_fc_host_lip)
>   SETUP_PRIVATE_HOST_ATTRIBUTE_RW(issue_lip);
>   if (ft->vport_create)
>   SETUP_PRIVATE_HOST_ATTRIBUTE_RW(vport_create);
>   if (ft->vport_delete)
>   SETUP_PRIVATE_HOST_ATTRIBUTE_RW(vport_delete);
>   /*
>* Setup Remote Port Attributes.
>*/
>   count=0;
>   SETUP_RPORT_ATTRIBUTE_RD(maxframe_size);
>   SETUP_RPORT_ATTRIBUTE_RD(supported_classes);
>   SETUP_RPORT_ATTRIBUTE_RW(dev_loss_tmo);
>   SETUP_PRIVATE_RPORT_ATTRIBUTE_RD(node_name);
>   SETUP_PRIVATE_RPORT_ATTRIBUTE_RD(port_name);
>   SETUP_PRIVATE_RPORT_ATTRIBUTE_RD(port_id);
>   SETUP_PRIVATE_RPORT_ATTRIBUTE_RD(roles);
>   SETUP_PRIVATE_RPORT_ATTRIBUTE_RD(port_state);
>   SETUP_PRIVATE_RPORT_ATTRIBUTE_RD(scsi_target_id);
>   SETUP_PRIVATE_RPORT_ATTRIBUTE_RW(fast_io_fail_tmo);
> 
>   /*
>* Setup Virtual Port Attributes.
>*/
>   SETUP_PRIVATE_VPORT_ATTRIBUTE_RD(vport_state);
>   SETUP_PRIVATE_VPORT_ATTRIBUTE_RD(vport_last_state);
>   SETUP_PRIVATE_VPORT_ATTRIBUTE_RD(node_name);
>   

Re: [PATCH] staging: r8723au: This patch tries to fix some byte order issues that is found by sparse check.

2016-03-19 Thread Jes Sorensen
Jandy Gou  writes:
> 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(_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(_cmd);
>   rtl8723au_write32(padapter, msgbox_addr, h2c_cmd);

Please do *not* use le{16,32}_to_cpus() that is so gross it's hard to
even put words on it. Use a temp variable of the correct type instead.

NAK

Jes
___
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

2016-03-19 Thread Joe Perches
On Fri, 2016-03-18 at 17:48 +, 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.
[]
> diff --git 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(>beacon_timer, jiffies +
> -   
> (msecs_to_jiffies(ieee->current_network.beacon_interval - 5)));
> +   (msecs_to_jiffies
> +    (ieee->current_network.beacon_interval - 5)));

Long identifier names like "current_network.beacon_interval",
which is 31 chars long, make the 80 column limit somewhat silly.

It's OK to ignore checkpatch warnings when changing the code
is less readable.

Most all of these are less nice than the original.

For instance, if this were to be changed (and it doesn't
need to be) perhaps:

>   if (ieee->beacon_txing && ieee->ieee_up)
>   mod_timer(>beacon_timer, jiffies +
> -   
> (msecs_to_jiffies(ieee->current_network.beacon_interval - 5)));
> +   (msecs_to_jiffies
> +    (ieee->current_network.beacon_interval - 5)));


mod_timer(>beacon_timer,
  jiffies +
  
msecs_to_jiffies(ieee->current_network.beacon_interval - 5));

which is still > 80 columns, but it removes an unnecessary
set of parentheses.

Breaking the msecs_to_jiffies() at the function name is
otherwise rather unsightly.

Always strive for readability and clarity over serving
some mindless script.
___
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

2016-03-19 Thread Martin K. Petersen
> "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.

-- 
Martin K. Petersen  Oracle Linux Engineering
___
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

2016-03-19 Thread Gavin O'Leary
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(>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


staging: most: warning: ‘mbo’ may be used uninitialized in this function

2016-03-19 Thread Geert Uytterhoeven
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(>io_mutex);
> -   if (c->stacked_mbo) {
> -   mbo = c->stacked_mbo;
> -   goto start_copy;
> -   }
> -   while ((!kfifo_out(>fifo, , 1)) && (c->dev)) {
> +   while (c->dev && !kfifo_peek(>fifo, )) {

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(>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] Staging: rtl8192e: fix line length coding style issue in rtllib_softmac.c

2016-03-19 Thread Yousof El-Sayed
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(>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);
}
 

[PATCH 23/42] staging: comedi: ni_660x: tidy up ni_660x_set_pfi_routing()

2016-03-19 Thread H Hartley Sweeten
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(>interrupt_lock);
spin_lock_init(>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))
+   

Re: [PATCH] staging: netlogic: Fixed alignment of parantheseis checkpatch warning

2016-03-19 Thread Joe Perches
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(_net1_res[mac * 2],
> - xlr_gmac_offsets[mac + 4],
> - xlr_gmac_irqs[mac + 4]);
> + xlr_resource_init(_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(_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


Re: [PATCH] Drivers: hv: vmbus: handle various crash scenarios

2016-03-19 Thread Radim Krcmar
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(_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


[PATCH 16/42] staging: comedi: ni_660x: fix block comment issues

2016-03-19 Thread H Hartley Sweeten
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 = _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


[PATCH 13/42] staging: comedi: ni_660x: tidy up ni_gpct_{write, read}_register()

2016-03-19 Thread H Hartley Sweeten
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,
-_gpct_write_register,
-_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 42/42] staging: comedi: ni_660x: update the MODULE_DESCRIPTION

2016-03-19 Thread H Hartley Sweeten
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


Re: [PATCH] Add tw5864 driver

2016-03-19 Thread Leon Romanovsky
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 v2] staging: most: hdm-dim2: Remove possible dereference error

2016-03-19 Thread Amitoj Kaur Chawla
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(_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: netlogic: Fixed alignment of parantheseis checkpatch warning

2016-03-19 Thread Parth Sane
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(_net1_res[mac * 2],
-   xlr_gmac_offsets[mac + 4],
-   xlr_gmac_irqs[mac + 4]);
+   xlr_resource_init(_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

2016-03-19 Thread Parth Sane
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(_net1_res[mac * 2],
-   xlr_gmac_offsets[mac + 4],
-   xlr_gmac_irqs[mac + 4]);
+   xlr_resource_init(_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


Re: [PATCH 1/1] scsi: storvsc: Support manual scan of FC hosts on Hyper-V

2016-03-19 Thread James Bottomley
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


Re: [PATCH] media: add GFP flag to media_*() that could get called in atomic context

2016-03-19 Thread Mauro Carvalho Chehab
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, >entity_notify, list) {
> > spin_unlock(>lock);
> > (notify)->notify(entity, notify->notify_data);
> > spin_lock(>lock);
> > }
> >  
> > spin_unlock(>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=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


[PATCH v10 2/3] kernel.h: add u64_to_user_ptr()

2016-03-19 Thread Gustavo Padovan
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,
- 

[PATCH 35/42] staging: comedi: ni_660x: initialize the counter with the subdevice init

2016-03-19 Thread H Hartley Sweeten
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(_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


Re: [PATCH] staging: comedi: ni_mio_common: fix the ni_write[blw]() functions

2016-03-19 Thread gre...@linuxfoundation.org
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


RE: [PATCH v2] staging/comedi/dt282x: avoid integer overflow warning

2016-03-19 Thread Hartley Sweeten
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


[PATCH v9 3/3] staging/android: refactor SYNC IOCTLs

2016-03-19 Thread Gustavo Padovan
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(, (void __user *)arg, sizeof(size)))
+   if (copy_from_user(, (void __user *)arg, sizeof(info)))
return 

[PATCH v10 1/3] staging/android: remove redundant comments on sync_merge_data

2016-03-19 Thread Gustavo Padovan
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 5/9] rtlwifi: rtl8192ee: Fix Smatch warning

2016-03-19 Thread Larry Finger
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 29/42] staging: comedi: ni_660x: tidy up the counter subdevices init

2016-03-19 Thread H Hartley Sweeten
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 = >subdevices[subdev++];
if (i < n_counters) {
-   s->type = COMEDI_SUBD_COUNTER;
-   s->subdev_flags = SDF_READABLE | SDF_WRITABLE |
+   struct ni_gpct *counter = _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 = _660x_cmd;
-   s->len_chanlist = 1;
-   s->do_cmdtest = ni_tio_cmdtest;
-   s->cancel = _660x_cancel;
-   s->poll = _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 = _660x_buf_change;
-   s->private = >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(>counter_dev->counters[i]);
+   ni_tio_init_counter(_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


Re: [PATCH] staging: netlogic: removed 1 multiple assignment checkpatch warning

2016-03-19 Thread Parth Sane
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


Re: [PATCH] staging: netlogic: removed 1 multiple assignment checkpatch warning

2016-03-19 Thread Greg KH
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

2016-03-19 Thread Parth Sane
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

2016-03-19 Thread Roger H Newell
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

2016-03-19 Thread Parth Sane
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


[PATCH 34/42] staging: comedi: ni_660x: allocate counters early in (*auto_attach)

2016-03-19 Thread H Hartley Sweeten
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 = >subdevices[subdev++];
-- 
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'

2016-03-19 Thread H Hartley Sweeten
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 12/42] staging: comedi: ni_660x: tidy up ni_660x_read_register()

2016-03-19 Thread H Hartley Sweeten
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


Re: [PATCH] staging: most: hdm-dim2: Remove possible dereference error

2016-03-19 Thread Andrey Shvetsov
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] staging: unisys: visornic: Made comments look nicer

2016-03-19 Thread Gavin O'Leary
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(>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


[PATCH] staging: most: hdm-dim2: Remove possible dereference error

2016-03-19 Thread Amitoj Kaur Chawla
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(_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: refresh TODO for rtl8723au

2016-03-19 Thread Xose Vazquez Perez
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


Re: [PATCH v9 2/3] kernel.h: add to_user_ptr()

2016-03-19 Thread 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.

Gustavo
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] [media] media: rename media unregister function

2016-03-19 Thread Javier Martinez Canillas
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


[PATCH 03/42] staging: comedi: ni_660x: remove enum ni_register_width

2016-03-19 Thread H Hartley Sweeten
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] = 

[PATCH 36/42] staging: comedi: ni_660x: default DIO channels with subdevice init

2016-03-19 Thread H Hartley Sweeten
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 = >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 1/2] staging: wilc1000: Removed braces from single block statements

2016-03-19 Thread Roger H. Newell
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) + 

Re: [PATCH] staging: unisys: visornic: Made comments look nicer

2016-03-19 Thread Greg KH
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


Re: [PATCH v9 2/3] kernel.h: add to_user_ptr()

2016-03-19 Thread 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.

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 v2] staging/comedi/dt282x: avoid integer overflow warning

2016-03-19 Thread Ian Abbott

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] [media] media: rename media unregister function

2016-03-19 Thread Mauro Carvalho Chehab
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


[PATCH 08/42] staging: comedi: ni_660x: remove enum clock_config_register_bits

2016-03-19 Thread H Hartley Sweeten
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


[PATCH] [media] media: rename media unregister function

2016-03-19 Thread Mauro Carvalho Chehab
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(>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(>media_dev);
+   media_device_unregister_cleanup(>media_dev);
v4l2_device_unregister(>v4l2_dev);
return ret;
 }
@@ -1520,7 +1520,7 @@ static int fimc_md_remove(struct platform_device *pdev)
device_remove_file(>dev, _attr_subdev_conf_mode);
fimc_md_unregister_entities(fmd);
fimc_md_pipelines_free(fmd);
-   media_device_unregister(>media_dev);
+   media_device_unregister_cleanup(>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_hist);
 
v4l2_device_unregister(>v4l2_dev);
-   media_device_unregister(>media_dev);
+   media_device_unregister_cleanup(>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
--- 

Re: [PATCH 7/9] rtlwifi: rtl8723ae: Fix Smatch warning

2016-03-19 Thread Dan Carpenter
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] staging: r8723au: This patch tries to fix some byte order issues that is found by sparse check.

2016-03-19 Thread Jandy Gou
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(_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(_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


[PATCH 06/42] staging: comedi: ni_660x: cleanup the NI660X_IO_CFG register helpers

2016-03-19 Thread H Hartley Sweeten
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(>interrupt_lock);
spin_lock_init(>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, 

Re: [PATCH v9 2/3] kernel.h: add to_user_ptr()

2016-03-19 Thread Joe Perches
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 30/42] staging: comedi: ni_660x: ni_gpct_device_destroy() can handle a NULL pointer

2016-03-19 Thread H Hartley Sweeten
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


[PATCH 3/9] rtlwifi: rtl8188ee: Fix Smatch warnings

2016-03-19 Thread Larry Finger
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


RE: [PATCH v2] staging/comedi/dt282x: avoid integer overflow warning

2016-03-19 Thread Hartley Sweeten
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


Re: [PATCH] staging: refresh TODO for rtl8723au

2016-03-19 Thread Jes Sorensen
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 v10 2/3] kernel.h: add u64_to_user_ptr()

2016-03-19 Thread Joe Perches
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(, (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] [media] media: rename media unregister function

2016-03-19 Thread Shuah Khan
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] staging: comedi: dt282x: tidy up register bit defines

2016-03-19 Thread Ian Abbott

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 v9 2/3] kernel.h: add to_user_ptr()

2016-03-19 Thread Gustavo Padovan
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


[PATCH] staging: unisys: visornic: Made comments look nicer

2016-03-19 Thread Gavin O'Leary
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(>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


[PATCH] staging: rtl8192e: fixed coding style issues

2016-03-19 Thread Yousof El-Sayed
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


Re: [PATCH v9 2/3] kernel.h: add to_user_ptr()

2016-03-19 Thread Joe Perches
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


Re: [PATCH] staging: r8723au: This patch tries to fix some byte order issues that is found by sparse check.

2016-03-19 Thread Jes Sorensen
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


[PATCH] staging: unisys: visornic: Fixed Checkpatch Warnings

2016-03-19 Thread Gavin O'Leary
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(>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


[PATCH] staging: skein: threefish_block: Use ror64

2016-03-19 Thread Joe Perches
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) 

Re: [PATCH 2/2] isdn: i4l: move active-isdn drivers to staging

2016-03-19 Thread Tilman Schmidt
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


Re: [PATCH] dma-buf, drm, ion: Propagate error code from dma_buf_start_cpu_access()

2016-03-19 Thread Daniel Vetter
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(>struct_mutex);
> - was_interruptible = dev_priv->mm.interruptible;
> - dev_priv->mm.interruptible = false;
> + ret = i915_mutex_lock_interruptible(dev);
> + if (ret)
> + return ret;
>  
>   ret = 

RE: [PATCH 1/1] scsi: storvsc: Support manual scan of FC hosts on Hyper-V

2016-03-19 Thread KY Srinivasan


> -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


[PATCH 04/42] staging: comedi: ni_660x: remove enum ni_660x_register_direction

2016-03-19 Thread H Hartley Sweeten
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] 

[PATCH] staging: wilc1000: fixed kernel panic when firmware is not started

2016-03-19 Thread Leo Kim
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


  1   2   >