Re: [PATCH V2 0/6] iio: mxs-lradc: Clean up and add datasheet names

2015-07-20 Thread Dan Carpenter
On Mon, Jul 20, 2015 at 12:06:11AM +0200, Marek Vasut wrote:
> On Sunday, July 19, 2015 at 10:49:47 PM, Dan Carpenter wrote:
> > On Sun, Jul 19, 2015 at 11:33:43PM +0300, Dan Carpenter wrote:
> > > I didn't necessarily read the thread that way, but the thread was
> > > long...
> > 
> > I read the thread as saying that you sometimes get:
> > 
> > Reviewed-by: Some Person 
> 
> Hm, I'm trying to use this email as a single point-of-presence, but
> maybe I should start separating reviews I do in my free time and
> send my R-B and A-B from my private address ?

No no.  What I was saying is that you just sent a reviewed-by with no
extra comments, if you were an unknown person that's useless but since
we know you then I think that's fine.

regards,
dan carpenter

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


Re: Generic VME UIO driver

2015-07-20 Thread Martyn Welch



On 08/07/15 16:02, Dmitry Kalinkin wrote:



On 08 Jul 2015, at 16:22, Martyn Welch  wrote:

On 06/07/15 18:24, Dmitry Kalinkin wrote:

Some functionality was dropped as it was not good practice

(such as receiving VME interrupts in user space, it's not really doable if
the slave card is Release On Register Access rather than Release on
Acknowledge),

Didn't know about RORA. I wonder how different this is compared to the
PCI bus case.


Little I suspect. What it does mean is that there's no generic mechanism for 
clearing down an interrupt, so a device specific interrupt routine is required, 
which needs to be in kernel space.

Yet PCI somehow managed to settle with UIO.


"If, on the other hand, your hardware needs some action to be performed 
after each interrupt, then you must do it in your kernel module."


https://www.kernel.org/doc/htmldocs/uio-howto/adding_irq_handler.html


Now imagine I am working with a board using vme_user API and I need to
implement interrupts. The PCI case teaches me that I need to write a board 
specific
UIO driver. My board is ROAK and allows to configure it's interrupt to any 
level and
any status/id. So I only use a standard vme_irq_request API that generates IACK
cycle for me automatically. I also don’t want to limit my end user with a 
choice of
interrupt level and status/id and so I make it configurable. In the end I’ve 
got a very
generic ROAK device driver. What did I do wrong?



Nothing by the sounds of it. If you have ROAK hardware, life is a lot 
simpler.


Martyn


Cheers,
Dmitry



--
Martyn Welch (Lead Software Engineer)  | Registered in England and Wales
GE Intelligent Platforms   | (3828642) at 100 Barbirolli Square
T +44(0)1327322748 | Manchester, M2 3AB
E martyn.we...@ge.com  | VAT:GB 927559189
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH V2 0/6] iio: mxs-lradc: Clean up and add datasheet names

2015-07-20 Thread Marek Vasut
On Monday, July 20, 2015 at 09:00:32 AM, Dan Carpenter wrote:
> On Mon, Jul 20, 2015 at 12:06:11AM +0200, Marek Vasut wrote:
> > On Sunday, July 19, 2015 at 10:49:47 PM, Dan Carpenter wrote:
> > > On Sun, Jul 19, 2015 at 11:33:43PM +0300, Dan Carpenter wrote:
> > > > I didn't necessarily read the thread that way, but the thread was
> > > > long...
> > > 
> > > I read the thread as saying that you sometimes get:
> > > 
> > > Reviewed-by: Some Person 
> > 
> > Hm, I'm trying to use this email as a single point-of-presence, but
> > maybe I should start separating reviews I do in my free time and
> > send my R-B and A-B from my private address ?
> 
> No no.  What I was saying is that you just sent a reviewed-by with no
> extra comments, if you were an unknown person that's useless but since
> we know you then I think that's fine.

Got it, I'll keep that in mind!

Best regards,
Marek Vasut
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH net-next 1/1] hv_netvsc: Wait for sub-channels to be processed during probe

2015-07-20 Thread Dexuan Cui
> From: KY Srinivasan
> Sent: Friday, July 17, 2015 23:33
> > From: Dexuan Cui
> > Sent: Friday, July 17, 2015 3:01 AM
> > > From: K. Y. Srinivasan
> > > Sent: Friday, July 17, 2015 3:17
> > > Subject: [PATCH net-next 1/1] hv_netvsc: Wait for sub-channels to be
> > processed
> > > during probe
> > > diff --git a/drivers/net/hyperv/hyperv_net.h
> > b/drivers/net/hyperv/hyperv_net.h
> > > ...
> > > @@ -1116,6 +1127,9 @@ int rndis_filter_device_add(struct hv_device
> > *dev,
> > >  num_possible_rss_qs = cpumask_weight(node_cpu_mask);
> > >  net_device->num_chn = min(num_possible_rss_qs, num_rss_qs);
> > >
> > > +num_rss_qs = net_device->num_chn - 1;
> > > +net_device->num_sc_offered = num_rss_qs;
> > > +
> > >  if (net_device->num_chn == 1)
> > >  goto out;
> > >
> > > @@ -1157,11 +1171,22 @@ int rndis_filter_device_add(struct hv_device
> > *dev,
> > >
> > >  ret = rndis_filter_set_rss_param(rndis_device, net_device-
> > >num_chn);
> > >
> > > +/*
> > > + * Wait for the host to send us the sub-channel offers.
> > > + */
> > > +spin_lock_irqsave(&net_device->sc_lock, flags);
> > > +sc_delta = net_device->num_chn - 1 - num_rss_qs;
> > > +net_device->num_sc_offered -= sc_delta;
> >
> > Hi KY,
> > IMO here the "-= " should be "+="?
> >
> > I think sc_delta is usually <= 0, meaning the host may allocate less
> > subchannels than
> > we expect.
> > With "-=", net_device->num_sc_offered can become bigger -- this doesn't
> > seem correct.
> We control how many sub-channels we want the host to offer (say
> sc_requested). Based on this
> number we begin to track how many have actually been processed - we
> decrement sc_requested
> each time a sub-channel offer is processed. If the host were to actually 
> offer all
> that we have requested,
> then checking for sc_requested to be zero is sufficient to ensure that we have
> processed all the
> potentially in-flight sub-channels. However, the host  may choose to offer 
> less
> than what we had asked for
> and the variable "delta" is tracking this difference. Since we are counting 
> down
> from what we had asked for
> we have to subtract "delta" for proper accounting.

Yes, I understand the rationale.
Let me show the issue by example:

Let's assume sc_requested is 7 and the host actually only offers 3 sub-channels:
1. Just before sending the NVSP_MSG5_TYPE_SUBCHANNEL message, we have
net_device->num_chn == 8,
num_rss_qs ==  7
net_device->num_sc_offered == 7

2. Just after we get the reply of the message,
net_device->num_chn == 4
sc_delta = net_device->num_chn - 1 - num_rss_qs, so sc_delta == 4 - 1 - 7 = -4
net_device->num_sc_offered -= sc_delta, so
net_device->num_sc_offered == 7 - (-4) = 11. It's not zero, so we sleep on the
wait_for_completion().

3. Now we process the 3 sub-channel and net_device->num_sc_offered will
become 11 -1 -1 -1 == 8 and no complete() will be invoked!

That's why I think the "-=" in the line
net_device->num_sc_offered -= sc_delta
should be "+=".

> > Why not use
> > "net_device->num_sc_offered = net_device->num_chn - 1;" directly?
> > At this point, net_device->num_chn has been the number of the actual
> > channels.
>
> I am not sure what the question here is. num_sc_offered is initialized to the
> number we
> are going to ask and this is the number that will be decremented each time a
> sub-channel
> is processed. Since the host may decide to offer us less than what we had 
> asked
> and some
> sub-channels may have already been processed (num_sc_offerred decremented
> accordingly)
> by the time we discover that the host has offered us less than what we asked 
> for,
> we adjust
> num_sc_offered accordingly.

Sorry, I had a misunderstanding here.
Please just ignore this question.

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


[PATCH] staging: comedi: drivers: pcl816.c remove leading space

2015-07-20 Thread Chandra S Gorentla
Checkpatch.pl warning - suspect code indent for conditional statements -
is corrected

Signed-off-by: Chandra S Gorentla 
---
 drivers/staging/comedi/drivers/pcl816.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/pcl816.c 
b/drivers/staging/comedi/drivers/pcl816.c
index 781b321..a353d1b 100644
--- a/drivers/staging/comedi/drivers/pcl816.c
+++ b/drivers/staging/comedi/drivers/pcl816.c
@@ -305,7 +305,7 @@ static int check_channel_list(struct comedi_device *dev,
chansegment[0] = chanlist[0];
for (i = 1, seglen = 1; i < chanlen; i++, seglen++) {
/*  we detect loop, this must by finish */
-   if (chanlist[0] == chanlist[i])
+   if (chanlist[0] == chanlist[i])
break;
nowmustbechan =
(CR_CHAN(chansegment[i - 1]) + 1) % chanlen;
-- 
2.4.5

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


RE: [PATCH 3/5] Drivers: hv_vmbus: Fix signal to host condition

2015-07-20 Thread Dexuan Cui
> -Original Message-
> From: deve On Behalf of K. Y. Srinivasan
> Sent: Monday, July 20, 2015 11:37
> 
> From: Christopher Oo
> 
> Fixes a bug where previously hv_ringbuffer_read would pass in the old
> number of bytes available to read instead of the expected old read index
> when calculating when to signal to the host that the ringbuffer is empty.
> Since the previous write size is already saved, also changes the
> hv_need_to_signal_on_read to use the previously read value rather than
> recalculating it.
> 
> diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c
> @@ -560,7 +552,7 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info
> *inring_info, void *buffer,
> 
>   spin_unlock_irqrestore(&inring_info->ring_lock, flags);
> 
> - *signal = hv_need_to_signal_on_read(old_read, inring_info);
> + *signal = hv_need_to_signal_on_read(bytes_avail_towrite, inring_info);
> 
>   return 0;
>  }

Good catch!

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


RE: [PATCH 5/5] Drivers: hv: vmbus: Implement a clocksource based on the TSC page

2015-07-20 Thread Dexuan Cui
> From: devel [mailto:driverdev-devel-bounces...linuxdriverproject.org] On 
> Behalf
> Of K. Y. Srinivasan
> Sent: Monday, July 20, 2015 11:37
> 
> The current Hyper-V clock source is based on the per-partition reference 
> counter
> and this counter is being accessed via s synthetic MSR -
> HV_X64_MSR_TIME_REF_COUNT.
> Hyper-V has a more efficient way of computing the per-partition reference
> counter value that does not involve reading a synthetic MSR. We implement
> a time source based on this mechanism.
> ...
> diff --git a/arch/x86/include/uapi/asm/hyperv.h
> @@ -183,6 +233,22 @@ int hv_init(void)
> 
>   hv_context.hypercall_page = virtaddr;
> 
> +#ifdef CONFIG_X86_64
> + if (ms_hyperv.features & HV_X64_MSR_REFERENCE_TSC_AVAILABLE) {
> + va_tsc = __vmalloc(PAGE_SIZE, GFP_KERNEL, PAGE_KERNEL);
> + if (!va_tsc)
> + goto cleanup;
> + hv_context.tsc_page = va_tsc;
> +
> + rdmsrl(HV_X64_MSR_REFERENCE_TSC, tsc_msr.as_uint64);
> +
> + tsc_msr.enable = 1;
> + tsc_msr.guest_physical_address = vmalloc_to_pfn(va_tsc);
> +
> + wrmsrl(HV_X64_MSR_REFERENCE_TSC, tsc_msr.as_uint64);
> + clocksource_register_hz(&hyperv_cs_tsc, NSEC_PER_SEC/100);
> + }
> +#endif

Should we disable the mechanism and vfree() the page in hv_cleanup() for 
kexec/kdump?

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


[PATCH 1/2] staging: lustre: obdclass: Make variables static.

2015-07-20 Thread Cihangir Akturk
obd_device_list_sops and obd_device_list_fops are not
referenced outside of linux-module.c, so make them static.

Signed-off-by: Cihangir Akturk 
---
 drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c 
b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
index b618c0b..f16dfbf 100644
--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
@@ -385,7 +385,7 @@ static int obd_device_list_seq_show(struct seq_file *p, 
void *v)
return 0;
 }
 
-struct seq_operations obd_device_list_sops = {
+static struct seq_operations obd_device_list_sops = {
.start = obd_device_list_seq_start,
.stop = obd_device_list_seq_stop,
.next = obd_device_list_seq_next,
@@ -406,7 +406,7 @@ static int obd_device_list_open(struct inode *inode, struct 
file *file)
return 0;
 }
 
-struct file_operations obd_device_list_fops = {
+static struct file_operations obd_device_list_fops = {
.owner   = THIS_MODULE,
.open= obd_device_list_open,
.read= seq_read,
-- 
2.4.6

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


[PATCH 2/2] staging: lustre: obdclass: Add const qualifier to structure declerations.

2015-07-20 Thread Cihangir Akturk
This patch fixes the following sparse warnings:
WARNING: struct seq_operations should normally be const
WARNING: struct file_operations should normally be const

Signed-off-by: Cihangir Akturk 
---
 drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c 
b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
index f16dfbf..6218ef3 100644
--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
@@ -385,7 +385,7 @@ static int obd_device_list_seq_show(struct seq_file *p, 
void *v)
return 0;
 }
 
-static struct seq_operations obd_device_list_sops = {
+static const struct seq_operations obd_device_list_sops = {
.start = obd_device_list_seq_start,
.stop = obd_device_list_seq_stop,
.next = obd_device_list_seq_next,
@@ -406,7 +406,7 @@ static int obd_device_list_open(struct inode *inode, struct 
file *file)
return 0;
 }
 
-static struct file_operations obd_device_list_fops = {
+static const struct file_operations obd_device_list_fops = {
.owner   = THIS_MODULE,
.open= obd_device_list_open,
.read= seq_read,
-- 
2.4.6

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


[PATCH 0/2] staging: lustre: obdclass: Miscellaneous fixes

2015-07-20 Thread Cihangir Akturk
This patchset contains sparse and checkpatch.pl fixes.

Cihangir Akturk (2):
  staging: lustre: obdclass: Make variables static.
  staging: lustre: obdclass: Add const qualifier to structure
declerations.

 drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.4.6

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


Re: [PATCH v3 01/46] usb: gadget: encapsulate endpoint claiming mechanism

2015-07-20 Thread Krzysztof Opasiak



On 07/15/2015 08:31 AM, Robert Baldyga wrote:

So far it was necessary for usb functions to set ep->driver_data in
endpoint obtained from autoconfig to non-null value, to indicate that
endpoint is claimed by function (in autoconfig it was checked if endpoint
has set this field to non-null value, and if it has, it was assumed that
it is claimed). It could cause bugs becouse if some function doesn't


s/becouse/because

Best regards,
--
Krzysztof Opasiak
Samsung R&D Institute Poland
Samsung Electronics
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 0/3] Drivers: hv: vmbus: Add sysfs attributes to show CPU binding of channels

2015-07-20 Thread K. Y. Srinivasan
Add sysfs attributes to track the binding of CPUs to channels. This patchset 
also adds
a script to list VMBUS devices.

Dexuan Cui (3):
  Drivers: hv: vmbus: add a sysfs attr to show the binding of
channel/VP
  tools: hv: add a python script lsvmbus to list VMBus devices
  Drivers: hv: vmbus: document the VMBus sysfs files

 Documentation/ABI/stable/sysfs-bus-vmbus |   29 +
 MAINTAINERS  |1 +
 drivers/hv/vmbus_drv.c   |   38 +++
 tools/hv/lsvmbus |  101 ++
 4 files changed, 169 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/ABI/stable/sysfs-bus-vmbus
 create mode 100644 tools/hv/lsvmbus

-- 
1.7.4.1

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


[PATCH 1/3] Drivers: hv: vmbus: add a sysfs attr to show the binding of channel/VP

2015-07-20 Thread K. Y. Srinivasan
From: Dexuan Cui 

This is useful to analyze performance issue.

Signed-off-by: Dexuan Cui 
Signed-off-by: K. Y. Srinivasan 
---
 drivers/hv/vmbus_drv.c |   38 ++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index cf20400..99088f6 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -414,6 +414,43 @@ static ssize_t in_write_bytes_avail_show(struct device 
*dev,
 }
 static DEVICE_ATTR_RO(in_write_bytes_avail);
 
+static ssize_t channel_vp_mapping_show(struct device *dev,
+  struct device_attribute *dev_attr,
+  char *buf)
+{
+   struct hv_device *hv_dev = device_to_hv_device(dev);
+   struct vmbus_channel *channel = hv_dev->channel, *cur_sc;
+   unsigned long flags;
+   int buf_size = PAGE_SIZE, n_written, tot_written;
+   struct list_head *cur;
+
+   if (!channel)
+   return -ENODEV;
+
+   tot_written = snprintf(buf, buf_size, "%u:%u\n",
+   channel->offermsg.child_relid, channel->target_cpu);
+
+   spin_lock_irqsave(&channel->lock, flags);
+
+   list_for_each(cur, &channel->sc_list) {
+   if (tot_written >= buf_size - 1)
+   break;
+
+   cur_sc = list_entry(cur, struct vmbus_channel, sc_list);
+   n_written = scnprintf(buf + tot_written,
+buf_size - tot_written,
+"%u:%u\n",
+cur_sc->offermsg.child_relid,
+cur_sc->target_cpu);
+   tot_written += n_written;
+   }
+
+   spin_unlock_irqrestore(&channel->lock, flags);
+
+   return tot_written;
+}
+static DEVICE_ATTR_RO(channel_vp_mapping);
+
 /* Set up per device attributes in /sys/bus/vmbus/devices/ */
 static struct attribute *vmbus_attrs[] = {
&dev_attr_id.attr,
@@ -438,6 +475,7 @@ static struct attribute *vmbus_attrs[] = {
&dev_attr_in_write_index.attr,
&dev_attr_in_read_bytes_avail.attr,
&dev_attr_in_write_bytes_avail.attr,
+   &dev_attr_channel_vp_mapping.attr,
NULL,
 };
 ATTRIBUTE_GROUPS(vmbus);
-- 
1.7.4.1

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


[PATCH 3/3] Drivers: hv: vmbus: document the VMBus sysfs files

2015-07-20 Thread K. Y. Srinivasan
From: Dexuan Cui 

The 4 sysfs files should be stable ABIs to the user space.

Signed-off-by: Dexuan Cui 
Signed-off-by: K. Y. Srinivasan 
---
 Documentation/ABI/stable/sysfs-bus-vmbus |   29 +
 MAINTAINERS  |1 +
 2 files changed, 30 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/ABI/stable/sysfs-bus-vmbus

diff --git a/Documentation/ABI/stable/sysfs-bus-vmbus 
b/Documentation/ABI/stable/sysfs-bus-vmbus
new file mode 100644
index 000..636e938
--- /dev/null
+++ b/Documentation/ABI/stable/sysfs-bus-vmbus
@@ -0,0 +1,29 @@
+What:  /sys/bus/vmbus/devices/vmbus_*/id
+Date:  Jul 2009
+KernelVersion: 2.6.31
+Contact:   K. Y. Srinivasan 
+Description:   The VMBus child_relid of the device's primary channel
+Users: tools/hv/lsvmbus
+
+What:  /sys/bus/vmbus/devices/vmbus_*/class_id
+Date:  Jul 2009
+KernelVersion: 2.6.31
+Contact:   K. Y. Srinivasan 
+Description:   The VMBus interface type GUID of the device
+Users: tools/hv/lsvmbus
+
+What:  /sys/bus/vmbus/devices/vmbus_*/device_id
+Date:  Jul 2009
+KernelVersion: 2.6.31
+Contact:   K. Y. Srinivasan 
+Description:   The VMBus interface instance GUID of the device
+Users: tools/hv/lsvmbus
+
+What:  /sys/bus/vmbus/devices/vmbus_*/channel_vp_mapping
+Date:  Jul 2015
+KernelVersion: 4.2.0
+Contact:   K. Y. Srinivasan 
+Description:   The mapping of which primary/sub channels are bound to which
+   Virtual Processors.
+   Format: 
+Users: tools/hv/lsvmbus
diff --git a/MAINTAINERS b/MAINTAINERS
index fd60784..45ef1e1 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4956,6 +4956,7 @@ F:drivers/scsi/storvsc_drv.c
 F: drivers/video/fbdev/hyperv_fb.c
 F: include/linux/hyperv.h
 F: tools/hv/
+F: Documentation/ABI/stable/sysfs-bus-vmbus
 
 I2C OVER PARALLEL PORT
 M: Jean Delvare 
-- 
1.7.4.1

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


Re: [PATCH v3 26/46] usb: gadget: pch_ud: add ep capabilities support

2015-07-20 Thread Krzysztof Opasiak



On 07/15/2015 08:32 AM, Robert Baldyga wrote:

Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga 
---
  drivers/usb/gadget/udc/pch_udc.c | 14 --
  1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/udc/pch_udc.c b/drivers/usb/gadget/udc/pch_udc.c
index 613547f..cc8fb3c 100644
--- a/drivers/usb/gadget/udc/pch_udc.c
+++ b/drivers/usb/gadget/udc/pch_udc.c
@@ -2895,11 +2895,21 @@ static void pch_udc_pcd_reinit(struct pch_udc_dev *dev)
ep->in = ~i & 1;
ep->ep.name = ep_string[i];
ep->ep.ops = &pch_udc_ep_ops;
-   if (ep->in)
+   if (ep->in) {
ep->offset_addr = ep->num * UDC_EP_REG_SHIFT;
-   else
+   ep->ep.caps.dir_in = true;
+   } else {
ep->offset_addr = (UDC_EPINT_OUT_SHIFT + ep->num) *
  UDC_EP_REG_SHIFT;
+   ep->ep.caps.dir_out = true;
+   }
+   if (i == UDC_EP0IN_IDX || i == UDC_EP0OUT_IDX) {
+   ep->ep.caps.type_control = true;


In all previous patches you set both dir_in and dir_out to true for ep0 
but in this patch you don't do this. Is there some reason for this or 
it's just a mistake?



+   } else {
+   ep->ep.caps.type_iso = true;
+   ep->ep.caps.type_bulk = true;
+   ep->ep.caps.type_int = true;
+   }
/* need to set ep->ep.maxpacket and set Default Configuration?*/
usb_ep_set_maxpacket_limit(&ep->ep, UDC_BULK_MAX_PKT_SIZE);
list_add_tail(&ep->ep.ep_list, &dev->gadget.ep_list);



Best Regards,

--
Krzysztof Opasiak
Samsung R&D Institute Poland
Samsung Electronics
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/3] tools: hv: add a python script lsvmbus to list VMBus devices

2015-07-20 Thread K. Y. Srinivasan
From: Dexuan Cui 

By default lsvmbus lists all the devices in the VMBus.
With -v or -vv, more information is printed, including the VMBus
Rel_ID, class ID, device ID and which channel is bound to which
virtual processor, etc.

Signed-off-by: Dexuan Cui 
Signed-off-by: K. Y. Srinivasan 
---
 tools/hv/lsvmbus |  101 ++
 1 files changed, 101 insertions(+), 0 deletions(-)
 create mode 100644 tools/hv/lsvmbus

diff --git a/tools/hv/lsvmbus b/tools/hv/lsvmbus
new file mode 100644
index 000..162a378
--- /dev/null
+++ b/tools/hv/lsvmbus
@@ -0,0 +1,101 @@
+#!/usr/bin/env python
+
+import os
+from optparse import OptionParser
+
+parser = OptionParser()
+parser.add_option("-v", "--verbose", dest="verbose",
+  help="print verbose messages. Try -vv, -vvv for \
+   more verbose messages", action="count")
+
+(options, args) = parser.parse_args()
+
+verbose = 0
+if options.verbose is not None:
+   verbose = options.verbose
+
+vmbus_sys_path = '/sys/bus/vmbus/devices'
+if not os.path.isdir(vmbus_sys_path):
+   print "%s doesn't exist: exiting..." % vmbus_sys_path
+   exit(-1)
+
+vmbus_dev_dict = {
+   '{0e0b6031-5213-4934-818b-38d90ced39db}' : '[Operating system 
shutdown]',
+   '{9527e630-d0ae-497b-adce-e80ab0175caf}' : '[Time Synchronization]',
+   '{57164f39-9115-4e78-ab55-382f3bd5422d}' : '[Heartbeat]',
+   '{a9a0f4e7-5a45-4d96-b827-8a841e8c03e6}' : '[Data Exchange]',
+   '{35fa2e29-ea23-4236-96ae-3a6ebacba440}' : '[Backup (volume 
checkpoint)]',
+   '{34d14be3-dee4-41c8-9ae7-6b174977c192}' : '[Guest services]',
+   '{525074dc-8985-46e2-8057-a307dc18a502}' : '[Dynamic Memory]',
+   '{cfa8b69e-5b4a-4cc0-b98b-8ba1a1f3f95a}' : 'Synthetic mouse',
+   '{f912ad6d-2b17-48ea-bd65-f927a61c7684}' : 'Synthetic keyboard',
+   '{da0a7802-e377-4aac-8e77-0558eb1073f8}' : 'Synthetic framebuffer 
adapter',
+   '{f8615163-df3e-46c5-913f-f2d2f965ed0e}' : 'Synthetic network adapter',
+   '{32412632-86cb-44a2-9b5c-50d1417354f5}' : 'Synthetic IDE Controller',
+   '{ba6163d9-04a1-4d29-b605-72e2ffb1dc7f}' : 'Synthetic SCSI Controller',
+   '{2f9bcc4a-0069-4af3-b76b-6fd0be528cda}' : 'Synthetic fiber channel 
adapter',
+   '{8c2eaf3d-32a7-4b09-ab99-bd1f1c86b501}' : 'Synthetic RDMA adapter',
+   '{276aacf4-ac15-426c-98dd-7521ad3f01fe}' : '[Reserved system device]',
+   '{f8e65716-3cb3-4a06-9a60-1889c5cccab5}' : '[Reserved system device]',
+   '{3375baf4-9e15-4b30-b765-67acb10d607b}' : '[Reserved system device]',
+}
+
+def get_vmbus_dev_attr(dev_name, attr):
+   try:
+   f = open('%s/%s/%s' % (vmbus_sys_path, dev_name, attr), 'r')
+   lines = f.readlines()
+   f.close()
+   except IOError:
+   lines = []
+
+   return lines
+
+class VMBus_Dev:
+   pass
+
+
+vmbus_dev_list = []
+
+for f in os.listdir(vmbus_sys_path):
+   vmbus_id = get_vmbus_dev_attr(f, 'id')[0].strip()
+   class_id = get_vmbus_dev_attr(f, 'class_id')[0].strip()
+   device_id = get_vmbus_dev_attr(f, 'device_id')[0].strip()
+   dev_desc = vmbus_dev_dict.get(class_id, 'Unknown')
+
+   chn_vp_mapping = get_vmbus_dev_attr(f, 'channel_vp_mapping')
+   chn_vp_mapping = [c.strip() for c in chn_vp_mapping]
+   chn_vp_mapping = sorted(chn_vp_mapping,
+   key = lambda c : int(c.split(':')[0]))
+
+   chn_vp_mapping = ['\tRel_ID=%s, target_cpu=%s' %
+   (c.split(':')[0], c.split(':')[1])
+   for c in chn_vp_mapping]
+   d = VMBus_Dev()
+   d.sysfs_path = '%s/%s' % (vmbus_sys_path, f)
+   d.vmbus_id = vmbus_id
+   d.class_id = class_id
+   d.device_id = device_id
+   d.dev_desc = dev_desc
+   d.chn_vp_mapping = '\n'.join(chn_vp_mapping)
+   if d.chn_vp_mapping:
+   d.chn_vp_mapping += '\n'
+
+   vmbus_dev_list.append(d)
+
+
+vmbus_dev_list  = sorted(vmbus_dev_list, key = lambda d : int(d.vmbus_id))
+
+format0 = '%2s: %s'
+format1 = '%2s: Class_ID = %s - %s\n%s'
+format2 = '%2s: Class_ID = %s - %s\n\tDevice_ID = %s\n\tSysfs path: %s\n%s'
+
+for d in vmbus_dev_list:
+   if verbose == 0:
+   print ('VMBUS ID ' + format0) % (d.vmbus_id, d.dev_desc)
+   elif verbose == 1:
+   print ('VMBUS ID ' + format1) % \
+   (d.vmbus_id, d.class_id, d.dev_desc, d.chn_vp_mapping)
+   else:
+   print ('VMBUS ID ' + format2) % \
+   (d.vmbus_id, d.class_id, d.dev_desc, \
+   d.device_id, d.sysfs_path, d.chn_vp_mapping)
-- 
1.7.4.1

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


[PATCH v2] staging: media: lirc: fix various checkpatch warnings

2015-07-20 Thread Maciek Borzecki
Remove unnecessary braces where appropriate. Fix non-tab
indentation.

This removes the following checkpatch warnings:
WARNING: braces {} are not necessary for single statement blocks

ERROR: code indent should use tabs where possible

Signed-off-by: Maciek Borzecki 
---
 drivers/staging/media/lirc/lirc_imon.c  | 8 
 drivers/staging/media/lirc/lirc_sasem.c | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/media/lirc/lirc_imon.c 
b/drivers/staging/media/lirc/lirc_imon.c
index 
62ec9f70dae4cd87dcf6fb60b1dd81df3d568b19..05d47dc8ffb8a987dc65287d36096a78cd5f96cd
 100644
--- a/drivers/staging/media/lirc/lirc_imon.c
+++ b/drivers/staging/media/lirc/lirc_imon.c
@@ -785,13 +785,13 @@ static int imon_probe(struct usb_interface *interface,
}
 
driver = kzalloc(sizeof(struct lirc_driver), GFP_KERNEL);
-   if (!driver) {
+   if (!driver)
goto free_context;
-   }
+
rbuf = kmalloc(sizeof(struct lirc_buffer), GFP_KERNEL);
-   if (!rbuf) {
+   if (!rbuf)
goto free_driver;
-   }
+
if (lirc_buffer_init(rbuf, BUF_CHUNK_SIZE, BUF_SIZE)) {
dev_err(dev, "%s: lirc_buffer_init failed\n", __func__);
goto free_rbuf;
diff --git a/drivers/staging/media/lirc/lirc_sasem.c 
b/drivers/staging/media/lirc/lirc_sasem.c
index 
9e5674341abe7368e5ec228f737e4c2d766f7d80..8113c999ee00dbdb065aa100f27956a922f36bf9
 100644
--- a/drivers/staging/media/lirc/lirc_sasem.c
+++ b/drivers/staging/media/lirc/lirc_sasem.c
@@ -181,10 +181,10 @@ static void deregister_from_lirc(struct sasem_context 
*context)
if (retval)
dev_err(&context->dev->dev,
"%s: unable to deregister from lirc (%d)\n",
-  __func__, retval);
+   __func__, retval);
else
dev_info(&context->dev->dev,
-"Deregistered Sasem driver (minor:%d)\n", minor);
+   "Deregistered Sasem driver (minor:%d)\n", minor);
 
 }
 
-- 
2.4.6

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


[PATCH v6 1/2] staging: rtl8192u: remove bool comparisons

2015-07-20 Thread Luis de Bethencourt
Remove explicit true/false comparisons to bool variables.

Signed-off-by: Luis de Bethencourt 
---
 drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c  |  4 ++--
 drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c |  2 +-
 drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c  |  4 ++--
 drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c| 12 ++--
 drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c| 14 +++---
 drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c|  2 +-
 drivers/staging/rtl8192u/r8192U_core.c |  7 ---
 drivers/staging/rtl8192u/r8192U_dm.c   |  8 
 8 files changed, 27 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
index b374088..0aa9021 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
@@ -1014,7 +1014,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct 
sk_buff *skb,
goto rx_dropped;
 
// if QoS enabled, should check the sequence for each of the AC
-   if( (ieee->pHTInfo->bCurRxReorderEnable == false) || 
!ieee->current_network.qos_data.active|| !IsDataFrame(skb->data) || 
IsLegacyDataFrame(skb->data)){
+   if ((!ieee->pHTInfo->bCurRxReorderEnable) || 
!ieee->current_network.qos_data.active|| !IsDataFrame(skb->data) || 
IsLegacyDataFrame(skb->data)) {
if (is_duplicate_packet(ieee, hdr))
goto rx_dropped;
 
@@ -1307,7 +1307,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct 
sk_buff *skb,
}
 
 //added by amy for reorder
-   if(ieee->pHTInfo->bCurRxReorderEnable == false ||pTS == NULL){
+   if (!ieee->pHTInfo->bCurRxReorderEnable || pTS == NULL){
 //added by amy for reorder
for(i = 0; inr_subframes; i++) {
struct sk_buff *sub_skb = rxb->subframes[i];
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
index a1f9d42..39e9892 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
@@ -1964,7 +1964,7 @@ static void ieee80211_check_auth_response(struct 
ieee80211_device *ieee,
}
 
if (ieee->current_network.mode == IEEE_N_24G &&
-   bHalfSupportNmode == true) {
+   bHalfSupportNmode) {
netdev_dbg(ieee->dev, "enter half N mode\n");
ieee->bHalfWirelessN24GMode = true;
} else
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c
index 5353a45..fff8d58 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c
@@ -336,12 +336,12 @@ static void ieee80211_tx_query_agg_cap(struct 
ieee80211_device *ieee,
printk("===>can't get TS\n");
return;
}
-   if (pTxTs->TxAdmittedBARecord.bValid == false)
+   if (!pTxTs->TxAdmittedBARecord.bValid)
{
TsStartAddBaProcess(ieee, pTxTs);
goto FORCED_AGG_SETTING;
}
-   else if (pTxTs->bUsingBa == false)
+   else if (!pTxTs->bUsingBa)
{
if 
(SN_LESS(pTxTs->TxAdmittedBARecord.BaStartSeqCtrl.field.SeqNum, 
(pTxTs->TxCurSeq+1)%4096))
pTxTs->bUsingBa = true;
diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c
index 9ff8e05..4fb77e5 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c
@@ -364,8 +364,8 @@ int ieee80211_rx_ADDBAReq(struct ieee80211_device *ieee, 
struct sk_buff *skb)
printk(">rx ADDBAREQ from :%pM\n", dst);
 //some other capability is not ready now.
if ((ieee->current_network.qos_data.active == 0) ||
-   (ieee->pHTInfo->bCurrentHTSupport == false)) //||
-   //  (ieee->pStaQos->bEnableRxImmBA == false))
+   (!ieee->pHTInfo->bCurrentHTSupport)) //||
+   //  (!ieee->pStaQos->bEnableRxImmBA))
{
rc = ADDBA_STATUS_REFUSED;
IEEE80211_DEBUG(IEEE80211_DL_ERR, "Failed to reply on ADDBA_REQ 
as some capability is not ready(%d, %d)\n", 
ieee->current_network.qos_data.active, ieee->pHTInfo->bCurrentHTSupport);
@@ -462,8 +462,8 @@ int ieee80211_rx_ADDBARsp(struct ieee80211_device *ieee, 
struct sk_buff *skb)
// Check the capability
// Since we can always receive A-MPDU, we just check if it is

[PATCH v6 2/2] staging: rtl8192u: remove unneeded bool

2015-07-20 Thread Luis de Bethencourt
bool Reval is set to match the value of bHalfWirelessN24GMode just to
this. The value can be returned directly. Removing uneeded bool.

Signed-off-by: Luis de Bethencourt 
Suggested-by: Joe Perches 
Suggested-by: Franks Klaver 
---
 drivers/staging/rtl8192u/r8192U_core.c | 9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index dd74813..6f6fe38 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -2043,16 +2043,9 @@ static bool GetNmodeSupportBySecCfg8192(struct 
net_device *dev)
 
 static bool GetHalfNmodeSupportByAPs819xUsb(struct net_device *dev)
 {
-   boolReval;
struct r8192_priv *priv = ieee80211_priv(dev);
-   struct ieee80211_device *ieee = priv->ieee80211;
-
-   if (ieee->bHalfWirelessN24GMode)
-   Reval = true;
-   else
-   Reval =  false;
 
-   return Reval;
+   return priv->ieee80211->bHalfWirelessN24GMode;
 }
 
 static void rtl8192_refresh_supportrate(struct r8192_priv *priv)
-- 
2.1.4

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


RE: staging drivers

2015-07-20 Thread Weiny, Ira
> On 07/17/2015 02:14 AM, Greg Kroah-Hartman (gre...@linuxfoundation.org)
> wrote:
> >
> > It's up to the IB maintainer if they are willing to let it be in
> > stable as-is.
> 
> I wouldn't call it stable as-is.  However, that doesn't mean I think it
> *must* go to staging.  It's a first cut at a totally new driver.  It's got 
> issues, but
> they aren't horrible by my estimate.  I don't consider staging a necessary 
> step,
> although I wouldn't preclude it either.

Doug,

>From this response it seems that the following would be an acceptable path 
>forward.

1) Mike submits V4 of the new driver patch set which has all the changes we 
have committed to thus far; document the sysfs use.
2) you accept this V4 patch set into the InfiniBand subtree.
3) Further changes to fix the issues you mention above happen incrementally via 
individual patches which can be easier to discuss on the mailing list.

The alternative which Mike was proposing was to change step 2 to be acceptance 
to Staging.  This is because we want to make sure that any changes we do are 
acceptable within the community and it is going to be difficult for the 
community to see how those changes are shaping up with massive driver patch 
sets where the bulk of the code is _not_ changing. 

> 
> > If so, sure, but it needs to be stand-alone and have a TODO file
> > listing what needs to be done.  If no forward progress happens on it,
> > I will delete it from the tree, this isn't a place for dumping code.
> 
> No, it's 50,000+ LOC already.  I don't see "no forward progress" as likely.
> 

This is why we are looking for a place to put the "base" code.  Then we can 
better discuss changes without resubmitting a new version of a 50K line patch 
set.

If going into the InfiniBand subtree is acceptable then we would prefer that.

Thanks,
Ira

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


Re: [PATCH] staging: ion: ion_cma_heap: Don't directly use dma_common_get_sgtable

2015-07-20 Thread Robin Murphy

Hi Laura,

On 17/07/15 17:50, Laura Abbott wrote:

On 07/17/2015 08:21 AM, Robin Murphy wrote:

Hi Tixy,

On 17/07/15 12:01, Jon Medhurst (Tixy) wrote:

Use dma_get_sgtable rather than dma_common_get_sgtable so a device's
dma_ops aren't bypassed. This is essential in situations where a device
uses an IOMMU and the physical memory is not contiguous (as the common
function assumes).

Signed-off-by: Jon Medhurst 


The lack of obvious users of this code makes it hard to tell if "dev"
  hereis always the right, real, device pointer and never null or some
  dummy device with the wrong dma_ops, but the rest of the calls in this
  file are to the proper DMA API interface so at least this patch definitely
  makes things less wrong in that respect.




Ion currently lacks any standard way to set up heaps and associate a device
with a heap. This means it's basically a free for all for what devices get
associated (getting something mainlined might help...). I agree that using
the proper DMA APIs is a step in the right direction.


I suspected as much, thanks for the confirmation.




Reviewed-by: Robin Murphy 


---

This also begs the question as to what happens if the memory region _is_
contiguous but is in highmem or an ioremapped region. Should a device
always provide dma_ops for that case? Because I believe the current
implementation of dma_common_get_sgtable won't work for those as it uses
virt_to_page.

I see that this point has been raised before [1] by Zeng Tao, and I
myself have been given a different fix to apply to a Linaro kernel tree.
However, both solutions looked wrong to me as they treat a dma_addr_t as
a physical address, so should at least be using dma_to_phys.
So, should we fix dma_common_get_sgtable or mandate that the device
has dma_ops? The latter seems to be implied by the commit message which
introduced the function:

  This patch provides a generic implementation based on
  virt_to_page() call. Architectures which require more
  sophisticated translation might provide their own get_sgtable()
  methods.


Given that we're largely here due to having poked this on arm64 systems,
  I'm inclined to think that implementing our own get_sgtable as per arch/arm
  is the right course of action. Since a lot of architectures using
  dma_common_get_sgtable don't even implement dma_to_phys, I don't think it
  would be right to try complicating the common code for a case that seems to
  be all but common. I can spin an arm64 patch if you like.



This would be hit on any system that has non-coherent DMA or highmem. I'm
not sure I agree this isn't a common case. How many of the other
architectures are actually using the dma_get_sgtable and would have the
potential to find a problem?


This appears to be pretty much exclusively a graphics/video thing. 
Surveying in-tree callers (other than Ion) gives DRM, V4L, and a couple 
of specific ARM SoC drivers - my hunch is that none of those see much 
action on the likes of Blackfin and 68k.


That said, going through the git logs, the primary purpose of 
dma_common_get_sgtable would appear to be not breaking allmodconfig 
builds on architectures other than ARM. Thus I'm not really sure which 
is the least worst option - having "common" code which doesn't actually 
represent the common use case, or adding bogus dma_to_phys definitions 
to loads of architectures that don't even have proper DMA mapping 
implementations for the sake of some code they don't even use...


Robin.



Thanks,
Laura



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


RE: [PATCH 5/5] Drivers: hv: vmbus: Implement a clocksource based on the TSC page

2015-07-20 Thread KY Srinivasan


> -Original Message-
> From: Dexuan Cui
> Sent: Monday, July 20, 2015 5:14 AM
> To: KY Srinivasan; gre...@linuxfoundation.org; linux-
> ker...@vger.kernel.org; de...@linuxdriverproject.org; o...@aepfle.de;
> a...@canonical.com; vkuzn...@redhat.com; jasow...@redhat.com
> Subject: RE: [PATCH 5/5] Drivers: hv: vmbus: Implement a clocksource based
> on the TSC page
> 
> > From: devel [mailto:driverdev-devel-bounces...linuxdriverproject.org] On
> Behalf
> > Of K. Y. Srinivasan
> > Sent: Monday, July 20, 2015 11:37
> >
> > The current Hyper-V clock source is based on the per-partition reference
> counter
> > and this counter is being accessed via s synthetic MSR -
> > HV_X64_MSR_TIME_REF_COUNT.
> > Hyper-V has a more efficient way of computing the per-partition reference
> > counter value that does not involve reading a synthetic MSR. We
> implement
> > a time source based on this mechanism.
> > ...
> > diff --git a/arch/x86/include/uapi/asm/hyperv.h
> > @@ -183,6 +233,22 @@ int hv_init(void)
> >
> > hv_context.hypercall_page = virtaddr;
> >
> > +#ifdef CONFIG_X86_64
> > +   if (ms_hyperv.features &
> HV_X64_MSR_REFERENCE_TSC_AVAILABLE) {
> > +   va_tsc = __vmalloc(PAGE_SIZE, GFP_KERNEL,
> PAGE_KERNEL);
> > +   if (!va_tsc)
> > +   goto cleanup;
> > +   hv_context.tsc_page = va_tsc;
> > +
> > +   rdmsrl(HV_X64_MSR_REFERENCE_TSC, tsc_msr.as_uint64);
> > +
> > +   tsc_msr.enable = 1;
> > +   tsc_msr.guest_physical_address = vmalloc_to_pfn(va_tsc);
> > +
> > +   wrmsrl(HV_X64_MSR_REFERENCE_TSC, tsc_msr.as_uint64);
> > +   clocksource_register_hz(&hyperv_cs_tsc,
> NSEC_PER_SEC/100);
> > +   }
> > +#endif
> 
> Should we disable the mechanism and vfree() the page in hv_cleanup() for
> kexec/kdump?

Thanks Dexuan. I will update the patch and resend.

Regards,

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


Re: [PATCH v6 1/2] staging: rtl8192u: remove bool comparisons

2015-07-20 Thread Dan Carpenter
On Mon, Jul 20, 2015 at 06:35:42PM +0200, Luis de Bethencourt wrote:
> Remove explicit true/false comparisons to bool variables.
> 
> Signed-off-by: Luis de Bethencourt 
> ---

Put a note here under the cut off why you are redoing this patch.

regards,
dan carpenter

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


RE: [PATCH net-next 1/1] hv_netvsc: Wait for sub-channels to be processed during probe

2015-07-20 Thread KY Srinivasan


> -Original Message-
> From: Dexuan Cui
> Sent: Monday, July 20, 2015 2:39 AM
> To: KY Srinivasan; da...@davemloft.net; net...@vger.kernel.org; linux-
> ker...@vger.kernel.org; de...@linuxdriverproject.org; o...@aepfle.de;
> a...@canonical.com; jasow...@redhat.com; vkuzn...@redhat.com
> Subject: RE: [PATCH net-next 1/1] hv_netvsc: Wait for sub-channels to be
> processed during probe
> 
> > From: KY Srinivasan
> > Sent: Friday, July 17, 2015 23:33
> > > From: Dexuan Cui
> > > Sent: Friday, July 17, 2015 3:01 AM
> > > > From: K. Y. Srinivasan
> > > > Sent: Friday, July 17, 2015 3:17
> > > > Subject: [PATCH net-next 1/1] hv_netvsc: Wait for sub-channels to be
> > > processed
> > > > during probe
> > > > diff --git a/drivers/net/hyperv/hyperv_net.h
> > > b/drivers/net/hyperv/hyperv_net.h
> > > > ...
> > > > @@ -1116,6 +1127,9 @@ int rndis_filter_device_add(struct hv_device
> > > *dev,
> > > >  num_possible_rss_qs = cpumask_weight(node_cpu_mask);
> > > >  net_device->num_chn = min(num_possible_rss_qs, num_rss_qs);
> > > >
> > > > +num_rss_qs = net_device->num_chn - 1;
> > > > +net_device->num_sc_offered = num_rss_qs;
> > > > +
> > > >  if (net_device->num_chn == 1)
> > > >  goto out;
> > > >
> > > > @@ -1157,11 +1171,22 @@ int rndis_filter_device_add(struct
> hv_device
> > > *dev,
> > > >
> > > >  ret = rndis_filter_set_rss_param(rndis_device, net_device-
> > > >num_chn);
> > > >
> > > > +/*
> > > > + * Wait for the host to send us the sub-channel offers.
> > > > + */
> > > > +spin_lock_irqsave(&net_device->sc_lock, flags);
> > > > +sc_delta = net_device->num_chn - 1 - num_rss_qs;
> > > > +net_device->num_sc_offered -= sc_delta;
> > >
> > > Hi KY,
> > > IMO here the "-= " should be "+="?
> > >
> > > I think sc_delta is usually <= 0, meaning the host may allocate less
> > > subchannels than
> > > we expect.
> > > With "-=", net_device->num_sc_offered can become bigger -- this
> doesn't
> > > seem correct.
> > We control how many sub-channels we want the host to offer (say
> > sc_requested). Based on this
> > number we begin to track how many have actually been processed - we
> > decrement sc_requested
> > each time a sub-channel offer is processed. If the host were to actually
> offer all
> > that we have requested,
> > then checking for sc_requested to be zero is sufficient to ensure that we
> have
> > processed all the
> > potentially in-flight sub-channels. However, the host  may choose to offer
> less
> > than what we had asked for
> > and the variable "delta" is tracking this difference. Since we are counting
> down
> > from what we had asked for
> > we have to subtract "delta" for proper accounting.
> 
> Yes, I understand the rationale.
> Let me show the issue by example:
> 
> Let's assume sc_requested is 7 and the host actually only offers 3 sub-
> channels:
> 1. Just before sending the NVSP_MSG5_TYPE_SUBCHANNEL message, we
> have
> net_device->num_chn == 8,
> num_rss_qs ==  7
> net_device->num_sc_offered == 7
> 
> 2. Just after we get the reply of the message,
> net_device->num_chn == 4
> sc_delta = net_device->num_chn - 1 - num_rss_qs, so sc_delta == 4 - 1 - 7 = -
> 4
> net_device->num_sc_offered -= sc_delta, so
> net_device->num_sc_offered == 7 - (-4) = 11. It's not zero, so we sleep on
> the
> wait_for_completion().
> 
> 3. Now we process the 3 sub-channel and net_device->num_sc_offered will
> become 11 -1 -1 -1 == 8 and no complete() will be invoked!
> 
> That's why I think the "-=" in the line
> net_device->num_sc_offered -= sc_delta
> should be "+=".

Thanks Dexuan; I will fix the issue and resend.

Regards,

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


Re: [PATCH v6 1/2] staging: rtl8192u: remove bool comparisons

2015-07-20 Thread Luis de Bethencourt
On Mon, Jul 20, 2015 at 09:54:56PM +0300, Dan Carpenter wrote:
> On Mon, Jul 20, 2015 at 06:35:42PM +0200, Luis de Bethencourt wrote:
> > Remove explicit true/false comparisons to bool variables.
> > 
> > Signed-off-by: Luis de Bethencourt 
> > ---
> 
> Put a note here under the cut off why you are redoing this patch.
> 
> regards,
> dan carpenter
> 

Hello Dan,

I should've explained it after the cut off. Sorry.

I redid patch 2/2 after a comment from Joe Perches. Then resubmitted both 1/2
and 2/2 to keep them in sync. Not sure that is the correct way to do it.

Thanks for looking at this,
Luis
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: fix to match 80-char rule

2015-07-20 Thread Mario Bambagini
On Sun, Jul 19, 2015 at 12:28:01PM -0700, Joe Perches wrote:
> On Sun, 2015-07-19 at 20:41 +0200, Mario Bambagini wrote:
> > Fixed comment line to match the 80-char rules.
> > The line contained 81 characters.
> > The file is fully compliant with the code style, now.
> > 
> > Signed-off-by: Mario Bambagini 
> > ---
> >  drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c 
> > b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c
> > index e5cc5be..931e45e 100644
> > --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c
> > +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c
> > @@ -24,7 +24,7 @@
> >License along with this program; if not, write to the
> >Free Software Foundation, Inc., 59 Temple Place -
> >Suite 330, Boston, MA 02111-1307, USA.
> > -  
> > -*/
> > +  
> > */
> 
> Perhaps it'd be nicer to use the normal comment block style
> 
> /*
>  * 
>  * 
>  */
> 
> Something like:
> ---
>  drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c | 56 
> 
>  1 file changed, 29 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c 
> b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c
> index e5cc5be..fc7d19f 100644
> --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c
> +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c
> @@ -1,30 +1,32 @@
> -/*---
> -  FT1000 driver for Flarion Flash OFDM NIC Device
> -
> -  Copyright (C) 1999 David A. Hinds.  All Rights Reserved.
> -  Copyright (C) 2002 Flarion Technologies, All rights reserved.
> -  Copyright (C) 2006 Patrik Ostrihon, All rights reserved.
> -  Copyright (C) 2006 ProWeb Consulting, a.s, All rights reserved.
> -
> -  The initial developer of the original code is David A. Hinds
> -  .  Portions created by David A. Hinds.
> -
> -  This file was modified to support the Flarion Flash OFDM NIC Device
> -  by Wai Chan (w.c...@flarion.com).
> -
> -  Port for kernel 2.6 created by Patrik Ostrihon (patrik.ostri...@pwc.sk)
> -
> -  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. You should have received a copy of the GNU General Public
> -  License along with this program; if not, write to the
> -  Free Software Foundation, Inc., 59 Temple Place -
> -  Suite 330, Boston, MA 02111-1307, USA.
> -  
> -*/
> +/*
> + *  FT1000 driver for Flarion Flash OFDM NIC Device
> + *
> + * Copyright (C) 1999 David A. Hinds.  All Rights Reserved.
> + * Copyright (C) 2002 Flarion Technologies, All rights reserved.
> + * Copyright (C) 2006 Patrik Ostrihon, All rights reserved.
> + * Copyright (C) 2006 ProWeb Consulting, a.s, All rights reserved.
> + *
> + * The initial developer of the original code is David A. Hinds
> + * .  Portions created by David A. Hinds.
> + *
> + * This file was modified to support the Flarion Flash OFDM NIC Device
> + * by Wai Chan (w.c...@flarion.com).
> + *
> + * Port for kernel 2.6 created by Patrik Ostrihon (patrik.ostri...@pwc.sk)
> + *
> + * 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 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.
> + *
> + * You should have received a copy of the GNU General Public License along 
> with
> + * this program.  If not, see .
> + */
>  
>  #include 
>  #include 
> 
> 

I agree, the normal comment is far better.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 2/4] staging/nvec: reimplement on top of tegra i2c driver

2015-07-20 Thread Andrey Danin
Remove i2c controller related code and use tegra i2c driver in slave mode.
Update nvec documentation.

Signed-off-by: Andrey Danin 
---
Changes for v3:
- resolve conflict: 'nvec != NULL' changed to '!nvec'

Changes for v2:
- remove extra new line
- keep old functions to simplify review
- move nvec_state enum to nvec.c
- use nvec-slave instead of nvec in dts to keep ABI compatibility
- rebased on top of new i2c slave framework
- delay workaround moved to tegra-i2c
- documentation patch is integrated in this commit
- reverted a log message to minimize changes

Signed-off-by: Andrey Danin 
---
 .../devicetree/bindings/nvec/nvidia,nvec.txt   |  21 +-
 drivers/staging/nvec/nvec.c| 258 +
 drivers/staging/nvec/nvec.h|  10 -
 3 files changed, 169 insertions(+), 120 deletions(-)

diff --git a/Documentation/devicetree/bindings/nvec/nvidia,nvec.txt 
b/Documentation/devicetree/bindings/nvec/nvidia,nvec.txt
index 5ae601e..aba34095 100644
--- a/Documentation/devicetree/bindings/nvec/nvidia,nvec.txt
+++ b/Documentation/devicetree/bindings/nvec/nvidia,nvec.txt
@@ -1,21 +1,6 @@
 NVIDIA compliant embedded controller
 
 Required properties:
-- compatible : should be "nvidia,nvec".
-- reg : the iomem of the i2c slave controller
-- interrupts : the interrupt line of the i2c slave controller
-- clock-frequency : the frequency of the i2c bus
-- gpios : the gpio used for ec request
-- slave-addr: the i2c address of the slave controller
-- clocks : Must contain an entry for each entry in clock-names.
-  See ../clocks/clock-bindings.txt for details.
-- clock-names : Must include the following entries:
-  Tegra20/Tegra30:
-  - div-clk
-  - fast-clk
-  Tegra114:
-  - div-clk
-- resets : Must contain an entry for each entry in reset-names.
-  See ../reset/reset.txt for details.
-- reset-names : Must include the following entries:
-  - i2c
+- compatible : should be "nvidia,nvec-slave".
+- reg: the i2c address of the slave controller
+- request-gpios : the gpio used for ec request
diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index 164634d..7da3dfe 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -25,8 +25,8 @@
 #include 
 #include 
 #include 
+#include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -39,25 +39,19 @@
 
 #include "nvec.h"
 
-#define I2C_CNFG   0x00
-#define I2C_CNFG_PACKET_MODE_EN(1<<10)
-#define I2C_CNFG_NEW_MASTER_SFM(1<<11)
-#define I2C_CNFG_DEBOUNCE_CNT_SHIFT12
-
-#define I2C_SL_CNFG0x20
-#define I2C_SL_NEWSL   (1<<2)
-#define I2C_SL_NACK(1<<1)
-#define I2C_SL_RESP(1<<0)
-#define I2C_SL_IRQ (1<<3)
-#define END_TRANS  (1<<4)
-#define RCVD   (1<<2)
-#define RNW(1<<1)
-
-#define I2C_SL_RCVD0x24
-#define I2C_SL_STATUS  0x28
-#define I2C_SL_ADDR1   0x2c
-#define I2C_SL_ADDR2   0x30
-#define I2C_SL_DELAY_COUNT 0x3c
+
+#define I2C_SL_ST_END_TRANS(1<<4)
+#define I2C_SL_ST_IRQ  (1<<3)
+#define I2C_SL_ST_RCVD (1<<2)
+#define I2C_SL_ST_RNW  (1<<1)
+
+
+enum nvec_state {
+   ST_NONE,
+   ST_RX,
+   ST_TX,
+   ST_TRANS_START,
+};
 
 /**
  * enum nvec_msg_category - Message categories for nvec_msg_alloc()
@@ -479,7 +473,7 @@ static void nvec_tx_completed(struct nvec_chip *nvec)
nvec->tx->pos = 0;
nvec_gpio_set_value(nvec, 0);
} else {
-   nvec->state = 0;
+   nvec->state = ST_NONE;
}
 }
 
@@ -497,7 +491,7 @@ static void nvec_rx_completed(struct nvec_chip *nvec)
   (uint) nvec->rx->pos);
 
nvec_msg_free(nvec, nvec->rx);
-   nvec->state = 0;
+   nvec->state = ST_NONE;
 
/* Battery quirk - Often incomplete, and likes to crash */
if (nvec->rx->data[0] == NVEC_BAT)
@@ -514,7 +508,7 @@ static void nvec_rx_completed(struct nvec_chip *nvec)
 
spin_unlock(&nvec->rx_lock);
 
-   nvec->state = 0;
+   nvec->state = ST_NONE;
 
if (!nvec_msg_is_event(nvec->rx))
complete(&nvec->ec_transfer);
@@ -522,6 +516,7 @@ static void nvec_rx_completed(struct nvec_chip *nvec)
schedule_work(&nvec->rx_work);
 }
 
+#if 0
 /**
  * nvec_invalid_flags - Send an error message about invalid flags and jump
  * @nvec: The nvec device
@@ -536,6 +531,7 @@ static void nvec_invalid_flags(struct nvec_chip *nvec, 
unsigned int status,
if (reset)
nvec->state = 0;
 }
+#endif /* FIXME: remove old code */
 
 /**
  * nvec_tx_set - Set the message to transfer (nvec->tx)
@@ -566,6 +562,8 @@ static void nvec_tx_set(struct nvec_chip *nvec)
(uint)nvec->tx->size, nvec->tx->data[1]);
 }
 
+
+#if 0

[PATCH v3 0/4] arm: tegra: implement NVEC driver using tegra i2c.

2015-07-20 Thread Andrey Danin
This version (v3) is for pushing tegra i2c driver to i2c tree.
NVEC driver will be reworked later to use i2c core slave framework.

NVEC driver contains code to manage tegra i2c controller in slave mode.
I2C slave support was implemented in linux kernel. The goal of this
patch serie is to implement I2C slave mode in tegra drived and rework
NVEC driver to use it.

Patches are based on i2c for-next.

Changes for v3:
- rebase on top of i2c for-next tree
- fix 10-bit address condition in tegra i2c driver

Changes for v2:
- rebased on top of new i2c slave framework.
- old code is removed in separate patch
- documentation patch is integrated to main nvec patch


Thanks in advance

*** BLURB HERE ***

Andrey Danin (4):
  i2c: tegra: implement slave mode
  staging/nvec: reimplement on top of tegra i2c driver
  staging/nvec: remove old code
  dt: paz00: define nvec as child of i2c bus

 .../devicetree/bindings/nvec/nvidia,nvec.txt   |  21 +-
 arch/arm/boot/dts/tegra20-paz00.dts|  22 +-
 drivers/i2c/busses/Kconfig |   1 +
 drivers/i2c/busses/i2c-tegra.c | 119 ++
 drivers/staging/nvec/nvec.c| 411 +++--
 drivers/staging/nvec/nvec.h|  10 -
 6 files changed, 269 insertions(+), 315 deletions(-)

-- 
1.9.1

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


[PATCH v3 3/4] staging/nvec: remove old code

2015-07-20 Thread Andrey Danin
Signed-off-by: Andrey Danin 
---
No changes for v3

No changes for v2

Signed-off-by: Andrey Danin 
---
 drivers/staging/nvec/nvec.c | 211 
 1 file changed, 211 deletions(-)

diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index 7da3dfe..fc0ee5c 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -516,23 +516,6 @@ static void nvec_rx_completed(struct nvec_chip *nvec)
schedule_work(&nvec->rx_work);
 }
 
-#if 0
-/**
- * nvec_invalid_flags - Send an error message about invalid flags and jump
- * @nvec: The nvec device
- * @status: The status flags
- * @reset: Whether we shall jump to state 0.
- */
-static void nvec_invalid_flags(struct nvec_chip *nvec, unsigned int status,
-  bool reset)
-{
-   dev_err(nvec->dev, "unexpected status flags 0x%02x during state %i\n",
-   status, nvec->state);
-   if (reset)
-   nvec->state = 0;
-}
-#endif /* FIXME: remove old code */
-
 /**
  * nvec_tx_set - Set the message to transfer (nvec->tx)
  * @nvec: A &struct nvec_chip
@@ -562,200 +545,6 @@ static void nvec_tx_set(struct nvec_chip *nvec)
(uint)nvec->tx->size, nvec->tx->data[1]);
 }
 
-
-#if 0
-/**
- * nvec_interrupt - Interrupt handler
- * @irq: The IRQ
- * @dev: The nvec device
- *
- * Interrupt handler that fills our RX buffers and empties our TX
- * buffers. This uses a finite state machine with ridiculous amounts
- * of error checking, in order to be fairly reliable.
- */
-static irqreturn_t nvec_interrupt(int irq, void *dev)
-{
-   unsigned long status;
-   unsigned int received = 0;
-   unsigned char to_send = 0xff;
-   const unsigned long irq_mask = I2C_SL_IRQ | END_TRANS | RCVD | RNW;
-   struct nvec_chip *nvec = dev;
-   unsigned int state = nvec->state;
-
-   status = readl(nvec->base + I2C_SL_STATUS);
-
-   /* Filter out some errors */
-   if ((status & irq_mask) == 0 && (status & ~irq_mask) != 0) {
-   dev_err(nvec->dev, "unexpected irq mask %lx\n", status);
-   return IRQ_HANDLED;
-   }
-   if ((status & I2C_SL_IRQ) == 0) {
-   dev_err(nvec->dev, "Spurious IRQ\n");
-   return IRQ_HANDLED;
-   }
-
-   /* The EC did not request a read, so it send us something, read it */
-   if ((status & RNW) == 0) {
-   received = readl(nvec->base + I2C_SL_RCVD);
-   if (status & RCVD)
-   writel(0, nvec->base + I2C_SL_RCVD);
-   }
-
-   if (status == (I2C_SL_IRQ | RCVD))
-   nvec->state = 0;
-
-   switch (nvec->state) {
-   case 0: /* Verify that its a transfer start, the rest later */
-   if (status != (I2C_SL_IRQ | RCVD))
-   nvec_invalid_flags(nvec, status, false);
-   break;
-   case 1: /* command byte */
-   if (status != I2C_SL_IRQ) {
-   nvec_invalid_flags(nvec, status, true);
-   } else {
-   nvec->rx = nvec_msg_alloc(nvec, NVEC_MSG_RX);
-   /* Should not happen in a normal world */
-   if (unlikely(nvec->rx == NULL)) {
-   nvec->state = 0;
-   break;
-   }
-   nvec->rx->data[0] = received;
-   nvec->rx->pos = 1;
-   nvec->state = 2;
-   }
-   break;
-   case 2: /* first byte after command */
-   if (status == (I2C_SL_IRQ | RNW | RCVD)) {
-   udelay(33);
-   if (nvec->rx->data[0] != 0x01) {
-   dev_err(nvec->dev,
-   "Read without prior read command\n");
-   nvec->state = 0;
-   break;
-   }
-   nvec_msg_free(nvec, nvec->rx);
-   nvec->state = 3;
-   nvec_tx_set(nvec);
-   BUG_ON(nvec->tx->size < 1);
-   to_send = nvec->tx->data[0];
-   nvec->tx->pos = 1;
-   } else if (status == (I2C_SL_IRQ)) {
-   BUG_ON(nvec->rx == NULL);
-   nvec->rx->data[1] = received;
-   nvec->rx->pos = 2;
-   nvec->state = 4;
-   } else {
-   nvec_invalid_flags(nvec, status, true);
-   }
-   break;
-   case 3: /* EC does a block read, we transmit data */
-   if (status & END_TRANS) {
-   nvec_tx_completed(nvec);
-   } else if ((status & RNW) == 0 || (status & RCVD)) {
-   nvec_invalid_flags(nvec, status, true);
-   } else i

[PATCH v3 4/4] dt: paz00: define nvec as child of i2c bus

2015-07-20 Thread Andrey Danin
NVEC driver was reimplemented to use tegra i2c. Use common i2c bindings
for NVEC node.

Signed-off-by: Andrey Danin 
---
No changes for v3:

Changes for v2:
- swap reg and request-gpios properties
- use nvec-slave instead of nvec to keep ABI compatibility
- place doc in separate patch

Signed-off-by: Andrey Danin 
---
 arch/arm/boot/dts/tegra20-paz00.dts | 22 +-
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/arch/arm/boot/dts/tegra20-paz00.dts 
b/arch/arm/boot/dts/tegra20-paz00.dts
index ed7e100..cd5e6ef 100644
--- a/arch/arm/boot/dts/tegra20-paz00.dts
+++ b/arch/arm/boot/dts/tegra20-paz00.dts
@@ -288,20 +288,16 @@
clock-frequency = <10>;
};
 
-   nvec@7000c500 {
-   compatible = "nvidia,nvec";
-   reg = <0x7000c500 0x100>;
-   interrupts = ;
-   #address-cells = <1>;
-   #size-cells = <0>;
+   i2c@7000c500 {
+   status = "okay";
clock-frequency = <8>;
-   request-gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_HIGH>;
-   slave-addr = <138>;
-   clocks = <&tegra_car TEGRA20_CLK_I2C3>,
-<&tegra_car TEGRA20_CLK_PLL_P_OUT3>;
-   clock-names = "div-clk", "fast-clk";
-   resets = <&tegra_car 67>;
-   reset-names = "i2c";
+
+   nvec: nvec@45 {
+   compatible = "nvidia,nvec-slave";
+   reg = <0x45>;
+   request-gpios = <&gpio TEGRA_GPIO(V, 2)
+   GPIO_ACTIVE_HIGH>;
+   };
};
 
i2c@7000d000 {
-- 
1.9.1

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


[PATCH v3 1/4] i2c: tegra: implement slave mode

2015-07-20 Thread Andrey Danin
Initialization code is based on NVEC driver.

There is a HW bug in AP20 that was also mentioned in kernel sources
for Toshiba AC100.

Signed-off-by: Andrey Danin 
---
Changes for v3:
- handle 10-bit clients properly

Changes for v2:
- remove hack from tegra_i2c_clock_disable
- replace slave status helper functions with local variables
- add constant for default delay count value
- add 10-bit address support
- remove read_slave_start_delay init as zero
- don't reset controller during slave registration
- slave isr returns int instead of bool
- make status related variables in slave u32 instead of unsigned int
- enable i2c slave in Kconfig
- rebase on top of new i2c slave framework
- delay workaround was added from nvec

Signed-off-by: Andrey Danin 
---
 drivers/i2c/busses/Kconfig |   1 +
 drivers/i2c/busses/i2c-tegra.c | 119 +
 2 files changed, 120 insertions(+)

diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index 0b798ae..3c02041 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -888,6 +888,7 @@ config I2C_SUN6I_P2WI
 config I2C_TEGRA
tristate "NVIDIA Tegra internal I2C controller"
depends on ARCH_TEGRA
+   select I2C_SLAVE
help
  If you say yes to this option, support will be included for the
  I2C controller embedded in NVIDIA Tegra SOCs
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 78a3668..f6ecd28 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -42,8 +42,17 @@
 #define I2C_SL_CNFG0x020
 #define I2C_SL_CNFG_NACK   (1<<1)
 #define I2C_SL_CNFG_NEWSL  (1<<2)
+#define I2C_SL_RCVD0x024
+#define I2C_SL_STATUS  0x028
+#define I2C_SL_ST_IRQ  (1<<3)
+#define I2C_SL_ST_END_TRANS(1<<4)
+#define I2C_SL_ST_RCVD (1<<2)
+#define I2C_SL_ST_RNW  (1<<1)
 #define I2C_SL_ADDR1   0x02c
 #define I2C_SL_ADDR2   0x030
+#define I2C_SL_ADDR2_TEN_BIT_MODE  1
+#define I2C_SL_DELAY_COUNT 0x03c
+#define I2C_SL_DELAY_COUNT_DEFAULT 0x1E
 #define I2C_TX_FIFO0x050
 #define I2C_RX_FIFO0x054
 #define I2C_PACKET_TRANSFER_STATUS 0x058
@@ -125,6 +134,8 @@ enum msg_end_type {
  * @clk_divisor_std_fast_mode: Clock divisor in standard/fast mode. It is
  * applicable if there is no fast clock source i.e. single clock
  * source.
+ * @slave_read_start_delay: Workaround for AP20 I2C Slave Controller bug. Delay
+ *  before writing data byte into register I2C_SL_RCVD.
  */
 
 struct tegra_i2c_hw_feature {
@@ -133,6 +144,7 @@ struct tegra_i2c_hw_feature {
bool has_single_clk_source;
int clk_divisor_hs_mode;
int clk_divisor_std_fast_mode;
+   int slave_read_start_delay;
 };
 
 /**
@@ -173,6 +185,7 @@ struct tegra_i2c_dev {
int msg_read;
u32 bus_clk_rate;
bool is_suspended;
+   struct i2c_client *slave;
 };
 
 static void dvc_writel(struct tegra_i2c_dev *i2c_dev, u32 val, unsigned long 
reg)
@@ -461,12 +474,78 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev)
return err;
 }
 
+static void tegra_i2c_slave_write(struct tegra_i2c_dev *i2c_dev, u32 val)
+{
+   i2c_writel(i2c_dev, val, I2C_SL_RCVD);
+
+   /*
+* TODO: A correct fix needs to be found for this.
+*
+* We experience less incomplete messages with this delay than without
+* it, but we don't know why. Help is appreciated.
+*/
+   udelay(100);
+}
+
+static int tegra_i2c_slave_isr(int irq, struct tegra_i2c_dev *i2c_dev)
+{
+   u32 status;
+   u8 value;
+   u8 dummy;
+   u32 is_slave_irq, is_read, is_trans_start, is_trans_end;
+
+   if (!i2c_dev->slave || !i2c_dev->slave->slave_cb)
+   return -EINVAL;
+
+   status = i2c_readl(i2c_dev, I2C_SL_STATUS);
+
+   is_slave_irq = (status & I2C_SL_ST_IRQ);
+   is_read = (status & I2C_SL_ST_RNW);
+   is_trans_start = (status & I2C_SL_ST_RCVD);
+   is_trans_end = (status & I2C_SL_ST_END_TRANS);
+
+   if (!is_slave_irq)
+   return -EINVAL;
+
+   /* master sent stop */
+   if (is_trans_end) {
+   i2c_slave_event(i2c_dev->slave, I2C_SLAVE_STOP, &dummy);
+   if (!is_trans_start)
+   return 0;
+   }
+
+   if (is_read) {
+   /* i2c master reads data from us */
+   i2c_slave_event(i2c_dev->slave,
+   is_trans_start ? I2C_SLAVE_READ_REQUESTED
+  : I2C_SLAVE_READ_PROCESSED,
+   &value);
+   

[PATCH V2 0/5] Drivers: hv: vmbus: Miscellaneous improvements and fixes

2015-07-20 Thread K. Y. Srinivasan
In addition to a bug fix and some improvements to the way we distribute channel
load amongst available CPUs, this patch set also includes an implementation of
a clocksource based on the TSC page that Hyper-V supports.

In this version, I have addressed comments from Dexuan Cui.

Christopher Oo (1):
  Drivers: hv_vmbus: Fix signal to host condition

Dexuan Cui (1):
  Drivers: hv: vmbus: Further improve CPU affiliation logic

K. Y. Srinivasan (2):
  Drivers: hv: vmbus: Improve the CPU affiliation for channels
  Drivers: hv: vmbus: Implement a clocksource based on the TSC page

Viresh Kumar (1):
  drivers/hv: Migrate to new 'set-state' interface

 arch/x86/include/uapi/asm/hyperv.h |2 +
 drivers/hv/channel_mgmt.c  |   29 ++--
 drivers/hv/hv.c|  135 +---
 drivers/hv/hyperv_vmbus.h  |   14 
 drivers/hv/ring_buffer.c   |   14 +---
 5 files changed, 151 insertions(+), 43 deletions(-)

-- 
1.7.4.1

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


[PATCH V2 5/5] Drivers: hv: vmbus: Implement a clocksource based on the TSC page

2015-07-20 Thread K. Y. Srinivasan
The current Hyper-V clock source is based on the per-partition reference counter
and this counter is being accessed via s synthetic MSR - 
HV_X64_MSR_TIME_REF_COUNT.
Hyper-V has a more efficient way of computing the per-partition reference
counter value that does not involve reading a synthetic MSR. We implement
a time source based on this mechanism.

Tested-by: Vivek Yadav 
Signed-off-by: K. Y. Srinivasan 
---
V2: Cleanup and unregister the clocksource as part of cleanup Dexuan 
Cui 

 arch/x86/include/uapi/asm/hyperv.h |2 +
 drivers/hv/hv.c|   81 
 drivers/hv/hyperv_vmbus.h  |9 
 3 files changed, 92 insertions(+), 0 deletions(-)

diff --git a/arch/x86/include/uapi/asm/hyperv.h 
b/arch/x86/include/uapi/asm/hyperv.h
index 8fba544..89f15e3 100644
--- a/arch/x86/include/uapi/asm/hyperv.h
+++ b/arch/x86/include/uapi/asm/hyperv.h
@@ -27,6 +27,8 @@
 #define HV_X64_MSR_VP_RUNTIME_AVAILABLE(1 << 0)
 /* Partition Reference Counter (HV_X64_MSR_TIME_REF_COUNT) available*/
 #define HV_X64_MSR_TIME_REF_COUNT_AVAILABLE(1 << 1)
+/* Partition reference TSC MSR is available */
+#define HV_X64_MSR_REFERENCE_TSC_AVAILABLE  (1 << 9)
 
 /* A partition's reference time stamp counter (TSC) page */
 #define HV_X64_MSR_REFERENCE_TSC   0x4021
diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index b9dd5e8..ab8d4b7 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -130,6 +130,54 @@ static u64 do_hypercall(u64 control, void *input, void 
*output)
 #endif /* !x86_64 */
 }
 
+static cycle_t read_hv_clock_tsc(struct clocksource *arg)
+{
+   cycle_t current_tick;
+   struct ms_hyperv_tsc_page *tsc_pg = hv_context.tsc_page;
+
+   if (tsc_pg->tsc_sequence != -1) {
+   /*
+* Use the tsc page to compute the value.
+*/
+
+   while (1) {
+   cycle_t tmp;
+   u32 sequence = tsc_pg->tsc_sequence;
+   u64 cur_tsc;
+   u64 scale = tsc_pg->tsc_scale;
+   s64 offset = tsc_pg->tsc_offset;
+
+   rdtscll(cur_tsc);
+   /* current_tick = ((cur_tsc *scale) >> 64) + offset */
+   asm("mulq %3"
+   : "=d" (current_tick), "=a" (tmp)
+   : "a" (cur_tsc), "r" (scale));
+
+   current_tick += offset;
+   if (tsc_pg->tsc_sequence == sequence)
+   return current_tick;
+
+   if (tsc_pg->tsc_sequence != -1)
+   continue;
+   /*
+* Fallback using MSR method.
+*/
+   break;
+   }
+   }
+   rdmsrl(HV_X64_MSR_TIME_REF_COUNT, current_tick);
+   return current_tick;
+}
+
+static struct clocksource hyperv_cs_tsc = {
+   .name   = "hyperv_clocksource_tsc_page",
+   .rating = 425,
+   .read   = read_hv_clock_tsc,
+   .mask   = CLOCKSOURCE_MASK(64),
+   .flags  = CLOCK_SOURCE_IS_CONTINUOUS,
+};
+
+
 /*
  * hv_init - Main initialization routine.
  *
@@ -139,7 +187,9 @@ int hv_init(void)
 {
int max_leaf;
union hv_x64_msr_hypercall_contents hypercall_msr;
+   union hv_x64_msr_hypercall_contents tsc_msr;
void *virtaddr = NULL;
+   void *va_tsc = NULL;
 
memset(hv_context.synic_event_page, 0, sizeof(void *) * NR_CPUS);
memset(hv_context.synic_message_page, 0,
@@ -183,6 +233,22 @@ int hv_init(void)
 
hv_context.hypercall_page = virtaddr;
 
+#ifdef CONFIG_X86_64
+   if (ms_hyperv.features & HV_X64_MSR_REFERENCE_TSC_AVAILABLE) {
+   va_tsc = __vmalloc(PAGE_SIZE, GFP_KERNEL, PAGE_KERNEL);
+   if (!va_tsc)
+   goto cleanup;
+   hv_context.tsc_page = va_tsc;
+
+   rdmsrl(HV_X64_MSR_REFERENCE_TSC, tsc_msr.as_uint64);
+
+   tsc_msr.enable = 1;
+   tsc_msr.guest_physical_address = vmalloc_to_pfn(va_tsc);
+
+   wrmsrl(HV_X64_MSR_REFERENCE_TSC, tsc_msr.as_uint64);
+   clocksource_register_hz(&hyperv_cs_tsc, NSEC_PER_SEC/100);
+   }
+#endif
return 0;
 
 cleanup:
@@ -216,6 +282,21 @@ void hv_cleanup(void)
vfree(hv_context.hypercall_page);
hv_context.hypercall_page = NULL;
}
+
+#ifdef CONFIG_X86_64
+   /*
+* Cleanup the TSC page based CS.
+*/
+   if (ms_hyperv.features & HV_X64_MSR_REFERENCE_TSC_AVAILABLE) {
+   clocksource_change_rating(&hyperv_cs_tsc, 10);
+   clocksource_unregister(&hyperv_cs_tsc);
+
+   hypercall_msr.as_uint64 = 0;
+   wrmsrl(HV_X64_MSR_REFERENCE_T

[PATCH V2 2/5] Drivers: hv: vmbus: Further improve CPU affiliation logic

2015-07-20 Thread K. Y. Srinivasan
From: Dexuan Cui 

Keep track of CPU affiliations of sub-channels within the scope of the primary
channel. This will allow us to better distribute the load amongst available
CPUs.

Signed-off-by: Dexuan Cui 
Signed-off-by: K. Y. Srinivasan 
---
 drivers/hv/channel_mgmt.c |   20 ++--
 include/linux/hyperv.h|1 +
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index f52373a..3ab4753 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -447,8 +447,24 @@ static void init_vp_index(struct vmbus_channel *channel, 
const uuid_le *type_gui
cpumask_xor(&available_mask, alloced_mask,
cpumask_of_node(primary->numa_node));
 
-   cur_cpu = cpumask_next(-1, &available_mask);
-   cpumask_set_cpu(cur_cpu, alloced_mask);
+   cur_cpu = -1;
+   while (true) {
+   cur_cpu = cpumask_next(cur_cpu, &available_mask);
+   if (cur_cpu >= nr_cpu_ids) {
+   cur_cpu = -1;
+   cpumask_copy(&available_mask,
+cpumask_of_node(primary->numa_node));
+   continue;
+   }
+
+   if (!cpumask_test_cpu(cur_cpu,
+   &primary->alloced_cpus_in_node)) {
+   cpumask_set_cpu(cur_cpu,
+   &primary->alloced_cpus_in_node);
+   cpumask_set_cpu(cur_cpu, alloced_mask);
+   break;
+   }
+   }
 
channel->target_cpu = cur_cpu;
channel->target_vp = hv_context.vp_index[cur_cpu];
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 34cf811..30d3a1f 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -699,6 +699,7 @@ struct vmbus_channel {
/*
 * State to manage the CPU affiliation of channels.
 */
+   struct cpumask alloced_cpus_in_node;
int numa_node;
/*
 * Support for sub-channels. For high performance devices,
-- 
1.7.4.1

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


[PATCH V2 3/5] Drivers: hv_vmbus: Fix signal to host condition

2015-07-20 Thread K. Y. Srinivasan
From: Christopher Oo 

Fixes a bug where previously hv_ringbuffer_read would pass in the old
number of bytes available to read instead of the expected old read index
when calculating when to signal to the host that the ringbuffer is empty.
Since the previous write size is already saved, also changes the
hv_need_to_signal_on_read to use the previously read value rather than
recalculating it.

Signed-off-by: Christopher Oo 
Signed-off-by: K. Y. Srinivasan 
---
 drivers/hv/ring_buffer.c |   14 +++---
 1 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c
index 6361d12..70a1a9a 100644
--- a/drivers/hv/ring_buffer.c
+++ b/drivers/hv/ring_buffer.c
@@ -103,10 +103,9 @@ static bool hv_need_to_signal(u32 old_write, struct 
hv_ring_buffer_info *rbi)
  *there is room for the producer to send the pending packet.
  */
 
-static bool hv_need_to_signal_on_read(u32 old_rd,
-struct hv_ring_buffer_info *rbi)
+static bool hv_need_to_signal_on_read(u32 prev_write_sz,
+ struct hv_ring_buffer_info *rbi)
 {
-   u32 prev_write_sz;
u32 cur_write_sz;
u32 r_size;
u32 write_loc = rbi->ring_buffer->write_index;
@@ -123,10 +122,6 @@ static bool hv_need_to_signal_on_read(u32 old_rd,
cur_write_sz = write_loc >= read_loc ? r_size - (write_loc - read_loc) :
read_loc - write_loc;
 
-   prev_write_sz = write_loc >= old_rd ? r_size - (write_loc - old_rd) :
-   old_rd - write_loc;
-
-
if ((prev_write_sz < pending_sz) && (cur_write_sz >= pending_sz))
return true;
 
@@ -517,7 +512,6 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info 
*inring_info, void *buffer,
u32 next_read_location = 0;
u64 prev_indices = 0;
unsigned long flags;
-   u32 old_read;
 
if (buflen <= 0)
return -EINVAL;
@@ -528,8 +522,6 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info 
*inring_info, void *buffer,
&bytes_avail_toread,
&bytes_avail_towrite);
 
-   old_read = bytes_avail_toread;
-
/* Make sure there is something to read */
if (bytes_avail_toread < buflen) {
spin_unlock_irqrestore(&inring_info->ring_lock, flags);
@@ -560,7 +552,7 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info 
*inring_info, void *buffer,
 
spin_unlock_irqrestore(&inring_info->ring_lock, flags);
 
-   *signal = hv_need_to_signal_on_read(old_read, inring_info);
+   *signal = hv_need_to_signal_on_read(bytes_avail_towrite, inring_info);
 
return 0;
 }
-- 
1.7.4.1

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


[PATCH V2 4/5] drivers/hv: Migrate to new 'set-state' interface

2015-07-20 Thread K. Y. Srinivasan
From: Viresh Kumar 

Migrate hv driver to the new 'set-state' interface provided by
clockevents core, the earlier 'set-mode' interface is marked obsolete
now.

This also enables us to implement callbacks for new states of clockevent
devices, for example: ONESHOT_STOPPED.

Cc: "K. Y. Srinivasan" 
Cc: Haiyang Zhang 
Cc: de...@linuxdriverproject.org
Signed-off-by: Viresh Kumar 
Signed-off-by: K. Y. Srinivasan 
---
 drivers/hv/hv.c |   45 +++--
 1 files changed, 19 insertions(+), 26 deletions(-)

diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index 85498a7..b9dd5e8 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -271,7 +271,7 @@ static int hv_ce_set_next_event(unsigned long delta,
 {
cycle_t current_tick;
 
-   WARN_ON(evt->mode != CLOCK_EVT_MODE_ONESHOT);
+   WARN_ON(!clockevent_state_oneshot(evt));
 
rdmsrl(HV_X64_MSR_TIME_REF_COUNT, current_tick);
current_tick += delta;
@@ -279,31 +279,24 @@ static int hv_ce_set_next_event(unsigned long delta,
return 0;
 }
 
-static void hv_ce_setmode(enum clock_event_mode mode,
- struct clock_event_device *evt)
+static int hv_ce_shutdown(struct clock_event_device *evt)
+{
+   wrmsrl(HV_X64_MSR_STIMER0_COUNT, 0);
+   wrmsrl(HV_X64_MSR_STIMER0_CONFIG, 0);
+
+   return 0;
+}
+
+static int hv_ce_set_oneshot(struct clock_event_device *evt)
 {
union hv_timer_config timer_cfg;
 
-   switch (mode) {
-   case CLOCK_EVT_MODE_PERIODIC:
-   /* unsupported */
-   break;
-
-   case CLOCK_EVT_MODE_ONESHOT:
-   timer_cfg.enable = 1;
-   timer_cfg.auto_enable = 1;
-   timer_cfg.sintx = VMBUS_MESSAGE_SINT;
-   wrmsrl(HV_X64_MSR_STIMER0_CONFIG, timer_cfg.as_uint64);
-   break;
-
-   case CLOCK_EVT_MODE_UNUSED:
-   case CLOCK_EVT_MODE_SHUTDOWN:
-   wrmsrl(HV_X64_MSR_STIMER0_COUNT, 0);
-   wrmsrl(HV_X64_MSR_STIMER0_CONFIG, 0);
-   break;
-   case CLOCK_EVT_MODE_RESUME:
-   break;
-   }
+   timer_cfg.enable = 1;
+   timer_cfg.auto_enable = 1;
+   timer_cfg.sintx = VMBUS_MESSAGE_SINT;
+   wrmsrl(HV_X64_MSR_STIMER0_CONFIG, timer_cfg.as_uint64);
+
+   return 0;
 }
 
 static void hv_init_clockevent_device(struct clock_event_device *dev, int cpu)
@@ -318,7 +311,8 @@ static void hv_init_clockevent_device(struct 
clock_event_device *dev, int cpu)
 * references to the hv_vmbus module making it impossible to unload.
 */
 
-   dev->set_mode = hv_ce_setmode;
+   dev->set_state_shutdown = hv_ce_shutdown;
+   dev->set_state_oneshot = hv_ce_set_oneshot;
dev->set_next_event = hv_ce_set_next_event;
 }
 
@@ -512,8 +506,7 @@ void hv_synic_cleanup(void *arg)
 
/* Turn off clockevent device */
if (ms_hyperv.features & HV_X64_MSR_SYNTIMER_AVAILABLE)
-   hv_ce_setmode(CLOCK_EVT_MODE_SHUTDOWN,
- hv_context.clk_evt[cpu]);
+   hv_ce_shutdown(hv_context.clk_evt[cpu]);
 
rdmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, shared_sint.as_uint64);
 
-- 
1.7.4.1

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


[PATCH V2 1/5] Drivers: hv: vmbus: Improve the CPU affiliation for channels

2015-07-20 Thread K. Y. Srinivasan
The current code tracks the assigned CPUs within a NUMA node in the context of
the primary channel. So, if we have a VM with a single NUMA node with 8 VCPUs, 
we may
end up unevenly distributing the channel load. Fix the issue by tracking 
affiliations
globally.

Signed-off-by: K. Y. Srinivasan 
---
 drivers/hv/channel_mgmt.c |   11 ++-
 drivers/hv/hv.c   |9 +
 drivers/hv/hyperv_vmbus.h |5 +
 include/linux/hyperv.h|1 -
 4 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index 4506a66..f52373a 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -391,6 +391,7 @@ static void init_vp_index(struct vmbus_channel *channel, 
const uuid_le *type_gui
struct vmbus_channel *primary = channel->primary_channel;
int next_node;
struct cpumask available_mask;
+   struct cpumask *alloced_mask;
 
for (i = IDE; i < MAX_PERF_CHN; i++) {
if (!memcmp(type_guid->b, hp_devs[i].guid,
@@ -408,7 +409,6 @@ static void init_vp_index(struct vmbus_channel *channel, 
const uuid_le *type_gui
 * channel, bind it to cpu 0.
 */
channel->numa_node = 0;
-   cpumask_set_cpu(0, &channel->alloced_cpus_in_node);
channel->target_cpu = 0;
channel->target_vp = hv_context.vp_index[0];
return;
@@ -433,21 +433,22 @@ static void init_vp_index(struct vmbus_channel *channel, 
const uuid_le *type_gui
channel->numa_node = next_node;
primary = channel;
}
+   alloced_mask = &hv_context.hv_numa_map[primary->numa_node];
 
-   if (cpumask_weight(&primary->alloced_cpus_in_node) ==
+   if (cpumask_weight(alloced_mask) ==
cpumask_weight(cpumask_of_node(primary->numa_node))) {
/*
 * We have cycled through all the CPUs in the node;
 * reset the alloced map.
 */
-   cpumask_clear(&primary->alloced_cpus_in_node);
+   cpumask_clear(alloced_mask);
}
 
-   cpumask_xor(&available_mask, &primary->alloced_cpus_in_node,
+   cpumask_xor(&available_mask, alloced_mask,
cpumask_of_node(primary->numa_node));
 
cur_cpu = cpumask_next(-1, &available_mask);
-   cpumask_set_cpu(cur_cpu, &primary->alloced_cpus_in_node);
+   cpumask_set_cpu(cur_cpu, alloced_mask);
 
channel->target_cpu = cur_cpu;
channel->target_vp = hv_context.vp_index[cur_cpu];
diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index d3943bc..85498a7 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -329,6 +329,13 @@ int hv_synic_alloc(void)
size_t ced_size = sizeof(struct clock_event_device);
int cpu;
 
+   hv_context.hv_numa_map = kzalloc(sizeof(struct cpumask) * nr_node_ids,
+GFP_ATOMIC);
+   if (hv_context.hv_numa_map == NULL) {
+   pr_err("Unable to allocate NUMA map\n");
+   goto err;
+   }
+
for_each_online_cpu(cpu) {
hv_context.event_dpc[cpu] = kmalloc(size, GFP_ATOMIC);
if (hv_context.event_dpc[cpu] == NULL) {
@@ -342,6 +349,7 @@ int hv_synic_alloc(void)
pr_err("Unable to allocate clock event device\n");
goto err;
}
+
hv_init_clockevent_device(hv_context.clk_evt[cpu], cpu);
 
hv_context.synic_message_page[cpu] =
@@ -390,6 +398,7 @@ void hv_synic_free(void)
 {
int cpu;
 
+   kfree(hv_context.hv_numa_map);
for_each_online_cpu(cpu)
hv_synic_free_cpu(cpu);
 }
diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h
index cddc0c9..7bdef66 100644
--- a/drivers/hv/hyperv_vmbus.h
+++ b/drivers/hv/hyperv_vmbus.h
@@ -551,6 +551,11 @@ struct hv_context {
 * Support PV clockevent device.
 */
struct clock_event_device *clk_evt[NR_CPUS];
+   /*
+* To manage allocations in a NUMA node.
+* Array indexed by numa node ID.
+*/
+   struct cpumask *hv_numa_map;
 };
 
 extern struct hv_context hv_context;
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 30d3a1f..34cf811 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -699,7 +699,6 @@ struct vmbus_channel {
/*
 * State to manage the CPU affiliation of channels.
 */
-   struct cpumask alloced_cpus_in_node;
int numa_node;
/*
 * Support for sub-channels. For high performance devices,
-- 
1.7.4.1

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


Re: [PATCH v3 2/4] staging/nvec: reimplement on top of tegra i2c driver

2015-07-20 Thread Stephen Warren

On 07/20/2015 02:35 PM, Andrey Danin wrote:

Remove i2c controller related code and use tegra i2c driver in slave mode.
Update nvec documentation.



diff --git a/Documentation/devicetree/bindings/nvec/nvidia,nvec.txt 
b/Documentation/devicetree/bindings/nvec/nvidia,nvec.txt


I would expect this patch to add a new binding file 
nvidia,nvec-slave.txt so that the filename continues to match the 
compatible value it documents. This patch introduces a new binding for 
the NVEC slave as opposed to modifying the existing binding.



+- compatible : should be "nvidia,nvec-slave".
+- reg: the i2c address of the slave controller


I think "the I2C address to respond to" would be clearer? You might also 
mention that this needs to include flags from .

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


Re: [PATCH v3 4/4] dt: paz00: define nvec as child of i2c bus

2015-07-20 Thread Stephen Warren

On 07/20/2015 02:35 PM, Andrey Danin wrote:

NVEC driver was reimplemented to use tegra i2c. Use common i2c bindings
for NVEC node.



diff --git a/arch/arm/boot/dts/tegra20-paz00.dts 
b/arch/arm/boot/dts/tegra20-paz00.dts



+   nvec: nvec@45 {
+   compatible = "nvidia,nvec-slave";
+   reg = <0x45>;


I think you need to or in I2C_OWN_SLAVE_ADDRESS from 
 here?

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


Re: [PATCH v6 1/2] staging: rtl8192u: remove bool comparisons

2015-07-20 Thread Frans Klaver
On 20 July 2015 21:42:39 CEST, Luis de Bethencourt  
wrote:
>On Mon, Jul 20, 2015 at 09:54:56PM +0300, Dan Carpenter wrote:
>> On Mon, Jul 20, 2015 at 06:35:42PM +0200, Luis de Bethencourt wrote:
>> > Remove explicit true/false comparisons to bool variables.
>> > 
>> > Signed-off-by: Luis de Bethencourt 
>> > ---
>> 
>> Put a note here under the cut off why you are redoing this patch.
>> 
>> regards,
>> dan carpenter
>> 
>
>Hello Dan,
>
>I should've explained it after the cut off. Sorry.
>
>I redid patch 2/2 after a comment from Joe Perches. Then resubmitted
>both 1/2
>and 2/2 to keep them in sync. Not sure that is the correct way to do
>it.

Just mention that there are no changes since last time in that case. 

Frans 


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


Re: [PATCH V3 1/2] staging: rtl8188eu: core: Fix space style errors

2015-07-20 Thread Sudip Mukherjee
On Mon, Jul 20, 2015 at 08:55:43AM +0200, Guillaume Bienkowski wrote:
> Signed-off-by: Guillaume Bienkowski 
> ---
you have not given anything in the commit message. Please mention which
type of space style issue you have corrected in the commit message. Same
for your next 2/2 patch also. There is no commit message.

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


Re: [PATCH 1/2] staging: lustre: obdclass: Make variables static.

2015-07-20 Thread Sudip Mukherjee
On Mon, Jul 20, 2015 at 02:15:35PM +0300, Cihangir Akturk wrote:
> obd_device_list_sops and obd_device_list_fops are not
> referenced outside of linux-module.c, so make them static.
And they are not modified also, so const ?

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


Re: [PATCH 1/2] staging: lustre: obdclass: Make variables static.

2015-07-20 Thread Sudip Mukherjee
On Tue, Jul 21, 2015 at 11:39:49AM +0530, Sudip Mukherjee wrote:
> On Mon, Jul 20, 2015 at 02:15:35PM +0300, Cihangir Akturk wrote:
> > obd_device_list_sops and obd_device_list_fops are not
> > referenced outside of linux-module.c, so make them static.
> And they are not modified also, so const ?
You have done that in 2/2 ...
sorry for the noise.
 
regards
sudip
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] staging: media: lirc: fix various checkpatch warnings

2015-07-20 Thread Sudip Mukherjee
On Mon, Jul 20, 2015 at 06:10:04PM +0200, Maciek Borzecki wrote:
> Remove unnecessary braces where appropriate. Fix non-tab
> indentation.
> 
> This removes the following checkpatch warnings:
> WARNING: braces {} are not necessary for single statement blocks
> 
> ERROR: code indent should use tabs where possible
That becomes 2 different types of change.
This change was in your v1 also, I didn't notice :(
Please do only one type of change in one patch,

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


Re: [PATCH v2] staging: media: lirc: fix various checkpatch warnings

2015-07-20 Thread Maciek Borzecki
On Tue, Jul 21, 2015 at 8:19 AM, Sudip Mukherjee
 wrote:
> On Mon, Jul 20, 2015 at 06:10:04PM +0200, Maciek Borzecki wrote:
>> Remove unnecessary braces where appropriate. Fix non-tab
>> indentation.
>>
>> This removes the following checkpatch warnings:
>> WARNING: braces {} are not necessary for single statement blocks
>>
>> ERROR: code indent should use tabs where possible
> That becomes 2 different types of change.
> This change was in your v1 also, I didn't notice :(
> Please do only one type of change in one patch,

Could you look at the second patch[1] for any potential issues as well?
I'll then resubmit the whole set to avoid going back and forth.

[1] http://article.gmane.org/gmane.linux.drivers.driver-project.devel/72155

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


Re: [PATCH v3 4/4] dt: paz00: define nvec as child of i2c bus

2015-07-20 Thread Andrey Danin

On 21.07.2015 1:19, Stephen Warren wrote:

On 07/20/2015 02:35 PM, Andrey Danin wrote:

NVEC driver was reimplemented to use tegra i2c. Use common i2c bindings
for NVEC node.



diff --git a/arch/arm/boot/dts/tegra20-paz00.dts
b/arch/arm/boot/dts/tegra20-paz00.dts



+nvec: nvec@45 {
+compatible = "nvidia,nvec-slave";
+reg = <0x45>;


I think you need to or in I2C_OWN_SLAVE_ADDRESS from
 here?


Sorry, I mentioned it in letter 0 only.
I will rework nvec driver and device tree according to i2c core slave 
implementation later. v3 of this patchset is for fixing tegra i2c driver 
only.

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


[PATCH] sm750fb: coding style fixes in _accel.h,__help.h

2015-07-20 Thread Vinay Simha BN
WARNING: line over 80 characters
comment block , odd statement fixes

Signed-off-by: Vinay Simha BN 
---
 drivers/staging/sm750fb/sm750_accel.h | 30 --
 drivers/staging/sm750fb/sm750_help.h  | 23 +--
 2 files changed, 21 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750_accel.h 
b/drivers/staging/sm750fb/sm750_accel.h
index da067a0..c56fa99 100644
--- a/drivers/staging/sm750fb/sm750_accel.h
+++ b/drivers/staging/sm750fb/sm750_accel.h
@@ -259,12 +259,18 @@ unsigned int height, /* width and height of rectangle in 
pixel value */
 unsigned int rop2);
 
 int hw_imageblit(struct lynx_accel *accel,
-const char *pSrcbuf, /* pointer to start of source
-   buffer in system memory */
-u32 srcDelta, /* Pitch value (in bytes) of the source buffer,
-   +ive means top down and -ive mean button up */
-u32 startBit, /* Mono data can start at any bit in a byte,
-this value should be 0 to 7 */
+const char *pSrcbuf,  /*
+   * pointer to start of source
+   * buffer in system memory
+   */
+u32 srcDelta, /*
+   * Pitch value (in bytes) of the source buffer,
+   * +ive means top down and -ive mean button up
+   */
+u32 startBit, /*
+   * Mono data can start at any bit in a byte,
+   * this value should be 0 to 7
+   */
 u32 dBase, /* Address of destination: offset in frame buffer */
 u32 dPitch,   /* Pitch value of destination surface in BYTE */
 u32 bytePerPixel,  /* Color depth of destination surface */
@@ -272,9 +278,13 @@ int hw_imageblit(struct lynx_accel *accel,
 u32 dy,   /* Starting coordinate of destination surface */
 u32 width,
 u32 height,   /* width and height of rectange in pixel value */
-u32 fColor,   /* Foreground color (corresponding to a 1 in the
-monochrome data */
-u32 bColor,   /* Background color (corresponding to a 0 in the
-monochrome data */
+u32 fColor,   /*
+   * Foreground color (corresponding to a 1 in the
+   * monochrome data
+   */
+u32 bColor,   /*
+   * Background color (corresponding to a 0 in the
+   * monochrome data
+   */
 u32 rop2);
 #endif
diff --git a/drivers/staging/sm750fb/sm750_help.h 
b/drivers/staging/sm750fb/sm750_help.h
index 43d700b..c9378e2 100644
--- a/drivers/staging/sm750fb/sm750_help.h
+++ b/drivers/staging/sm750fb/sm750_help.h
@@ -1,7 +1,7 @@
 #ifndef LYNX_HELP_H__
 #define LYNX_HELP_H__
 
-/*  FIELD MACROS */
+/* FIELD MACROS */
 #define _LSB(f) (0 ? f)
 #define _MSB(f) (1 ? f)
 #define _COUNT(f)   (_MSB(f) - _LSB(f) + 1)
@@ -46,27 +46,6 @@
~ _F_MASK(reg ## _ ## field) \
 )
 
-/* Field Macros */
-#define FIELD_START(field)  (0 ? field)
-#define FIELD_END(field)(1 ? field)
-#define FIELD_SIZE(field)   (1 + FIELD_END(field) - \
-   FIELD_START(field))
-#define FIELD_MASK(field)   (((1 << (FIELD_SIZE(field)-1)) \
-   | ((1 << (FIELD_SIZE(field)-1)) - 1)) \
-   << FIELD_START(field))
-#define FIELD_NORMALIZE(reg, field) (((reg) & FIELD_MASK(field)) >> \
-   FIELD_START(field))
-#define FIELD_DENORMALIZE(field, value) (((value) << FIELD_START(field)) & \
-FIELD_MASK(field))
-
-#define FIELD_INIT(reg, field, value)   FIELD_DENORMALIZE(reg ## _ ## field, \
- reg ## _ ## field ## _ ## value)
-#define FIELD_INIT_VAL(reg, field, value) \
-   (FIELD_DENORMALIZE(reg ## _ ## field, value))
-#define FIELD_VAL_SET(x, r, f, v)   x = x & ~FIELD_MASK(r ## _ ## f) \
-   | FIELD_DENORMALIZE(r ## _ ## f, \
-r ## _ ## f ## _ ## v)
-
 #define RGB(r, g, b) \
 ( \
(unsigned long) (((r) << 16) | ((g) << 8) | (b)) \
-- 
2.1.2

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