[PATCH 1/2] pinctrl: Don't override the error code in probe error handling

2013-05-18 Thread Axel Lin
Otherwise, we return 0 in probe error paths when gpiochip_remove() returns 0.
Also show error message if gpiochip_remove() fails.

Signed-off-by: Axel Lin 
Cc: Linus Walleij 
Cc: Maxime Ripard 
Cc: Tony Prisk 
---
 drivers/pinctrl/pinctrl-coh901.c | 3 ++-
 drivers/pinctrl/pinctrl-sunxi.c  | 3 ++-
 drivers/pinctrl/vt8500/pinctrl-wmt.c | 3 +--
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-coh901.c b/drivers/pinctrl/pinctrl-coh901.c
index 20da215..ea98df9 100644
--- a/drivers/pinctrl/pinctrl-coh901.c
+++ b/drivers/pinctrl/pinctrl-coh901.c
@@ -830,7 +830,8 @@ static int __init u300_gpio_probe(struct platform_device 
*pdev)
return 0;
 
 err_no_range:
-   err = gpiochip_remove(>chip);
+   if (gpiochip_remove(>chip))
+   dev_err(>dev, "failed to remove gpio chip\n");
 err_no_chip:
 err_no_domain:
 err_no_port:
diff --git a/drivers/pinctrl/pinctrl-sunxi.c b/drivers/pinctrl/pinctrl-sunxi.c
index c52fc2c..c058529 100644
--- a/drivers/pinctrl/pinctrl-sunxi.c
+++ b/drivers/pinctrl/pinctrl-sunxi.c
@@ -2000,7 +2000,8 @@ static int sunxi_pinctrl_probe(struct platform_device 
*pdev)
return 0;
 
 gpiochip_error:
-   ret = gpiochip_remove(pctl->chip);
+   if (gpiochip_remove(pctl->chip))
+   dev_err(>dev, "failed to remove gpio chip\n");
 pinctrl_error:
pinctrl_unregister(pctl->pctl_dev);
return ret;
diff --git a/drivers/pinctrl/vt8500/pinctrl-wmt.c 
b/drivers/pinctrl/vt8500/pinctrl-wmt.c
index e877082..fb30edf3 100644
--- a/drivers/pinctrl/vt8500/pinctrl-wmt.c
+++ b/drivers/pinctrl/vt8500/pinctrl-wmt.c
@@ -609,8 +609,7 @@ int wmt_pinctrl_probe(struct platform_device *pdev,
return 0;
 
 fail_range:
-   err = gpiochip_remove(>gpio_chip);
-   if (err)
+   if (gpiochip_remove(>gpio_chip))
dev_err(>dev, "failed to remove gpio chip\n");
 fail_gpio:
pinctrl_unregister(data->pctl_dev);
-- 
1.8.1.2



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] pwm: renesas-tpu: Add missing pwmchip_remove() call in tpu_remove()

2013-05-18 Thread Axel Lin
Signed-off-by: Axel Lin 
---
 drivers/pwm/pwm-renesas-tpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pwm/pwm-renesas-tpu.c b/drivers/pwm/pwm-renesas-tpu.c
index 8e6d8d7..351addd 100644
--- a/drivers/pwm/pwm-renesas-tpu.c
+++ b/drivers/pwm/pwm-renesas-tpu.c
@@ -444,7 +444,7 @@ static int tpu_remove(struct platform_device *pdev)
 
pm_runtime_disable(>dev);
 
-   return 0;
+   return pwmchip_remove(>chip);
 }
 
 static struct platform_driver tpu_driver = {
-- 
1.8.1.2



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


new mount is broken w/regard to devnames in /etc/fstab

2013-05-18 Thread Linda Walsh



There are 2 problems -- they are unlikely to be
directly related, but are in so much as they are in the new version
of mount.

1) How is one supposed to get the real root device?
It's not /dev/root -- and on my system /dev/root doesn't even exist.
(though to be fair, it has in the past -- udev musta got sloppy this time,
and did point to the real root device).  But how can I get /proc to display
the real root device instead of some fake name.   

It's insecure the way it is -- as /dev/root could be "anything"...

2) I'd like lvm's naming to be available through mount.  Ideally, lvm's
naming would be available in /proc/mounts...  At least, though
in going from /dev/VG/LV => /dev/mapper/VG-LV, that can be
scripted reliably to get the mount device name. 

But /dev/root?... How to script that, *reliably*...
And why the bogus name?




--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 0/2] i2c: fix two wrong mem release

2013-05-18 Thread Libo Chen

于 2013-5-17 17:43, Wolfram Sang 写道:

On Thu, May 09, 2013 at 04:27:22PM +0800, Libo Chen wrote:

>fix two wrong mem release
>
>* Changelog from v1:
>   * exchange out_error_no_irq and out_error_pin_mux  suggested by 
Sonic
>   * add some new tag , make code cleanly

Thanks for the submission. I do think the proper solution would be to
convert the drivers to use the devm_* mechanisms, though. You can check
commit 857968434bb6dbda0911f38ec46b0c3d0c963771 ("i2c: davinci: update
to devm_* API") as a reference.

Thanks,

Wolfram


Hi, Wolfram

   It is a good idea. I will learn about it.

Thanks,
Libo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/5] Driver core / MM: Drop offline_memory_block()

2013-05-18 Thread Greg Kroah-Hartman
On Sun, May 19, 2013 at 01:33:02AM +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki 
> 
> Since offline_memory_block(mem) is functionally equivalent to
> device_offline(>dev), make the only caller of the former use
> the latter instead and drop offline_memory_block() entirely.
> 
> Signed-off-by: Rafael J. Wysocki 

Acked-by: Greg Kroah-Hartman 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/5] ACPI: Drop removal_type field from struct acpi_device

2013-05-18 Thread Rafael J. Wysocki
From: Rafael J. Wysocki 

The ACPI processor driver was the only user of the removal_type
field in struct acpi_device, but it doesn't use that field any more
after recent changes.  Thus, removal_type has no more users, so drop
it along with the associated data type.

Signed-off-by: Rafael J. Wysocki 
---
 drivers/acpi/scan.c |2 --
 include/acpi/acpi_bus.h |8 
 2 files changed, 10 deletions(-)

Index: linux-pm/include/acpi/acpi_bus.h
===
--- linux-pm.orig/include/acpi/acpi_bus.h
+++ linux-pm/include/acpi/acpi_bus.h
@@ -63,13 +63,6 @@ acpi_get_physical_device_location(acpi_h
 #define ACPI_BUS_FILE_ROOT "acpi"
 extern struct proc_dir_entry *acpi_root_dir;
 
-enum acpi_bus_removal_type {
-   ACPI_BUS_REMOVAL_NORMAL = 0,
-   ACPI_BUS_REMOVAL_EJECT,
-   ACPI_BUS_REMOVAL_SUPRISE,
-   ACPI_BUS_REMOVAL_TYPE_COUNT
-};
-
 enum acpi_bus_device_type {
ACPI_BUS_TYPE_DEVICE = 0,
ACPI_BUS_TYPE_POWER,
@@ -311,7 +304,6 @@ struct acpi_device {
struct acpi_driver *driver;
void *driver_data;
struct device dev;
-   enum acpi_bus_removal_type removal_type;/* indicate for 
different removal type */
u8 physical_node_count;
struct list_head physical_node_list;
struct mutex physical_node_lock;
Index: linux-pm/drivers/acpi/scan.c
===
--- linux-pm.orig/drivers/acpi/scan.c
+++ linux-pm/drivers/acpi/scan.c
@@ -1036,7 +1036,6 @@ int acpi_device_add(struct acpi_device *
printk(KERN_ERR PREFIX "Error creating sysfs interface for 
device %s\n",
   dev_name(>dev));
 
-   device->removal_type = ACPI_BUS_REMOVAL_NORMAL;
return 0;
 
  err:
@@ -2026,7 +2025,6 @@ static acpi_status acpi_bus_device_detac
if (!acpi_bus_get_device(handle, )) {
struct acpi_scan_handler *dev_handler = device->handler;
 
-   device->removal_type = ACPI_BUS_REMOVAL_EJECT;
if (dev_handler) {
if (dev_handler->detach)
dev_handler->detach(device);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/5] ACPI / scan: Add second pass of companion offlining to hot-remove code

2013-05-18 Thread Rafael J. Wysocki
From: Rafael J. Wysocki 

As indicated by comments in mm/memory_hotplug.c:remove_memory(),
if CONFIG_MEMCG is set, it may not be possible to offline all of the
memory blocks held by one module (FRU) in one pass (because one of
them may be used by the others to store page cgroup in that case
and that block has to be offlined before the other ones).

To handle that arguably corner case, add a second pass of companion
device offlining to acpi_scan_hot_remove() and make it ignore errors
returned in the first pass (and make it skip the second pass if the
first one is successful).

Signed-off-by: Rafael J. Wysocki 
---
 drivers/acpi/scan.c |   67 ++--
 1 file changed, 50 insertions(+), 17 deletions(-)

Index: linux-pm/drivers/acpi/scan.c
===
--- linux-pm.orig/drivers/acpi/scan.c
+++ linux-pm/drivers/acpi/scan.c
@@ -131,6 +131,7 @@ static acpi_status acpi_bus_offline_comp
 {
struct acpi_device *device = NULL;
struct acpi_device_physical_node *pn;
+   bool second_pass = (bool)data;
acpi_status status = AE_OK;
 
if (acpi_bus_get_device(handle, ))
@@ -141,15 +142,26 @@ static acpi_status acpi_bus_offline_comp
list_for_each_entry(pn, >physical_node_list, node) {
int ret;
 
+   if (second_pass) {
+   /* Skip devices offlined by the first pass. */
+   if (pn->put_online)
+   continue;
+   } else {
+   pn->put_online = false;
+   }
ret = device_offline(pn->dev);
if (acpi_force_hot_remove)
continue;
 
-   if (ret < 0) {
-   status = AE_ERROR;
-   break;
+   if (ret >= 0) {
+   pn->put_online = !ret;
+   } else {
+   *ret_p = pn->dev;
+   if (second_pass) {
+   status = AE_ERROR;
+   break;
+   }
}
-   pn->put_online = !ret;
}
 
mutex_unlock(>physical_node_lock);
@@ -185,6 +197,7 @@ static int acpi_scan_hot_remove(struct a
acpi_handle not_used;
struct acpi_object_list arg_list;
union acpi_object arg;
+   struct device *errdev;
acpi_status status;
unsigned long long sta;
 
@@ -197,22 +210,42 @@ static int acpi_scan_hot_remove(struct a
 
lock_device_hotplug();
 
-   status = acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX,
-NULL, acpi_bus_offline_companions, NULL,
-NULL);
-   if (ACPI_SUCCESS(status) || acpi_force_hot_remove)
-   status = acpi_bus_offline_companions(handle, 0, NULL, NULL);
-
-   if (ACPI_FAILURE(status) && !acpi_force_hot_remove) {
-   acpi_bus_online_companions(handle, 0, NULL, NULL);
+   /*
+* Carry out two passes here and ignore errors in the first pass,
+* because if the devices in question are memory blocks and
+* CONFIG_MEMCG is set, one of the blocks may hold data structures
+* that the other blocks depend on, but it is not known in advance which
+* block holds them.
+*
+* If the first pass is successful, the second one isn't needed, though.
+*/
+   errdev = NULL;
+   acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX,
+   NULL, acpi_bus_offline_companions,
+   (void *)false, (void **));
+   acpi_bus_offline_companions(handle, 0, (void *)false, (void **));
+   if (errdev) {
+   errdev = NULL;
acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX,
-   acpi_bus_online_companions, NULL, NULL,
-   NULL);
+   NULL, acpi_bus_offline_companions,
+   (void *)true , (void **));
+   if (!errdev || acpi_force_hot_remove)
+   acpi_bus_offline_companions(handle, 0, (void *)true,
+   (void **));
+
+   if (errdev && !acpi_force_hot_remove) {
+   dev_warn(errdev, "Offline failed.\n");
+   acpi_bus_online_companions(handle, 0, NULL, NULL);
+   acpi_walk_namespace(ACPI_TYPE_ANY, handle,
+   ACPI_UINT32_MAX,
+   acpi_bus_online_companions, NULL,
+   NULL, NULL);
 
-   unlock_device_hotplug();
+   unlock_device_hotplug();
 
-   put_device(>dev);
-

[PATCH 0/5] ACPI / scan / memhotplug: ACPI hotplug rework followup changes

2013-05-18 Thread Rafael J. Wysocki
Hi,

This series contains changes that are possible on top of the linux-pm.git
tree's acpi-hotplug branch.  They touch ACPI, driver core and the core memory
hotplug code and the majority of them are about removing code that's not
necessary any more.

Please review and let me know if there's anything wrong with any of them.

[1/5] Drop the struct acpi_device's removal_type field that's not used any more.
[2/5] Pass processor object handle to acpi_bind_one()
[3/5] Replace offline_memory_block() with device_offline().
[4/5] Add second pass of companion offlining to acpi_scan_hot_remove().
[5/5] Drop ACPI memory hotplug code that's not necessary any more.

Thanks,
Rafael


-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 5/5] ACPI / memhotplug: Drop unnecessary code

2013-05-18 Thread Rafael J. Wysocki
From: Rafael J. Wysocki 

Now that the memory offlining should be taken care of by the
companion device offlining code in acpi_scan_hot_remove(), the
ACPI memory hotplug driver doesn't need to offline it in
acpi_memory_remove_memory() any more.  Consequently, it doesn't
need to call remove_memory() any more, which means that that
funtion may be dropped entirely, because acpi_memory_remove_memory()
is the only user of it.

Make the changes described above to get rid of the dead code.

Signed-off-by: Rafael J. Wysocki 
---
 drivers/acpi/acpi_memhotplug.c |   15 --
 include/linux/memory_hotplug.h |1 
 mm/memory_hotplug.c|  102 -
 3 files changed, 2 insertions(+), 116 deletions(-)

Index: linux-pm/drivers/acpi/acpi_memhotplug.c
===
--- linux-pm.orig/drivers/acpi/acpi_memhotplug.c
+++ linux-pm/drivers/acpi/acpi_memhotplug.c
@@ -271,31 +271,20 @@ static int acpi_memory_enable_device(str
return 0;
 }
 
-static int acpi_memory_remove_memory(struct acpi_memory_device *mem_device)
+static void acpi_memory_remove_memory(struct acpi_memory_device *mem_device)
 {
acpi_handle handle = mem_device->device->handle;
-   int result = 0, nid;
struct acpi_memory_info *info, *n;
 
-   nid = acpi_get_node(handle);
-
list_for_each_entry_safe(info, n, _device->res_list, list) {
if (!info->enabled)
continue;
 
-   if (nid < 0)
-   nid = memory_add_physaddr_to_nid(info->start_addr);
-
+   /* All of the memory blocks are offline at this point. */
acpi_unbind_memory_blocks(info, handle);
-   result = remove_memory(nid, info->start_addr, info->length);
-   if (result)
-   return result;
-
list_del(>list);
kfree(info);
}
-
-   return result;
 }
 
 static void acpi_memory_device_free(struct acpi_memory_device *mem_device)
Index: linux-pm/include/linux/memory_hotplug.h
===
--- linux-pm.orig/include/linux/memory_hotplug.h
+++ linux-pm/include/linux/memory_hotplug.h
@@ -252,7 +252,6 @@ extern int add_memory(int nid, u64 start
 extern int arch_add_memory(int nid, u64 start, u64 size);
 extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);
 extern bool is_memblock_offlined(struct memory_block *mem);
-extern int remove_memory(int nid, u64 start, u64 size);
 extern int sparse_add_one_section(struct zone *zone, unsigned long start_pfn,
int nr_pages);
 extern void sparse_remove_one_section(struct zone *zone, struct mem_section 
*ms);
Index: linux-pm/mm/memory_hotplug.c
===
--- linux-pm.orig/mm/memory_hotplug.c
+++ linux-pm/mm/memory_hotplug.c
@@ -1670,41 +1670,6 @@ int walk_memory_range(unsigned long star
 }
 
 #ifdef CONFIG_MEMORY_HOTREMOVE
-/**
- * offline_memory_block_cb - callback function for offlining memory block
- * @mem: the memory block to be offlined
- * @arg: buffer to hold error msg
- *
- * Always return 0, and put the error msg in arg if any.
- */
-static int offline_memory_block_cb(struct memory_block *mem, void *arg)
-{
-   int *ret = arg;
-   int error = device_offline(>dev);
-
-   if (error != 0 && *ret == 0)
-   *ret = error;
-
-   return 0;
-}
-
-static int is_memblock_offlined_cb(struct memory_block *mem, void *arg)
-{
-   int ret = !is_memblock_offlined(mem);
-
-   if (unlikely(ret)) {
-   phys_addr_t beginpa, endpa;
-
-   beginpa = PFN_PHYS(section_nr_to_pfn(mem->start_section_nr));
-   endpa = PFN_PHYS(section_nr_to_pfn(mem->end_section_nr + 1))-1;
-   pr_warn("removing memory fails, because memory "
-   "[%pa-%pa] is onlined\n",
-   , );
-   }
-
-   return ret;
-}
-
 static int check_cpu_on_node(void *data)
 {
struct pglist_data *pgdat = data;
@@ -1812,76 +1777,9 @@ void try_offline_node(int nid)
memset(pgdat, 0, sizeof(*pgdat));
 }
 EXPORT_SYMBOL(try_offline_node);
-
-int __ref remove_memory(int nid, u64 start, u64 size)
-{
-   unsigned long start_pfn, end_pfn;
-   int ret = 0;
-   int retry = 1;
-
-   start_pfn = PFN_DOWN(start);
-   end_pfn = PFN_UP(start + size - 1);
-
-   /*
-* When CONFIG_MEMCG is on, one memory block may be used by other
-* blocks to store page cgroup when onlining pages. But we don't know
-* in what order pages are onlined. So we iterate twice to offline
-* memory:
-* 1st iterate: offline every non primary memory block.
-* 2nd iterate: offline primary (i.e. first added) memory block.
-*/
-repeat:
-   

[PATCH 2/5] ACPI / processor: Pass processor object handle to acpi_bind_one()

2013-05-18 Thread Rafael J. Wysocki
From: Rafael J. Wysocki 

Make acpi_processor_add() pass the ACPI handle of the processor
namespace object to acpi_bind_one() instead of setting it directly
to allow acpi_bind_one() to catch possible bugs causing the ACPI
handle of the processor device to be set earlier.

Signed-off-by: Rafael J. Wysocki 
---
 drivers/acpi/acpi_processor.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Index: linux-pm/drivers/acpi/acpi_processor.c
===
--- linux-pm.orig/drivers/acpi/acpi_processor.c
+++ linux-pm/drivers/acpi/acpi_processor.c
@@ -389,8 +389,7 @@ static int __cpuinit acpi_processor_add(
per_cpu(processor_device_array, pr->id) = device;
 
dev = get_cpu_device(pr->id);
-   ACPI_HANDLE_SET(dev, pr->handle);
-   result = acpi_bind_one(dev, NULL);
+   result = acpi_bind_one(dev, pr->handle);
if (result)
goto err;
 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/5] Driver core / MM: Drop offline_memory_block()

2013-05-18 Thread Rafael J. Wysocki
From: Rafael J. Wysocki 

Since offline_memory_block(mem) is functionally equivalent to
device_offline(>dev), make the only caller of the former use
the latter instead and drop offline_memory_block() entirely.

Signed-off-by: Rafael J. Wysocki 
---
 drivers/base/memory.c  |   21 -
 include/linux/memory_hotplug.h |1 -
 mm/memory_hotplug.c|2 +-
 3 files changed, 1 insertion(+), 23 deletions(-)

Index: linux-pm/drivers/base/memory.c
===
--- linux-pm.orig/drivers/base/memory.c
+++ linux-pm/drivers/base/memory.c
@@ -735,27 +735,6 @@ int unregister_memory_section(struct mem
 }
 #endif /* CONFIG_MEMORY_HOTREMOVE */
 
-/*
- * offline one memory block. If the memory block has been offlined, do nothing.
- *
- * Call under device_hotplug_lock.
- */
-int offline_memory_block(struct memory_block *mem)
-{
-   int ret = 0;
-
-   mutex_lock(>state_mutex);
-   if (mem->state != MEM_OFFLINE) {
-   ret = __memory_block_change_state_uevent(mem, MEM_OFFLINE,
-MEM_ONLINE, -1);
-   if (!ret)
-   mem->dev.offline = true;
-   }
-   mutex_unlock(>state_mutex);
-
-   return ret;
-}
-
 /* return true if the memory block is offlined, otherwise, return false */
 bool is_memblock_offlined(struct memory_block *mem)
 {
Index: linux-pm/include/linux/memory_hotplug.h
===
--- linux-pm.orig/include/linux/memory_hotplug.h
+++ linux-pm/include/linux/memory_hotplug.h
@@ -251,7 +251,6 @@ extern int mem_online_node(int nid);
 extern int add_memory(int nid, u64 start, u64 size);
 extern int arch_add_memory(int nid, u64 start, u64 size);
 extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);
-extern int offline_memory_block(struct memory_block *mem);
 extern bool is_memblock_offlined(struct memory_block *mem);
 extern int remove_memory(int nid, u64 start, u64 size);
 extern int sparse_add_one_section(struct zone *zone, unsigned long start_pfn,
Index: linux-pm/mm/memory_hotplug.c
===
--- linux-pm.orig/mm/memory_hotplug.c
+++ linux-pm/mm/memory_hotplug.c
@@ -1680,7 +1680,7 @@ int walk_memory_range(unsigned long star
 static int offline_memory_block_cb(struct memory_block *mem, void *arg)
 {
int *ret = arg;
-   int error = offline_memory_block(mem);
+   int error = device_offline(>dev);
 
if (error != 0 && *ret == 0)
*ret = error;

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: REGRESSION: 3.10-rc1: Dell Latitude e6410 hangs within 3 seconds

2013-05-18 Thread Paul E. McKenney
On Sat, May 18, 2013 at 09:14:25AM +0200, Arend van Spriel wrote:
> On 05/18/13 03:47, Paul E. McKenney wrote:
> >On Fri, May 17, 2013 at 10:49:16PM +0200, Arend van Spriel wrote:
> >>On 05/14/2013 10:38 PM, Arend van Spriel wrote:
> >>>On 05/14/2013 10:34 PM, Rafael J. Wysocki wrote:
> On Tuesday, May 14, 2013 03:03:58 PM Arend van Spriel wrote:
> >Laptop hangs pretty soon after booting. Workaround for me was to turn
> >off ACPI on kernel command line, ie. acpi=off
> >
> >Attached is my kernel configuration.
> 
> Well, I have no idea what may be the source of this.
> >>>
> >>>Me neither.
> >>>
> Any chance to bisect?
> >>>
> >>>can try. Rebuilding kernels can be a drag :-p
> >>>
> >>>Regards,
> >>>Arend
> >>
> >>Hi Rafael,
> >>
> >>The bisect result found commit c0f4dfd4f as culprit. I also verified
> >>that the merge into Linus' tree introduced the issue upstream, ie.
> >>6c24499 works and 1f889ec does not. I tried to revert the commit,
> >>but that was a bit risky (conflict to resolve) and did not give me a
> >>stable kernel. The only thing that works is selecting acpi=off. I
> >>tried also nohz=off but that resulted in /init failure.
> >>
> >>Regards,
> >>Arend
> >>
> >>---8<
> >>
> >>commit 1f889ec62c3f0d8913f3c32f9aff2a1e15099346
> >>   Merge: 6c24499 8fcfae3
> >>
> >>   commit 8fcfae31719c0a6c03f2cf63f815b46d378d8be4
> >> Merge: d02a9a8 6d87669
> >>
> >> commit 6d87669357936bffa1e8fea7a4e7743e76905736
> >>   Merge: 3f944ad 81e5949 910ee45
> >>
> >>   commit c0f4dfd4f90f1667d234d21f15153ea09a2eaa66
> >>   Author: Paul E. McKenney
> >>   Date:   Fri Dec 28 11:30:36 2012 -0800
> >>
> >>   rcu: Make RCU_FAST_NO_HZ take advantage of numbered callbacks
> >>
> >>   Because RCU callbacks are now associated with the number
> >>   of the grace period that they must wait for, CPUs can now
> >>   take advance callbacks corresponding to grace periods that
> >>   ended while a given CPU was in dyntick-idle mode. This
> >>   eliminates the need to try forcing the RCU state machine
> >>   while entering idle, thus reducing the CPU intensiveness
> >>   of RCU_FAST_NO_HZ, which should increase its energy
> >>   efficiency.
> >>
> >>   Signed-off-by: Paul E. McKenney
> >>   Signed-off-by: Paul E. McKenney
> >
> >Hello, Arend,
> >
> >Thank you for tracking this down!  Could you please try out the following
> >patch?
> 
> Thanks, Paul
> 
> That did the trick. Made me bumping into another regression in the
> driver I am maintaining so more fun to do :-)
> 
> Looking at the commit message I guess it is already in some tree.
> Otherwise I would have said: "You may add
> 
> Tested-by: Arend van Spriel "

Thank you for trying it out, and glad that it worked for you!

And I did already send the pull request.  But if I need to re-send it,
I will update to add your Tested-by.

Thanx, Paul

> >
> >
> >rcu: Fix comparison sense in rcu_needs_cpu()
> >
> >Commit c0f4dfd4f (rcu: Make RCU_FAST_NO_HZ take advantage of numbered
> >callbacks) introduced a bug that can result in excessively long grace
> >periods.  This bug reverse the senes of the "if" statement checking
> 
> Oh, there is a typo in the commit message: sense iso senes.
> 
> >for lazy callbacks, so that RCU takes a lazy approach when there are
> >in fact non-lazy callbacks.  This can result in excessive boot, suspend,
> >and resume times.
> >
> >This commit therefore fixes the sense of this "if" statement.
> >
> >Reported-by: Borislav Petkov
> >Reported-by: Bjørn Mork
> >Reported-by: Joerg Roedel
> >Signed-off-by: Paul E. McKenney
> >Tested-by: Bjørn Mork
> >Tested-by: Joerg Roedel
> 
> Gr. AvS
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] of: irq: Pass trigger type in IRQ resource flags

2013-05-18 Thread Tomasz Figa
Some drivers might rely on availability of trigger flags in IRQ
resource, for example to configure the hardware for particular interrupt
type. However current code creating IRQ resources from data in device
tree does not configure trigger flags in resulting resources.

This patch solves the problem, based on the fact that
irq_of_parse_and_map() configures the trigger based on DT interrupt
specifier, IRQD_TRIGGER_* flags are consistent with IORESOURCE_IRQ_*,
and we can get trigger type by calling irqd_get_trigger_type() after
mapping the interrupt.

Signed-off-by: Tomasz Figa 
---
 drivers/of/irq.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index a3c1c5a..79a7a26 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -355,6 +355,16 @@ int of_irq_to_resource(struct device_node *dev, int index, 
struct resource *r)
r->start = r->end = irq;
r->flags = IORESOURCE_IRQ;
r->name = name ? name : dev->full_name;
+
+   /*
+* Some drivers might rely on availability of trigger flags
+* in IRQ resource. Since irq_of_parse_and_map() configures the
+* trigger based on interrupt specifier and IRQD_TRIGGER_*
+* flags are consistent with IORESOURCE_IRQ_*, we can get
+* trigger type that was just set and pass it through resource
+* flags as well.
+*/
+   r->flags |= irqd_get_trigger_type(irq_get_irq_data(irq));
}
 
return irq;
-- 
1.8.2.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ThunderLAN: remove is_eisa flag

2013-05-18 Thread Rolf Eike Beer
These 2 places are the only matches for is_eisa in the whole tree.

Signed-off-by: Rolf Eike Beer 
---
 drivers/net/ethernet/ti/tlan.c | 1 -
 drivers/net/ethernet/ti/tlan.h | 1 -
 2 files changed, 2 deletions(-)

diff --git a/drivers/net/ethernet/ti/tlan.c b/drivers/net/ethernet/ti/tlan.c
index 60c400f..59abfbc 100644
--- a/drivers/net/ethernet/ti/tlan.c
+++ b/drivers/net/ethernet/ti/tlan.c
@@ -533,7 +533,6 @@ static int tlan_probe1(struct pci_dev *pdev, long ioaddr, 
int irq, int rev,
/* This is a hack. We need to know which board structure
 * is suited for this adapter */
device_id = inw(ioaddr + EISA_ID2);
-   priv->is_eisa = 1;
if (device_id == 0x20F1) {
priv->adapter = _info[13]; /* NetFlex-3/E */
priv->adapter_rev = 23; /* TLAN 2.3 */
diff --git a/drivers/net/ethernet/ti/tlan.h b/drivers/net/ethernet/ti/tlan.h
index 5fc98a8..2eb33a2 100644
--- a/drivers/net/ethernet/ti/tlan.h
+++ b/drivers/net/ethernet/ti/tlan.h
@@ -207,7 +207,6 @@ struct tlan_priv {
u8  tlan_full_duplex;
spinlock_t  lock;
u8  link;
-   u8  is_eisa;
struct work_struct  tlan_tqueue;
u8  neg_be_verbose;
 };
-- 
1.8.1.4


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/5] drivers: net: usb: rtl8150: bug fixing and code cleanup

2013-05-18 Thread Francois Romieu
Petko Manolov  :
[...]
> This patch series adds rtl8150.h, which contains structure and constant 
> definitons formerly found in rtl8150.c, removes socket buffer 
> pre-allocated pool and uses dynamically allocated memory for the 
> asynchronous URB requests, thus avoids clobbering the previously scheduled 
> for update value.
> 
> This patch series is against 'net' tree.

'net' tree takes fixes. The cleanup / fix ratio is imho a bit high
in this series. You may submit the fix part now and wait until
davem merges 'net' into 'net-next' to submit big cleanups against
net-next.

-- 
Ueimor
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/9] Reduce system disruption due to kswapd V4

2013-05-18 Thread Zlatko Calusic

On 15.05.2013 22:37, Andrew Morton wrote:


 3.10.0-rc1  3.10.0-rc1
vanilla lessdisrupt-v4
Page Ins   1234608  101892
Page Outs 1244627211810468
Swap Ins283406   0
Swap Outs   698469   27882
Direct pages scanned 0  136480
Kswapd pages scanned   6266537 5369364
Kswapd pages reclaimed 1088989  930832
Direct pages reclaimed   0  120901
Kswapd efficiency  17% 17%
Kswapd velocity   5398.3714635.115
Direct efficiency 100% 88%
Direct velocity  0.000 117.817
Percentage direct scans 0%  2%
Page writes by reclaim 1655843 4009929
Page writes file957374 3982047
Page writes anon698469   27882
Page reclaim immediate52451745
Page rescued immediate   0   0
Slabs scanned33664   25216
Direct inode steals  0   0
Kswapd inode steals  19409 778


The reduction in inode steals might be a significant thing?
prune_icache_sb() does invalidate_mapping_pages() and can have the bad
habit of shooting down a vast number of pagecache pages (for a large
file) in a single hit.  Did this workload use large (and clean) files?
Did you run any test which would expose this effect?



I did not run specific tests, but I believe I observed exactly this 
issue on the real workload, where even at a moderate load sudden frees 
of pagecache happen quite often. I've attached a small graph where it 
can be easily seen. The snapshot was taken while the server was running 
an unpatched Linus kernel. After the Mel's patch series is applied, I 
can't see anything similar. So it seems that this issue is completely 
gone, Mel's done a wonderful job.


And BTW, V4 continues to be rock stable, running here on many different 
machines, so I look forward seeing this code merged in 3.11.

--
Zlatko
<>

Re: [PATCH 5/5] drivers: net: usb: rtl8150: bug fixing and cleanup

2013-05-18 Thread Francois Romieu
Petko Manolov  :
[...]
> @@ -681,16 +681,15 @@ static int rtl8150_ioctl(struct net_device *netdev, 
> struct ifreq *rq, int cmd)
>  }
>  
>  static const struct net_device_ops rtl8150_netdev_ops = {
> - .ndo_open   = rtl8150_open,
> - .ndo_stop   = rtl8150_close,
> - .ndo_do_ioctl   = rtl8150_ioctl,
> - .ndo_start_xmit = rtl8150_start_xmit,
> - .ndo_tx_timeout = rtl8150_tx_timeout,
> - .ndo_set_rx_mode= rtl8150_set_multicast,
> - .ndo_set_mac_address= rtl8150_set_mac_address,
> -
> - .ndo_change_mtu = eth_change_mtu,
> - .ndo_validate_addr  = eth_validate_addr,
> + .ndo_open = rtl8150_open,
> + .ndo_stop = rtl8150_close,
> + .ndo_do_ioctl = rtl8150_ioctl,
> + .ndo_start_xmit = rtl8150_start_xmit,
> + .ndo_tx_timeout = rtl8150_tx_timeout,
> + .ndo_set_rx_mode = rtl8150_set_multicast,
> + .ndo_set_mac_address = rtl8150_set_mac_address,
> + .ndo_change_mtu = eth_change_mtu,
> + .ndo_validate_addr = eth_validate_addr,

This is wrong.

> @@ -771,12 +770,12 @@ static void rtl8150_disconnect(struct usb_interface 
> *intf)
>  }
>  
>  static struct usb_driver rtl8150_driver = {
> - .name   = driver_name,
> - .probe  = rtl8150_probe,
> - .disconnect = rtl8150_disconnect,
> - .id_table   = rtl8150_table,
> - .suspend= rtl8150_suspend,
> - .resume = rtl8150_resume,
> + .name = driver_name,
> + .probe = rtl8150_probe,
> + .disconnect = rtl8150_disconnect,
> + .id_table = rtl8150_table,
> + .suspend = rtl8150_suspend,
> + .resume = rtl8150_resume,
>   .disable_hub_initiated_lpm = 1,

Sic.

-- 
Ueimor
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 4/5] drivers: net: usb: rtl8150: bug fixing and cleanup

2013-05-18 Thread Francois Romieu
Petko Manolov  :
[...]
>  static int set_registers(rtl8150_t * dev, u16 indx, u16 size, void *data)
>  {
> - return usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0),
> -RTL8150_REQ_SET_REGS, RTL8150_REQT_WRITE,
> -indx, 0, data, size, 500);
> + int res;
> +
> + res = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0),
> +   RTL8150_REQ_SET_REGS, RTL8150_REQT_WRITE,
> +   indx, 0, data, size, 500);
> + if (res < 0)
> + dev_dbg(>udev->dev, "%s returned %d\n", __func__, res);
> + return res;

You may move it into a separate patch. It is completely unrelated to the
ctrl_urb changes.

[...]
> +static int async_set_registers(rtl8150_t *dev, u16 indx, u16 size, u16 reg)
>  {

[...]
> + usb_fill_control_urb(async_urb, dev->udev,
> +  usb_sndctrlpipe(dev->udev, 0), (void *) >dr,

Useless void * cast.

-- 
Ueimor
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/5] drivers: net: usb: rtl8150: bug fixing and cleanup

2013-05-18 Thread Francois Romieu
Petko Manolov  :
> From: Petko Manolov 
> 
> Moving constant and structure definitions out of rtl8150.c;

What's the point ?

[...]
> ---
>  drivers/net/usb/rtl8150.c |  121 +--
>  1 file changed, 2 insertions(+), 119 deletions(-)
> 
> diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
> index a491d3a..7d1897b 100644
> --- a/drivers/net/usb/rtl8150.c
> +++ b/drivers/net/usb/rtl8150.c
> @@ -17,132 +17,15 @@
>  #include 
>  #include 
>  
> +#include "rtl8150.h"

It won't compile. You shouldn't do that.

-- 
Ueimor
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/5] drivers: net: usb: rtl8150: bug fixing and cleanup

2013-05-18 Thread Francois Romieu
Petko Manolov  :
[...]
> diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
> index 7d1897b..fd4bc2a 100644
> --- a/drivers/net/usb/rtl8150.c
> +++ b/drivers/net/usb/rtl8150.c
[...]
>  static void rx_fixup(unsigned long data)
>  {
>   struct rtl8150 *dev = (struct rtl8150 *)data;
>   struct sk_buff *skb;
>   int status;
>  
> - spin_lock_irq(>rx_pool_lock);
> - fill_skb_pool(dev);
> - spin_unlock_irq(>rx_pool_lock);
>   if (test_bit(RX_URB_FAIL, >flags))
>   if (dev->rx_skb)
>   goto try_again;
> - spin_lock_irq(>rx_pool_lock);
> - skb = pull_skb(dev);
> - spin_unlock_irq(>rx_pool_lock);
> + skb = __netdev_alloc_skb_ip_align(dev->netdev, RTL8150_MTU, GFP_ATOMIC);

You can use plain netdev_alloc_skb_ip_align.

-- 
Ueimor
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[ANN] Backports based on v3.10-rc1 released

2013-05-18 Thread Luis R. Rodriguez
As announced on the list the compat-drivers project was renamed to
backports [0] and uses now only one new tree for development [1]. Due
to the huge amount of changes we've been behind on linux-next daily
snapshots but we've now caught up with Linus so a release based on
v3.10-rc1 is due and is now available [2]. Please test ! There are
tons of changes in terms of how we do backports that should make it
easier and consistent to backport drivers and subsystems thanks mainly
to Johannes' huge changes. As it is now most if not all development
scripts have been converted to Python, except for scripts required on
the user's part for installation.

As for user's experience you no longer have to use the silly
./scripts/drivers-select script to enable only one driver for
compilation, you just type in

make menuconfig
make -j 4
# Then as root:
make install

There are also a series of defconfigs, present on the defconfig
directory, you can use the iwlwifi defconfig as follows for example:

make defconfig-iwlwifi

We need more defconfigs! Please feel free to send your submissions.
I'm willing to merge these in for the rc series prior to the final
release. Apart from these changes we now also backport three new
subsystems: NFC, media and regulator subsystems. For NFC we have 8 new
drivers. For media we ended up backporting 433 new drivers. For
regulator we backported 37 new drivers.

Many thanks to Johannes, Samuel, and Hauke for their huge help with
all these new changes. Now please go test!

[0] http://marc.info/?l=linux-backports=136891011622088=2
[1] git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/backports.git
[2] 
https://www.kernel.org/pub/linux/kernel/projects/backports/stable/v3.10-rc1/backports-3.10-rc1-1.tar.bz2

  Luis
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[ANN] compat-drivers renamed to backports

2013-05-18 Thread Luis R. Rodriguez
Folks as you may already know compat-drivers was renamed to backports
to avoid any confusion with the in-kernel compat code that deals with
32/64 bit compat work and due to some huge amount of changes that went
into the project recently thanks mainly to Johannes. The new tree is
available here:

git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/backports.git

This tree doesn't have the old stable branches yet but I'll merge them
soon. Use the master branch for ongoing linux-next daily development.
We used to have compat and compat-drivers, with this new rework we
just use one tree.

Contrary to the old way to doing things you can't any longer use the
base tree to compile anything within the same directory. You're now
expected to take things out. The way to generate a new tree to compile
as an example:

./gentree.py /home/mcgrof/linux-next/ /home/mcgrof/build/backports-20130501

As it stands we have tested backports master up to next-20130502. This
leaves 11 more next tags to catch up to linux-next. We're behind given
the huge amount of work that went into this development cycle.
Fortunately though we're now caught up with Linus though and this
means a new branch for a stable release is due which I'll announce
next.

  Luis
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: regression: from 3.8 to 3.9: headphones output no sound on Intel HDA, codec VIA VT1802

2013-05-18 Thread Alex Riesen
Sorry for delayed replies. I have not much time for this lately.

On Fri, May 17, 2013 at 8:04 AM, Takashi Iwai  wrote:
>> Well... It seems that something went unnoticed. This command seems
>> to be essential for this (and the revised) patch to get the headphone
>> output at all:
>>
>> hda-verb /dev/snd/hwC0D0 0x25 SET_PIN_WID 0xc0
>
> Do you mean that the headphone doesn't work without this even after
> the patch?  It's weird that the alsa-info.sh output you attached below
> already contains it, i.e. 0x25 showing 0xc0.

Yes. It is after the latest patch.

> Or, is the attached output the result after you ran hda-verb like the
> above?

Er, yes.

>> It does. And there is no output from the speakers.
>
> Hmm.  I'm confused.  I thought you mentioned that the speaker is
> unmuted?

I think I am as confused as you, if not more. I redid the tests
but recorded everything this time with script(1). It is without
timing information (would be boring anyway, with me figuring
the arguments), so just cat it. Just in case: it sets xterm title.
The transcript is in headphone.gz.

> - Use the patched kernel, play without headphone, confirm that the
>   speaker works.  Get alsa-info.sh output at this point.

That's 3.9.2-wo-headphone.alsa.gz

> - Plug the headphone, play, and check whether the headphone works and
>   the speaker is muted.
>   Again, get alsa-info.sh output at this point, no matter whether the
>   headphone works or not.

That's 3.9.2-w-headphone.alsa.gz. Headphone not working, speakers
correctly muted.

> In anyway, if you make things working, please give exactly what you
> did, and take again alsa-info.sh output, too.

3.9.2-w-headphone-working.alsa.gz. The working state is lost after
unplugging and replugging the headphones. It is different to the
case when the alternate channel is used (Independent HP): replugging
does not break the output than.

Sorry for confusion and thanks!

Regards,
Alex


headphone.gz
Description: GNU Zip compressed data


3.9.2-wo-headphone.alsa.gz
Description: GNU Zip compressed data


3.9.2-w-headphone.alsa.gz
Description: GNU Zip compressed data


3.9.2-w-headphone-working.alsa.gz
Description: GNU Zip compressed data


3.9.2-headphone-replugs-w-altchannel.alsa.gz
Description: GNU Zip compressed data


[PATCH 1/5] drivers: net: usb: rtl8150: moving constant and structure definitions out of rtl8150.c

2013-05-18 Thread Petko Manolov
From: Petko Manolov 

Moving constant and structure definitions out of rtl8150.c;

Signed-off-by: Petko Manolov 
---
 drivers/net/usb/rtl8150.c |  121 +--
 1 file changed, 2 insertions(+), 119 deletions(-)

diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
index a491d3a..7d1897b 100644
--- a/drivers/net/usb/rtl8150.c
+++ b/drivers/net/usb/rtl8150.c
@@ -17,132 +17,15 @@
 #include 
 #include 
 
+#include "rtl8150.h"
+
 /* Version Information */
 #define DRIVER_VERSION "v0.6.2 (2004/08/27)"
 #define DRIVER_AUTHOR "Petko Manolov "
 #define DRIVER_DESC "rtl8150 based usb-ethernet driver"
 
-#defineIDR 0x0120
-#defineMAR 0x0126
-#defineCR  0x012e
-#defineTCR 0x012f
-#defineRCR 0x0130
-#defineTSR 0x0132
-#defineRSR 0x0133
-#defineCON00x0135
-#defineCON10x0136
-#defineMSR 0x0137
-#definePHYADD  0x0138
-#definePHYDAT  0x0139
-#definePHYCNT  0x013b
-#defineGPPC0x013d
-#defineBMCR0x0140
-#defineBMSR0x0142
-#defineANAR0x0144
-#defineANLP0x0146
-#defineAER 0x0148
-#define CSCR   0x014C  /* This one has the link status */
-#define CSCR_LINK_STATUS   (1 << 3)
-
-#defineIDR_EEPROM  0x1202
-
-#definePHY_READ0
-#definePHY_WRITE   0x20
-#definePHY_GO  0x40
-
-#defineMII_TIMEOUT 10
-#defineINTBUFSIZE  8
-
-#defineRTL8150_REQT_READ   0xc0
-#defineRTL8150_REQT_WRITE  0x40
-#defineRTL8150_REQ_GET_REGS0x05
-#defineRTL8150_REQ_SET_REGS0x05
-
-
-/* Transmit status register errors */
-#define TSR_ECOL   (1<<5)
-#define TSR_LCOL   (1<<4)
-#define TSR_LOSS_CRS   (1<<3)
-#define TSR_JBR(1<<2)
-#define TSR_ERRORS (TSR_ECOL | TSR_LCOL | TSR_LOSS_CRS | TSR_JBR)
-/* Receive status register errors */
-#define RSR_CRC(1<<2)
-#define RSR_FAE(1<<1)
-#define RSR_ERRORS (RSR_CRC | RSR_FAE)
-
-/* Media status register definitions */
-#define MSR_DUPLEX (1<<4)
-#define MSR_SPEED  (1<<3)
-#define MSR_LINK   (1<<2)
-
-/* Interrupt pipe data */
-#define INT_TSR0x00
-#define INT_RSR0x01
-#define INT_MSR0x02
-#define INT_WAKSR  0x03
-#define INT_TXOK_CNT   0x04
-#define INT_RXLOST_CNT 0x05
-#define INT_CRERR_CNT  0x06
-#define INT_COL_CNT0x07
-
-
-#defineRTL8150_MTU 1540
-#defineRTL8150_TX_TIMEOUT  (HZ)
-#defineRX_SKB_POOL_SIZE4
-
-/* rtl8150 flags */
-#defineRTL8150_HW_CRC  0
-#defineRX_REG_SET  1
-#defineRTL8150_UNPLUG  2
-#defineRX_URB_FAIL 3
-
-/* Define these values to match your device */
-#defineVENDOR_ID_REALTEK   0x0bda
-#defineVENDOR_ID_MELCO 0x0411
-#defineVENDOR_ID_MICRONET  0x3980
-#defineVENDOR_ID_LONGSHINE 0x07b8
-#defineVENDOR_ID_OQO   0x1557
-#defineVENDOR_ID_ZYXEL 0x0586
-
-#define PRODUCT_ID_RTL8150 0x8150
-#definePRODUCT_ID_LUAKTX   0x0012
-#definePRODUCT_ID_LCS8138TX0x401a
-#define PRODUCT_ID_SP128AR 0x0003
-#definePRODUCT_ID_PRESTIGE 0x401a
-
-#undef EEPROM_WRITE
-
-/* table of devices that work with this driver */
-static struct usb_device_id rtl8150_table[] = {
-   {USB_DEVICE(VENDOR_ID_REALTEK, PRODUCT_ID_RTL8150)},
-   {USB_DEVICE(VENDOR_ID_MELCO, PRODUCT_ID_LUAKTX)},
-   {USB_DEVICE(VENDOR_ID_MICRONET, PRODUCT_ID_SP128AR)},
-   {USB_DEVICE(VENDOR_ID_LONGSHINE, PRODUCT_ID_LCS8138TX)},
-   {USB_DEVICE(VENDOR_ID_OQO, PRODUCT_ID_RTL8150)},
-   {USB_DEVICE(VENDOR_ID_ZYXEL, PRODUCT_ID_PRESTIGE)},
-   {}
-};
-
 MODULE_DEVICE_TABLE(usb, rtl8150_table);
 
-struct rtl8150 {
-   unsigned long flags;
-   struct usb_device *udev;
-   struct tasklet_struct tl;
-   struct net_device *netdev;
-   struct urb *rx_urb, *tx_urb, *intr_urb, *ctrl_urb;
-   struct sk_buff *tx_skb, *rx_skb;
-   struct sk_buff *rx_skb_pool[RX_SKB_POOL_SIZE];
-   spinlock_t rx_pool_lock;
-   struct usb_ctrlrequest dr;
-   int intr_interval;
- 

[PATCH 2/5] drivers: net: usb: rtl8150: introducing rtl8150.h

2013-05-18 Thread Petko Manolov
From: Petko Manolov 

adding rtl8150.h;

Signed-off-by: Petko Manolov 
---
 drivers/net/usb/rtl8150.h |  131 +++
 1 file changed, 131 insertions(+)

diff --git a/drivers/net/usb/rtl8150.h b/drivers/net/usb/rtl8150.h
new file mode 100644
index 000..cfb1e74
--- /dev/null
+++ b/drivers/net/usb/rtl8150.h
@@ -0,0 +1,131 @@
+/*
+ *  Copyright (c) 2002-2013 Petko Manolov (pet...@nucleusys.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ */
+
+#ifndef__rtl8150_h__
+#define__rtl8150_h__
+
+#defineIDR 0x0120
+#defineMAR 0x0126
+#defineCR  0x012e
+#defineTCR 0x012f
+#defineRCR 0x0130
+#defineTSR 0x0132
+#defineRSR 0x0133
+#defineCON00x0135
+#defineCON10x0136
+#defineMSR 0x0137
+#definePHYADD  0x0138
+#definePHYDAT  0x0139
+#definePHYCNT  0x013b
+#defineGPPC0x013d
+#defineBMCR0x0140
+#defineBMSR0x0142
+#defineANAR0x0144
+#defineANLP0x0146
+#defineAER 0x0148
+#define CSCR   0x014C  /* This one has the link status */
+#define CSCR_LINK_STATUS   (1 << 3)
+
+#defineIDR_EEPROM  0x1202
+
+#definePHY_READ0
+#definePHY_WRITE   0x20
+#definePHY_GO  0x40
+
+#defineMII_TIMEOUT 10
+#defineINTBUFSIZE  8
+
+#defineRTL8150_REQT_READ   0xc0
+#defineRTL8150_REQT_WRITE  0x40
+#defineRTL8150_REQ_GET_REGS0x05
+#defineRTL8150_REQ_SET_REGS0x05
+
+
+/* Transmit status register errors */
+#define TSR_ECOL   (1<<5)
+#define TSR_LCOL   (1<<4)
+#define TSR_LOSS_CRS   (1<<3)
+#define TSR_JBR(1<<2)
+#define TSR_ERRORS (TSR_ECOL | TSR_LCOL | TSR_LOSS_CRS | TSR_JBR)
+/* Receive status register errors */
+#define RSR_CRC(1<<2)
+#define RSR_FAE(1<<1)
+#define RSR_ERRORS (RSR_CRC | RSR_FAE)
+
+/* Media status register definitions */
+#define MSR_DUPLEX (1<<4)
+#define MSR_SPEED  (1<<3)
+#define MSR_LINK   (1<<2)
+
+/* Interrupt pipe data */
+#define INT_TSR0x00
+#define INT_RSR0x01
+#define INT_MSR0x02
+#define INT_WAKSR  0x03
+#define INT_TXOK_CNT   0x04
+#define INT_RXLOST_CNT 0x05
+#define INT_CRERR_CNT  0x06
+#define INT_COL_CNT0x07
+
+
+#defineRTL8150_MTU 1540
+#defineRTL8150_TX_TIMEOUT  (HZ)
+#defineRX_SKB_POOL_SIZE4
+
+/* rtl8150 flags */
+#defineRTL8150_HW_CRC  0
+#defineRX_REG_SET  1
+#defineRTL8150_UNPLUG  2
+#defineRX_URB_FAIL 3
+
+/* Define these values to match your device */
+#defineVENDOR_ID_REALTEK   0x0bda
+#defineVENDOR_ID_MELCO 0x0411
+#defineVENDOR_ID_MICRONET  0x3980
+#defineVENDOR_ID_LONGSHINE 0x07b8
+#defineVENDOR_ID_OQO   0x1557
+#defineVENDOR_ID_ZYXEL 0x0586
+
+#define PRODUCT_ID_RTL8150 0x8150
+#definePRODUCT_ID_LUAKTX   0x0012
+#definePRODUCT_ID_LCS8138TX0x401a
+#define PRODUCT_ID_SP128AR 0x0003
+#definePRODUCT_ID_PRESTIGE 0x401a
+
+#undef EEPROM_WRITE
+
+/* table of devices that work with this driver */
+static struct usb_device_id rtl8150_table[] = {
+   {USB_DEVICE(VENDOR_ID_REALTEK, PRODUCT_ID_RTL8150)},
+   {USB_DEVICE(VENDOR_ID_MELCO, PRODUCT_ID_LUAKTX)},
+   {USB_DEVICE(VENDOR_ID_MICRONET, PRODUCT_ID_SP128AR)},
+   {USB_DEVICE(VENDOR_ID_LONGSHINE, PRODUCT_ID_LCS8138TX)},
+   {USB_DEVICE(VENDOR_ID_OQO, PRODUCT_ID_RTL8150)},
+   {USB_DEVICE(VENDOR_ID_ZYXEL, PRODUCT_ID_PRESTIGE)},
+   {}
+};
+
+struct rtl8150 {
+   unsigned long flags;
+   struct usb_device *udev;
+   struct tasklet_struct tl;
+   struct net_device *netdev;
+   struct urb *rx_urb, *tx_urb, *intr_urb, *ctrl_urb;
+   struct sk_buff *tx_skb, *rx_skb;
+   struct sk_buff *rx_skb_pool[RX_SKB_POOL_SIZE];
+   spinlock_t rx_pool_lock;
+   struct usb_ctrlrequest dr;
+   int 

[PATCH 5/5] drivers: net: usb: rtl8150: making the code a bit better looking

2013-05-18 Thread Petko Manolov
From: Petko Manolov 

copyright, email address and styling update;

Signed-off-by: Petko Manolov 
---
 drivers/net/usb/rtl8150.c |   69 +--
 1 file changed, 34 insertions(+), 35 deletions(-)

diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
index 0e226d8..928546e 100644
--- a/drivers/net/usb/rtl8150.c
+++ b/drivers/net/usb/rtl8150.c
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2002 Petko Manolov (pet...@users.sourceforge.net)
+ *  Copyright (c) 2002-2013 Petko Manolov (pet...@nucleusys.com)
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -19,8 +19,8 @@
 #include "rtl8150.h"
 
 /* Version Information */
-#define DRIVER_VERSION "v0.6.2 (2004/08/27)"
-#define DRIVER_AUTHOR "Petko Manolov "
+#define DRIVER_VERSION "v0.9.3 (2013/05/18)"
+#define DRIVER_AUTHOR "Petko Manolov "
 #define DRIVER_DESC "rtl8150 based usb-ethernet driver"
 
 MODULE_DEVICE_TABLE(usb, rtl8150_table);
@@ -32,7 +32,7 @@ static const char driver_name [] = "rtl8150";
  * device related part of the code
  *
  */
-static int get_registers(rtl8150_t * dev, u16 indx, u16 size, void *data)
+static int get_registers(rtl8150_t *dev, u16 indx, u16 size, void *data)
 {
int res;
 
@@ -44,7 +44,7 @@ static int get_registers(rtl8150_t * dev, u16 indx, u16 size, 
void *data)
return res;
 }
 
-static int set_registers(rtl8150_t * dev, u16 indx, u16 size, void *data)
+static int set_registers(rtl8150_t *dev, u16 indx, u16 size, void *data)
 {
int res;
 
@@ -99,7 +99,7 @@ static int async_set_registers(rtl8150_t *dev, u16 indx, u16 
size, u16 reg)
return res;
 }
 
-static int read_mii_word(rtl8150_t * dev, u8 phy, __u8 indx, u16 * reg)
+static int read_mii_word(rtl8150_t *dev, u8 phy, __u8 indx, u16 *reg)
 {
int i;
u8 data[3], tmp;
@@ -123,7 +123,7 @@ static int read_mii_word(rtl8150_t * dev, u8 phy, __u8 
indx, u16 * reg)
return 1;
 }
 
-static int write_mii_word(rtl8150_t * dev, u8 phy, __u8 indx, u16 reg)
+static int write_mii_word(rtl8150_t *dev, u8 phy, __u8 indx, u16 reg)
 {
int i;
u8 data[3], tmp;
@@ -146,7 +146,7 @@ static int write_mii_word(rtl8150_t * dev, u8 phy, __u8 
indx, u16 reg)
return 1;
 }
 
-static inline void set_ethernet_addr(rtl8150_t * dev)
+static inline void set_ethernet_addr(rtl8150_t *dev)
 {
u8 node_id[6];
 
@@ -189,7 +189,7 @@ static int rtl8150_set_mac_address(struct net_device 
*netdev, void *p)
return 0;
 }
 
-static int rtl8150_reset(rtl8150_t * dev)
+static int rtl8150_reset(rtl8150_t *dev)
 {
u8 data = 0x10;
int i = HZ;
@@ -202,7 +202,7 @@ static int rtl8150_reset(rtl8150_t * dev)
return (i > 0) ? 1 : 0;
 }
 
-static int alloc_all_urbs(rtl8150_t * dev)
+static int alloc_all_urbs(rtl8150_t *dev)
 {
dev->rx_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!dev->rx_urb)
@@ -221,14 +221,14 @@ static int alloc_all_urbs(rtl8150_t * dev)
return 1;
 }
 
-static void free_all_urbs(rtl8150_t * dev)
+static void free_all_urbs(rtl8150_t *dev)
 {
usb_free_urb(dev->rx_urb);
usb_free_urb(dev->tx_urb);
usb_free_urb(dev->intr_urb);
 }
 
-static void unlink_all_urbs(rtl8150_t * dev)
+static void unlink_all_urbs(rtl8150_t *dev)
 {
usb_kill_urb(dev->rx_urb);
usb_kill_urb(dev->tx_urb);
@@ -364,12 +364,12 @@ static void intr_callback(struct urb *urb)
if ((d[INT_MSR] & MSR_LINK) == 0) {
if (netif_carrier_ok(dev->netdev)) {
netif_carrier_off(dev->netdev);
-   netdev_dbg(dev->netdev, "%s: LINK LOST\n", __func__);
+   netdev_dbg(dev->netdev, "%s: link lost\n", __func__);
}
} else {
if (!netif_carrier_ok(dev->netdev)) {
netif_carrier_on(dev->netdev);
-   netdev_dbg(dev->netdev, "%s: LINK CAME BACK\n", 
__func__);
+   netdev_dbg(dev->netdev, "%s: link is back\n", __func__);
}
}
 
@@ -450,7 +450,7 @@ tlsched:
tasklet_schedule(>tl);
 }
 
-static int enable_net_traffic(rtl8150_t * dev)
+static int enable_net_traffic(rtl8150_t *dev)
 {
u8 cr, tcr, rcr, msr;
 
@@ -471,7 +471,7 @@ static int enable_net_traffic(rtl8150_t * dev)
return 0;
 }
 
-static void disable_net_traffic(rtl8150_t * dev)
+static void disable_net_traffic(rtl8150_t *dev)
 {
u8 cr;
 
@@ -510,7 +510,7 @@ static void rtl8150_set_multicast(struct net_device *netdev)
 }
 
 static netdev_tx_t rtl8150_start_xmit(struct sk_buff *skb,
-   struct net_device *netdev)
+ struct net_device *netdev)
 {
rtl8150_t *dev = netdev_priv(netdev);
int count, res;
@@ -681,16 +681,15 @@ static int rtl8150_ioctl(struct net_device *netdev, 
struct ifreq *rq, int 

[PATCH 3/5] drivers: net: usb: rtl8150: getting rid of skb pool

2013-05-18 Thread Petko Manolov
From: Petko Manolov 

removing socket buffer pre-allocation pool;

Signed-off-by: Petko Manolov 
---
 drivers/net/usb/rtl8150.c |   60 +++
 drivers/net/usb/rtl8150.h |3 --
 2 files changed, 5 insertions(+), 58 deletions(-)

diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
index 7d1897b..fd4bc2a 100644
--- a/drivers/net/usb/rtl8150.c
+++ b/drivers/net/usb/rtl8150.c
@@ -240,21 +240,6 @@ static void unlink_all_urbs(rtl8150_t * dev)
usb_kill_urb(dev->ctrl_urb);
 }
 
-static inline struct sk_buff *pull_skb(rtl8150_t *dev)
-{
-   struct sk_buff *skb;
-   int i;
-
-   for (i = 0; i < RX_SKB_POOL_SIZE; i++) {
-   if (dev->rx_skb_pool[i]) {
-   skb = dev->rx_skb_pool[i];
-   dev->rx_skb_pool[i] = NULL;
-   return skb;
-   }
-   }
-   return NULL;
-}
-
 static void read_bulk_callback(struct urb *urb)
 {
rtl8150_t *dev;
@@ -305,9 +290,7 @@ static void read_bulk_callback(struct urb *urb)
netdev->stats.rx_packets++;
netdev->stats.rx_bytes += pkt_len;
 
-   spin_lock(>rx_pool_lock);
-   skb = pull_skb(dev);
-   spin_unlock(>rx_pool_lock);
+   skb = __netdev_alloc_skb_ip_align(dev->netdev, RTL8150_MTU, GFP_ATOMIC);
if (!skb)
goto resched;
 
@@ -441,47 +424,16 @@ static int rtl8150_resume(struct usb_interface *intf)
 **
 */
 
-static void fill_skb_pool(rtl8150_t *dev)
-{
-   struct sk_buff *skb;
-   int i;
-
-   for (i = 0; i < RX_SKB_POOL_SIZE; i++) {
-   if (dev->rx_skb_pool[i])
-   continue;
-   skb = dev_alloc_skb(RTL8150_MTU + 2);
-   if (!skb) {
-   return;
-   }
-   skb_reserve(skb, 2);
-   dev->rx_skb_pool[i] = skb;
-   }
-}
-
-static void free_skb_pool(rtl8150_t *dev)
-{
-   int i;
-
-   for (i = 0; i < RX_SKB_POOL_SIZE; i++)
-   if (dev->rx_skb_pool[i])
-   dev_kfree_skb(dev->rx_skb_pool[i]);
-}
-
 static void rx_fixup(unsigned long data)
 {
struct rtl8150 *dev = (struct rtl8150 *)data;
struct sk_buff *skb;
int status;
 
-   spin_lock_irq(>rx_pool_lock);
-   fill_skb_pool(dev);
-   spin_unlock_irq(>rx_pool_lock);
if (test_bit(RX_URB_FAIL, >flags))
if (dev->rx_skb)
goto try_again;
-   spin_lock_irq(>rx_pool_lock);
-   skb = pull_skb(dev);
-   spin_unlock_irq(>rx_pool_lock);
+   skb = __netdev_alloc_skb_ip_align(dev->netdev, RTL8150_MTU, GFP_ATOMIC);
if (skb == NULL)
goto tlsched;
dev->rx_skb = skb;
@@ -611,7 +563,9 @@ static int rtl8150_open(struct net_device *netdev)
int res;
 
if (dev->rx_skb == NULL)
-   dev->rx_skb = pull_skb(dev);
+   dev->rx_skb = __netdev_alloc_skb_ip_align(dev->netdev,
+ RTL8150_MTU,
+ GFP_ATOMIC);
if (!dev->rx_skb)
return -ENOMEM;
 
@@ -764,7 +718,6 @@ static int rtl8150_probe(struct usb_interface *intf,
}
 
tasklet_init(>tl, rx_fixup, (unsigned long)dev);
-   spin_lock_init(>rx_pool_lock);
 
dev->udev = udev;
dev->netdev = netdev;
@@ -781,7 +734,6 @@ static int rtl8150_probe(struct usb_interface *intf,
dev_err(>dev, "couldn't reset the device\n");
goto out1;
}
-   fill_skb_pool(dev);
set_ethernet_addr(dev);
 
usb_set_intfdata(intf, dev);
@@ -797,7 +749,6 @@ static int rtl8150_probe(struct usb_interface *intf,
 
 out2:
usb_set_intfdata(intf, NULL);
-   free_skb_pool(dev);
 out1:
free_all_urbs(dev);
 out:
@@ -817,7 +768,6 @@ static void rtl8150_disconnect(struct usb_interface *intf)
unregister_netdev(dev->netdev);
unlink_all_urbs(dev);
free_all_urbs(dev);
-   free_skb_pool(dev);
if (dev->rx_skb)
dev_kfree_skb(dev->rx_skb);
kfree(dev->intr_buff);
diff --git a/drivers/net/usb/rtl8150.h b/drivers/net/usb/rtl8150.h
index cfb1e74..a29410c 100644
--- a/drivers/net/usb/rtl8150.h
+++ b/drivers/net/usb/rtl8150.h
@@ -75,7 +75,6 @@
 
 #defineRTL8150_MTU 1540
 #defineRTL8150_TX_TIMEOUT  (HZ)
-#defineRX_SKB_POOL_SIZE4
 
 /* rtl8150 flags */
 #defineRTL8150_HW_CRC  0
@@ -117,8 +116,6 @@ struct rtl8150 {
struct net_device *netdev;
struct urb *rx_urb, *tx_urb, *intr_urb, *ctrl_urb;
struct sk_buff *tx_skb, *rx_skb;
-   struct sk_buff *rx_skb_pool[RX_SKB_POOL_SIZE];
-   spinlock_t rx_pool_lock;
struct usb_ctrlrequest dr;
int intr_interval;
__le16 rx_creg;
--
To 

[PATCH 4/5] drivers: net: usb: rtl8150: avoid potential race in async registers write

2013-05-18 Thread Petko Manolov
From: Petko Manolov 

[get|set]_registers() will now display a message in case of error condition
and if DEBUG is enabled.  All resources required for asynchronous control URB
submission are being dynamically (de)allocated.

Signed-off-by: Petko Manolov 
---
 drivers/net/usb/rtl8150.c |  129 +--
 drivers/net/usb/rtl8150.h |9 ++-
 2 files changed, 68 insertions(+), 70 deletions(-)

diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
index fd4bc2a..0e226d8 100644
--- a/drivers/net/usb/rtl8150.c
+++ b/drivers/net/usb/rtl8150.c
@@ -15,7 +15,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "rtl8150.h"
 
@@ -29,69 +28,75 @@ MODULE_DEVICE_TABLE(usb, rtl8150_table);
 static const char driver_name [] = "rtl8150";
 
 /*
-**
-** device related part of the code
-**
-*/
+ *
+ * device related part of the code
+ *
+ */
 static int get_registers(rtl8150_t * dev, u16 indx, u16 size, void *data)
 {
-   return usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0),
-  RTL8150_REQ_GET_REGS, RTL8150_REQT_READ,
-  indx, 0, data, size, 500);
+   int res;
+
+   res = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0),
+ RTL8150_REQ_GET_REGS, RTL8150_REQT_READ,
+ indx, 0, data, size, 500);
+   if (res < 0)
+   dev_dbg(>udev->dev, "%s returned %d\n", __func__, res);
+   return res;
 }
 
 static int set_registers(rtl8150_t * dev, u16 indx, u16 size, void *data)
 {
-   return usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0),
-  RTL8150_REQ_SET_REGS, RTL8150_REQT_WRITE,
-  indx, 0, data, size, 500);
+   int res;
+
+   res = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0),
+ RTL8150_REQ_SET_REGS, RTL8150_REQT_WRITE,
+ indx, 0, data, size, 500);
+   if (res < 0)
+   dev_dbg(>udev->dev, "%s returned %d\n", __func__, res);
+   return res;
 }
 
-static void ctrl_callback(struct urb *urb)
+static void async_set_reg_cb(struct urb *urb)
 {
-   rtl8150_t *dev;
+   struct async_req *req = (struct async_req *)urb->context;
int status = urb->status;
 
-   switch (status) {
-   case 0:
-   break;
-   case -EINPROGRESS:
-   break;
-   case -ENOENT:
-   break;
-   default:
-   if (printk_ratelimit())
-   dev_warn(>dev->dev, "ctrl urb status %d\n", 
status);
-   }
-   dev = urb->context;
-   clear_bit(RX_REG_SET, >flags);
+   if (status < 0)
+   dev_dbg(>dev->dev, "%s failed with %d", __func__, status);
+   kfree(req);
+   usb_free_urb(urb);
 }
 
-static int async_set_registers(rtl8150_t * dev, u16 indx, u16 size)
+static int async_set_registers(rtl8150_t *dev, u16 indx, u16 size, u16 reg)
 {
-   int ret;
-
-   if (test_bit(RX_REG_SET, >flags))
-   return -EAGAIN;
-
-   dev->dr.bRequestType = RTL8150_REQT_WRITE;
-   dev->dr.bRequest = RTL8150_REQ_SET_REGS;
-   dev->dr.wValue = cpu_to_le16(indx);
-   dev->dr.wIndex = 0;
-   dev->dr.wLength = cpu_to_le16(size);
-   dev->ctrl_urb->transfer_buffer_length = size;
-   usb_fill_control_urb(dev->ctrl_urb, dev->udev,
-usb_sndctrlpipe(dev->udev, 0), (char *) >dr,
->rx_creg, size, ctrl_callback, dev);
-   if ((ret = usb_submit_urb(dev->ctrl_urb, GFP_ATOMIC))) {
-   if (ret == -ENODEV)
-   netif_device_detach(dev->netdev);
-   dev_err(>udev->dev,
-   "control request submission failed: %d\n", ret);
-   } else
-   set_bit(RX_REG_SET, >flags);
+   int res = -ENOMEM;
+   struct urb *async_urb;
+   struct async_req *req;
 
-   return ret;
+   req = kmalloc(sizeof(struct async_req), GFP_ATOMIC);
+   if (req == NULL)
+   return res;
+   async_urb = usb_alloc_urb(0, GFP_ATOMIC);
+   if (async_urb == NULL) {
+   kfree(req);
+   return res;
+   }
+   req->rx_creg = cpu_to_le16(reg);
+   req->dr.bRequestType = RTL8150_REQT_WRITE;
+   req->dr.bRequest = RTL8150_REQ_SET_REGS;
+   req->dr.wIndex = 0;
+   req->dr.wValue = cpu_to_le16(indx);
+   req->dr.wLength = cpu_to_le16(size);
+   usb_fill_control_urb(async_urb, dev->udev,
+usb_sndctrlpipe(dev->udev, 0), (void *) >dr,
+>rx_creg, size, async_set_reg_cb, req);
+   res = usb_submit_urb(async_urb, GFP_ATOMIC);
+   if (res) {
+   if (res == -ENODEV)
+   netif_device_detach(dev->netdev);
+   dev_err(>udev->dev, "%s failed with %d\n", __func__, res);
+   }
+   return res;
 }
 
 

[PATCH 0/5] drivers: net: usb: rtl8150: bug fixing and code cleanup

2013-05-18 Thread Petko Manolov
From: Petko Manolov 

This patch series adds rtl8150.h, which contains structure and constant 
definitons formerly found in rtl8150.c, removes socket buffer 
pre-allocated pool and uses dynamically allocated memory for the 
asynchronous URB requests, thus avoids clobbering the previously scheduled 
for update value.

This patch series is against 'net' tree.

Signed-off-by: Petko Manolov 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/5] drivers: net: usb: rtl8150: bug fixing and cleanup

2013-05-18 Thread David Miller

If you use the same exact subject in every single patch, someone
reading the commit shortlog can't tell at all what different is
happening in each of the changes.

Choose better, unique, subject lines for your patches and resubmit
this series.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 4/4] fb: vt8500: Add VGA output support to wm8505fb driver.

2013-05-18 Thread Tony Prisk

On 19/05/13 01:28, Alexey Charkov wrote:

2013/5/18 Tony Prisk :

The APC8750 does not support an LCD panel, but provides a VGA connector.
This patch adds support for the VGA interface, and defines an optional
devicetree property to specify the output interface. The default if not
specified is LCD for backward compatibility.

Signed-off-by: Tony Prisk 
---
  .../devicetree/bindings/video/wm,wm8505-fb.txt |5 
  drivers/video/wm8505fb.c   |   31 ++--
  2 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt 
b/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt
index 601416c..9f1d648 100644
--- a/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt
+++ b/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt
@@ -7,6 +7,10 @@ Required properties:
  - bits-per-pixel : bit depth of framebuffer (16 or 32)
  - clocks : phandle to DVO clock

+Optional properties:
+- output-interface : the interface the fb should output on. Valid values are
+   "lcd" or "vga". If not specified, the default is "lcd".
+
  Required subnodes:
  - display-timings: see display-timing.txt for information

@@ -17,6 +21,7 @@ Example:
 reg = <0xd8051700 0x200>;
 bits-per-pixel = <16>;
 clocks = <>;
+   output-interface = "vga";

 display-timings {
 native-mode = <>;
diff --git a/drivers/video/wm8505fb.c b/drivers/video/wm8505fb.c
index f8bffc2..d1f7f33 100644
--- a/drivers/video/wm8505fb.c
+++ b/drivers/video/wm8505fb.c
@@ -130,12 +130,17 @@

  #define to_wm8505fb_info(__info) container_of(__info, \
 struct wm8505fb_info, fb)
+
+#define INTERFACE_LCD  1
+#define INTERFACE_VGA  2
+
  struct wm8505fb_info {
 struct fb_info fb;
 void __iomem *regbase;
 unsigned int contrast;
 struct device *dev;
 struct clk *clk_dvo;
+   int interface;
  };


@@ -158,7 +163,11 @@ static int wm8505fb_init_hw(struct fb_info *info)
  * 0x31C sets the correct color mode (RGB565) for WM8650
  * Bit 8+9 (0x300) are ignored on WM8505 as reserved
  */
-   writel(0x31c,  fbi->regbase + REG_GOVRH_YUVRGB);
+   if (fbi->interface == INTERFACE_VGA)
+   writel(0x338, fbi->regbase + REG_GOVRH_YUVRGB);
+   else
+   writel(0x31c, fbi->regbase + REG_GOVRH_YUVRGB);
+
 writel(1,  fbi->regbase + REG_GOVRH_DVO_PIX);

Tony,

Would it be possible to also define known bit offsets for those
registers, while you are at this? It would probably reduce the black
magic quite a bit :)

On my list of things to do :)

 /* Virtual buffer size */
@@ -167,7 +176,12 @@ static int wm8505fb_init_hw(struct fb_info *info)

 /* black magic ;) */
 writel(0xf,fbi->regbase + REG_GOVRH_FHI);
-   writel(4,  fbi->regbase + REG_GOVRH_DVO_SET);
+
+   if (fbi->interface == INTERFACE_VGA)
+   writel(0xe, fbi->regbase + REG_GOVRH_DVO_SET);
+   else
+   writel(4, fbi->regbase + REG_GOVRH_DVO_SET);

I don't remember if HDMI is yet another option for this register or
not... If it is, it would probably warrant defining fbi->interface as
an enum and changing this if-else into a switch statement to let the
compiler add its checks/warnings.

This register defines the h/v syncpolarity and enable/disable for DVO.



 writel(1,  fbi->regbase + REG_GOVRH_MIF);
 writel(1,  fbi->regbase + REG_GOVRH_REG_STS);

@@ -194,11 +208,15 @@ static int wm8505fb_set_timing(struct fb_info *info)
 writel(h_end,   fbi->regbase + REG_GOVRH_ACTPX_END);
 writel(h_all,   fbi->regbase + REG_GOVRH_H_ALLPXL);
 writel(h_sync,  fbi->regbase + REG_GOVRH_HDMI_HSYNW);
+   if (fbi->interface == INTERFACE_VGA)
+   writel(h_sync,  fbi->regbase + REG_GOVRH_VGA_HSYNW);

Will it misbehave on LCD if you write to the VGA register unconditionally?

Don't know - wouldn't imagine so. I will test it and see.



 writel(v_start, fbi->regbase + REG_GOVRH_ACTLN_BG);
 writel(v_end,   fbi->regbase + REG_GOVRH_ACTLN_END);
 writel(v_all,   fbi->regbase + REG_GOVRH_V_ALLLN);
 writel(v_sync,  fbi->regbase + REG_GOVRH_HDMI_VBISW);
+   if (fbi->interface == INTERFACE_VGA)
+   writel(info->var.pixclock,  fbi->regbase + REG_GOVRH_VGA_VSYNW);

Same here. I would assume that setting the pixclock should not hurt
LCD, which would then simplify the code a little.

Thanks,
Alexey

Regards
Tony Prisk
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  

Re: [PATCH] parisc: avoid WARNING: at kernel/cpu/idle.c:96

2013-05-18 Thread Helge Deller
On 05/17/2013 09:25 PM, Srivatsa S. Bhat wrote:
> On 05/09/2013 02:35 AM, James Bottomley wrote:
>> On Wed, 2013-05-08 at 22:42 +0200, Helge Deller wrote:
>>> We need to enable local irqs to avoid this runtime warning.
>>>
>>> Signed-off-by: Helge Deller 
>>>
>>> diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
>>> index 55f92b6..2840d43 100644
>>> --- a/arch/parisc/kernel/process.c
>>> +++ b/arch/parisc/kernel/process.c
>>> @@ -286,3 +286,8 @@ void *dereference_function_descriptor(void *ptr)
>>> return ptr;
>>>  }
>>>  #endif
>>> +
>>> +void arch_cpu_idle(void)
>>> +{
>>> +   local_irq_enable();
>>
>> This is definitely wrong.  we'd need at least a cpu_relax() in there.
>> Without that the cpu will bounce around in the idle loop.  I'd advise
>> that we simply keep the default cpu_idle_poll().
>>
>> However, this looks like a kernel bug to me in cpu_idle_loop()?  not
>> something we should be working around in the arch code.
>>
>> Thomas, what's going on here?  It looks like you can never avoid the
>> WARN_ON_ONCE if you don't provide any arch specific idle functions.  If
>> you wish to allow this case then the correct patch (keeping the WARN_ON)
>> would appear to be this one.
>>
>> James
>>
>> 
>> diff --git a/kernel/cpu/idle.c b/kernel/cpu/idle.c
>> index 8b86c0c..829e41f 100644
>> --- a/kernel/cpu/idle.c
>> +++ b/kernel/cpu/idle.c
>> @@ -56,6 +56,7 @@ void __weak arch_cpu_idle_dead(void) { }
>>  void __weak arch_cpu_idle(void)
>>  {
>>  cpu_idle_force_poll = 1;
>> +local_irq_enable();
>>  }
>>
>>  /*
>>
> 
> This patch looks like the correct fix to me.
> 
> Reviewed-by: Srivatsa S. Bhat 

Thanks Srivatsa!

I can push it through the parisc tree if nobody objects...

Helge
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCHv9 3/3] net: velocity: Add platform device support to VIA velocity driver

2013-05-18 Thread Tony Prisk
Add support for the VIA Velocity network driver to be bound to a
OF created platform device.

Signed-off-by: Tony Prisk 
---
 .../devicetree/bindings/net/via-velocity.txt   |   20 +
 drivers/net/ethernet/via/Kconfig   |3 +-
 drivers/net/ethernet/via/via-velocity.c|  408 ++--
 drivers/net/ethernet/via/via-velocity.h|3 +-
 4 files changed, 305 insertions(+), 129 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/via-velocity.txt

diff --git a/Documentation/devicetree/bindings/net/via-velocity.txt 
b/Documentation/devicetree/bindings/net/via-velocity.txt
new file mode 100644
index 000..b3db469
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/via-velocity.txt
@@ -0,0 +1,20 @@
+* VIA Velocity 10/100/1000 Network Controller
+
+Required properties:
+- compatible : Should be "via,velocity-vt6110"
+- reg : Address and length of the io space
+- interrupts : Should contain the controller interrupt line
+
+Optional properties:
+- no-eeprom : PCI network cards use an external EEPROM to store data. Embedded
+   devices quite often set this data in uboot and do not provide an eeprom.
+   Specify this option if you have no external eeprom.
+
+Examples:
+
+eth0@d8004000 {
+   compatible = "via,velocity-vt6110";
+   reg = <0xd8004000 0x400>;
+   interrupts = <10>;
+   no-eeprom;
+};
diff --git a/drivers/net/ethernet/via/Kconfig b/drivers/net/ethernet/via/Kconfig
index 68a9ba6..6a87097 100644
--- a/drivers/net/ethernet/via/Kconfig
+++ b/drivers/net/ethernet/via/Kconfig
@@ -5,7 +5,6 @@
 config NET_VENDOR_VIA
bool "VIA devices"
default y
-   depends on PCI
---help---
  If you have a network (Ethernet) card belonging to this class, say Y
  and read the Ethernet-HOWTO, available from
@@ -45,7 +44,7 @@ config VIA_RHINE_MMIO
 
 config VIA_VELOCITY
tristate "VIA Velocity support"
-   depends on PCI
+   depends on (PCI || USE_OF)
select CRC32
select CRC_CCITT
select NET_CORE
diff --git a/drivers/net/ethernet/via/via-velocity.c 
b/drivers/net/ethernet/via/via-velocity.c
index 5996cee..7691994 100644
--- a/drivers/net/ethernet/via/via-velocity.c
+++ b/drivers/net/ethernet/via/via-velocity.c
@@ -65,7 +65,11 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -80,10 +84,24 @@
 
 #include "via-velocity.h"
 
+enum velocity_bus_type {
+   BUS_PCI,
+   BUS_PLATFORM,
+};
 
 static int velocity_nics;
 static int msglevel = MSG_LEVEL_INFO;
 
+static void velocity_set_power_state(struct velocity_info *vptr, char state)
+{
+   void *addr = vptr->mac_regs;
+
+   if (vptr->pdev)
+   pci_set_power_state(vptr->pdev, state);
+   else
+   writeb(state, addr + 0x154);
+}
+
 /**
  * mac_get_cam_mask-   Read a CAM mask
  * @regs: register block for this velocity
@@ -362,12 +380,23 @@ static struct velocity_info_tbl chip_info_table[] = {
  * Describe the PCI device identifiers that we support in this
  * device driver. Used for hotplug autoloading.
  */
-static DEFINE_PCI_DEVICE_TABLE(velocity_id_table) = {
+
+static DEFINE_PCI_DEVICE_TABLE(velocity_pci_id_table) = {
{ PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_612X) },
{ }
 };
 
-MODULE_DEVICE_TABLE(pci, velocity_id_table);
+MODULE_DEVICE_TABLE(pci, velocity_pci_id_table);
+
+/**
+ * Describe the OF device identifiers that we support in this
+ * device driver. Used for devicetree nodes.
+ */
+static struct of_device_id velocity_of_ids[] = {
+   { .compatible = "via,velocity-vt6110", .data = _info_table[0] },
+   { /* Sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, velocity_of_ids);
 
 /**
  * get_chip_name   -   identifier to name
@@ -386,29 +415,6 @@ static const char *get_chip_name(enum chip_type chip_id)
 }
 
 /**
- * velocity_remove1-   device unplug
- * @pdev: PCI device being removed
- *
- * Device unload callback. Called on an unplug or on module
- * unload for each active device that is present. Disconnects
- * the device from the network layer and frees all the resources
- */
-static void velocity_remove1(struct pci_dev *pdev)
-{
-   struct net_device *dev = pci_get_drvdata(pdev);
-   struct velocity_info *vptr = netdev_priv(dev);
-
-   unregister_netdev(dev);
-   iounmap(vptr->mac_regs);
-   pci_release_regions(pdev);
-   pci_disable_device(pdev);
-   pci_set_drvdata(pdev, NULL);
-   free_netdev(dev);
-
-   velocity_nics--;
-}
-
-/**
  * velocity_set_int_opt-   parser for integer options
  * @opt: pointer to option value
  * @val: value the user requested (or -1 for default)
@@ -1181,6 +1187,17 @@ static void mii_init(struct velocity_info *vptr, u32 
mii_status)
u16 BMCR;
 
switch 

[PATCHv9 1/3] net: velocity: Rename vptr->dev to vptr->netdev

2013-05-18 Thread Tony Prisk
Improve the clarity of the code in preparation for converting the
dma functions to generic versions, which require a struct device *.

This makes it possible to store a 'struct device *dev' in the
velocity_info structure.

Signed-off-by: Tony Prisk 
---
 drivers/net/ethernet/via/via-velocity.c |   66 +++
 drivers/net/ethernet/via/via-velocity.h |4 +-
 2 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/drivers/net/ethernet/via/via-velocity.c 
b/drivers/net/ethernet/via/via-velocity.c
index fb62489..187eef3 100644
--- a/drivers/net/ethernet/via/via-velocity.c
+++ b/drivers/net/ethernet/via/via-velocity.c
@@ -998,9 +998,9 @@ static void velocity_print_link_status(struct velocity_info 
*vptr)
 {
 
if (vptr->mii_status & VELOCITY_LINK_FAIL) {
-   VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: failed to detect 
cable link\n", vptr->dev->name);
+   VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: failed to detect 
cable link\n", vptr->netdev->name);
} else if (vptr->options.spd_dpx == SPD_DPX_AUTO) {
-   VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link 
auto-negotiation", vptr->dev->name);
+   VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link 
auto-negotiation", vptr->netdev->name);
 
if (vptr->mii_status & VELOCITY_SPEED_1000)
VELOCITY_PRT(MSG_LEVEL_INFO, " speed 1000M bps");
@@ -1014,7 +1014,7 @@ static void velocity_print_link_status(struct 
velocity_info *vptr)
else
VELOCITY_PRT(MSG_LEVEL_INFO, " half duplex\n");
} else {
-   VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link forced", 
vptr->dev->name);
+   VELOCITY_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: Link forced", 
vptr->netdev->name);
switch (vptr->options.spd_dpx) {
case SPD_DPX_1000_FULL:
VELOCITY_PRT(MSG_LEVEL_INFO, " speed 1000M bps full 
duplex\n");
@@ -1319,7 +1319,7 @@ static void velocity_init_registers(struct velocity_info 
*vptr,
case VELOCITY_INIT_RESET:
case VELOCITY_INIT_WOL:
 
-   netif_stop_queue(vptr->dev);
+   netif_stop_queue(vptr->netdev);
 
/*
 *  Reset RX to prevent RX pointer not on the 4X location
@@ -1332,7 +1332,7 @@ static void velocity_init_registers(struct velocity_info 
*vptr,
if (velocity_set_media_mode(vptr, mii_status) != 
VELOCITY_LINK_CHANGE) {
velocity_print_link_status(vptr);
if (!(vptr->mii_status & VELOCITY_LINK_FAIL))
-   netif_wake_queue(vptr->dev);
+   netif_wake_queue(vptr->netdev);
}
 
enable_flow_control_ability(vptr);
@@ -1354,7 +1354,7 @@ static void velocity_init_registers(struct velocity_info 
*vptr,
 
mac_eeprom_reload(regs);
for (i = 0; i < 6; i++)
-   writeb(vptr->dev->dev_addr[i], &(regs->PAR[i]));
+   writeb(vptr->netdev->dev_addr[i], &(regs->PAR[i]));
 
/*
 *  clear Pre_ACPI bit.
@@ -1377,7 +1377,7 @@ static void velocity_init_registers(struct velocity_info 
*vptr,
/*
 *  Set packet filter: Receive directed and broadcast 
address
 */
-   velocity_set_multi(vptr->dev);
+   velocity_set_multi(vptr->netdev);
 
/*
 *  Enable MII auto-polling
@@ -1404,14 +1404,14 @@ static void velocity_init_registers(struct 
velocity_info *vptr,
writel((CR0_DPOLL | CR0_TXON | CR0_RXON | CR0_STRT), 
>CR0Set);
 
mii_status = velocity_get_opt_media_mode(vptr);
-   netif_stop_queue(vptr->dev);
+   netif_stop_queue(vptr->netdev);
 
mii_init(vptr, mii_status);
 
if (velocity_set_media_mode(vptr, mii_status) != 
VELOCITY_LINK_CHANGE) {
velocity_print_link_status(vptr);
if (!(vptr->mii_status & VELOCITY_LINK_FAIL))
-   netif_wake_queue(vptr->dev);
+   netif_wake_queue(vptr->netdev);
}
 
enable_flow_control_ability(vptr);
@@ -1474,7 +1474,7 @@ static int velocity_init_dma_rings(struct velocity_info 
*vptr)
rx_ring_size, _dma);
if (!pool) {
dev_err(>dev, "%s : DMA memory allocation failed.\n",
-   vptr->dev->name);
+   vptr->netdev->name);
return -ENOMEM;
}
 
@@ -1514,7 +1514,7 @@ static int velocity_alloc_rx_buf(struct velocity_info 
*vptr, int idx)
struct rx_desc *rd = &(vptr->rx.ring[idx]);
struct velocity_rd_info *rd_info = &(vptr->rx.info[idx]);
 
-   

[PATCHv9 2/3] net: velocity: Convert to generic dma functions

2013-05-18 Thread Tony Prisk
Remove the pci_* dma functions and replace with the more generic
versions.

In preparation of adding platform support, a new struct device *dev
is added to struct velocity_info which can be used by both the pci
and platform code.

Signed-off-by: Tony Prisk 
---
 drivers/net/ethernet/via/via-velocity.c |   51 +++
 drivers/net/ethernet/via/via-velocity.h |1 +
 2 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/drivers/net/ethernet/via/via-velocity.c 
b/drivers/net/ethernet/via/via-velocity.c
index 187eef3..5996cee 100644
--- a/drivers/net/ethernet/via/via-velocity.c
+++ b/drivers/net/ethernet/via/via-velocity.c
@@ -46,6 +46,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1459,7 +1460,6 @@ static int velocity_init_dma_rings(struct velocity_info 
*vptr)
struct velocity_opt *opt = >options;
const unsigned int rx_ring_size = opt->numrx * sizeof(struct rx_desc);
const unsigned int tx_ring_size = opt->numtx * sizeof(struct tx_desc);
-   struct pci_dev *pdev = vptr->pdev;
dma_addr_t pool_dma;
void *pool;
unsigned int i;
@@ -1467,13 +1467,13 @@ static int velocity_init_dma_rings(struct velocity_info 
*vptr)
/*
 * Allocate all RD/TD rings a single pool.
 *
-* pci_alloc_consistent() fulfills the requirement for 64 bytes
+* dma_alloc_coherent() fulfills the requirement for 64 bytes
 * alignment
 */
-   pool = pci_alloc_consistent(pdev, tx_ring_size * vptr->tx.numq +
-   rx_ring_size, _dma);
+   pool = dma_alloc_coherent(vptr->dev, tx_ring_size * vptr->tx.numq +
+   rx_ring_size, _dma, GFP_ATOMIC);
if (!pool) {
-   dev_err(>dev, "%s : DMA memory allocation failed.\n",
+   dev_err(vptr->dev, "%s : DMA memory allocation failed.\n",
vptr->netdev->name);
return -ENOMEM;
}
@@ -1524,8 +1524,8 @@ static int velocity_alloc_rx_buf(struct velocity_info 
*vptr, int idx)
 */
skb_reserve(rd_info->skb,
64 - ((unsigned long) rd_info->skb->data & 63));
-   rd_info->skb_dma = pci_map_single(vptr->pdev, rd_info->skb->data,
-   vptr->rx.buf_sz, PCI_DMA_FROMDEVICE);
+   rd_info->skb_dma = dma_map_single(vptr->dev, rd_info->skb->data,
+   vptr->rx.buf_sz, DMA_FROM_DEVICE);
 
/*
 *  Fill in the descriptor to match
@@ -1588,8 +1588,8 @@ static void velocity_free_rd_ring(struct velocity_info 
*vptr)
 
if (!rd_info->skb)
continue;
-   pci_unmap_single(vptr->pdev, rd_info->skb_dma, vptr->rx.buf_sz,
-PCI_DMA_FROMDEVICE);
+   dma_unmap_single(vptr->dev, rd_info->skb_dma, vptr->rx.buf_sz,
+DMA_FROM_DEVICE);
rd_info->skb_dma = 0;
 
dev_kfree_skb(rd_info->skb);
@@ -1670,7 +1670,7 @@ static void velocity_free_dma_rings(struct velocity_info 
*vptr)
const int size = vptr->options.numrx * sizeof(struct rx_desc) +
vptr->options.numtx * sizeof(struct tx_desc) * vptr->tx.numq;
 
-   pci_free_consistent(vptr->pdev, size, vptr->rx.ring, vptr->rx.pool_dma);
+   dma_free_coherent(vptr->dev, size, vptr->rx.ring, vptr->rx.pool_dma);
 }
 
 static int velocity_init_rings(struct velocity_info *vptr, int mtu)
@@ -1727,8 +1727,8 @@ static void velocity_free_tx_buf(struct velocity_info 
*vptr,
pktlen = max_t(size_t, pktlen,
td->td_buf[i].size & ~TD_QUEUE);
 
-   pci_unmap_single(vptr->pdev, tdinfo->skb_dma[i],
-   le16_to_cpu(pktlen), PCI_DMA_TODEVICE);
+   dma_unmap_single(vptr->dev, tdinfo->skb_dma[i],
+   le16_to_cpu(pktlen), DMA_TO_DEVICE);
}
}
dev_kfree_skb_irq(skb);
@@ -1750,8 +1750,8 @@ static void velocity_free_td_ring_entry(struct 
velocity_info *vptr,
if (td_info->skb) {
for (i = 0; i < td_info->nskb_dma; i++) {
if (td_info->skb_dma[i]) {
-   pci_unmap_single(vptr->pdev, 
td_info->skb_dma[i],
-   td_info->skb->len, PCI_DMA_TODEVICE);
+   dma_unmap_single(vptr->dev, td_info->skb_dma[i],
+   td_info->skb->len, DMA_TO_DEVICE);
td_info->skb_dma[i] = 0;
}
}
@@ -2029,7 +2029,6 @@ static inline void velocity_iph_realign(struct 
velocity_info *vptr,
  */
 static int velocity_receive_frame(struct velocity_info *vptr, int idx)
 {
-   void 

[PATCHv9 0/3] Add support for velocity network driver on platform devices

2013-05-18 Thread Tony Prisk
v9 changes:
Code tidyup as requested by Francois Romieu.

v8 changes:
Remove velocity_choose_state from via-velocity.h: unused function.

v7 changes:
Forgot to merge a patch to fix an error with the pm ops changes. Apologies Dave.

v6 changes:
Remove more bus specific code from velocity_probe()
Make velocity_(suspend/resume) accept a struct device *
Simplify PM code to use velocity_(suspend/resume) - remove the individual
pci and platform functions.
Add a struct pci_dev variable to velocity_get_pci_info() to reduce churn

v5 changes:
Remove velocity_info union. Change velocity_info->pdev back to struct pci_dev.
Remove more 'if (pci)' sections.
Remove 'void *pdev' function parameters.
Pass correct variable to velocity_choose_state()

v4 changes:
Code tidyup as requested by Francois Romieu
Removed '#ifdef PCI' around PCI code. Compile tested on (!)PCI and (!)PM.

v3 changes:
Rebased against net-next.
Fix errors in pm code.

v2 changes:
Drop patch #1 as requested by David Miller.
Correct the PHYID_ICPLUS_IP101A MII bits - should be ON, rather than OFF.
Read the platform rev_id from the correct register [regs->rev_id]. It's possible
this would work for the PCI version as well and would remove the need for the
'if (pci)' test to set vptr->rev_id.

v1:
The first three patches are general tidyup.

[DROPPED] Patch ## just alphabetizes the #includes to make it easier to read.

Patch #1 replaces vptr->dev with vptr->netdev, in preparation of adding a
struct device *dev in Patch #2

Patch #2 replaces the pci dma functions with the generic versions.

I have build tested these patches but don't have a PCI velocity to run-test it.
I can't see that they should introduce any problems as it is all renames and
function swapping.

Patch #3 adds support for the velocity driver on devicetree platform devices.
Binding document included. This patch is compile-tested for PCI, and boot
tested on a VIA APC8750.

I think it would be pertinent to get some tested-by's for PCI users.

Regards
Tony Prisk

Tony Prisk (3):
  net: velocity: Rename vptr->dev to vptr->netdev
  net: velocity: Convert to generic dma functions
  net: velocity: Add platform device support to VIA velocity driver

 .../devicetree/bindings/net/via-velocity.txt   |   20 +
 drivers/net/ethernet/via/Kconfig   |3 +-
 drivers/net/ethernet/via/via-velocity.c|  507 +---
 drivers/net/ethernet/via/via-velocity.h|8 +-
 4 files changed, 357 insertions(+), 181 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/via-velocity.txt

-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v7, part3 16/16] AVR32: fix building warnings caused by redifinitions of HZ

2013-05-18 Thread Hans-Christian Egtvedt
Around Fri 17 May 2013 23:45:18 +0800 or thereabout, Jiang Liu wrote:
> As suggested by David Howells , use
> asm-generic/param.h and uapi/asm-generic/param.h for AVR32.
> 
> It also fixes building warnings caused by redifinitions of HZ:
> In file included from /ws/linux/kernel/linux.git/include/uapi/linux/param.h:4,
>  from include/linux/timex.h:63,
>  from include/linux/jiffies.h:8,
>  from include/linux/ktime.h:25,
>  from include/linux/timer.h:5,
>  from include/linux/workqueue.h:8,
>  from include/linux/srcu.h:34,
>  from include/linux/notifier.h:15,
>  from include/linux/memory_hotplug.h:6,
>  from include/linux/mmzone.h:777,
>  from include/linux/gfp.h:4,
>  from arch/avr32/mm/init.c:10:
> /ws/linux/kernel/linux.git/arch/avr32/include/asm/param.h:6:1: warning: "HZ" 
> redefined
> In file included from 
> /ws/linux/kernel/linux.git/arch/avr32/include/asm/param.h:4,
>  from /ws/linux/kernel/linux.git/include/uapi/linux/param.h:4,
>  from include/linux/timex.h:63,
>  from include/linux/jiffies.h:8,
>  from include/linux/ktime.h:25,
>  from include/linux/timer.h:5,
>  from include/linux/workqueue.h:8,
>  from include/linux/srcu.h:34,
>  from include/linux/notifier.h:15,
>  from include/linux/memory_hotplug.h:6,
>  from include/linux/mmzone.h:777,
>  from include/linux/gfp.h:4,
>  from arch/avr32/mm/init.c:10:
> /ws/linux/kernel/linux.git/arch/avr32/include/uapi/asm/param.h:6:1: warning: 
> this is the location of the previous definition
> 
> Signed-off-by: Jiang Liu 
> Cc: Hans-Christian Egtvedt 
> Cc: Haavard Skinnemoen 
> Cc: linux-kernel@vger.kernel.org

Thanks, I'll pull this into the linux-avr32 tree. I'm in the mountains right
now, but will make a pull request early next week.

Acked-by: Hans-Christian Egtvedt 

> ---
>  arch/avr32/include/asm/Kbuild   |  1 +
>  arch/avr32/include/asm/param.h  |  9 -
>  arch/avr32/include/uapi/asm/Kbuild  |  1 +
>  arch/avr32/include/uapi/asm/param.h | 18 --
>  4 files changed, 2 insertions(+), 27 deletions(-)
>  delete mode 100644 arch/avr32/include/asm/param.h
>  delete mode 100644 arch/avr32/include/uapi/asm/param.h



-- 
HcE
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHv8 3/3] net: velocity: Add platform device support to VIA velocity driver

2013-05-18 Thread Francois Romieu
Tony Prisk  :
[...]
> diff --git a/drivers/net/ethernet/via/via-velocity.c 
> b/drivers/net/ethernet/via/via-velocity.c
> index 5996cee..d8d5bc5 100644
> --- a/drivers/net/ethernet/via/via-velocity.c
> +++ b/drivers/net/ethernet/via/via-velocity.c
[...]
> @@ -84,6 +88,16 @@
>  static int velocity_nics;
>  static int msglevel = MSG_LEVEL_INFO;
>  
> +static void velocity_set_power_state(struct velocity_info *vptr, char state)
> +{
> + void *addr = vptr->mac_regs;

Your choice but it's only used once.

[...]
> @@ -1353,9 +1366,12 @@ static void velocity_init_registers(struct 
> velocity_info *vptr,
>   velocity_soft_reset(vptr);
>   mdelay(5);
>  
> - mac_eeprom_reload(regs);
> - for (i = 0; i < 6; i++)
> - writeb(vptr->netdev->dev_addr[i], &(regs->PAR[i]));
> + if (!vptr->no_eeprom) {
> + mac_eeprom_reload(regs);
> + for (i = 0; i < 6; i++)
> + writeb(vptr->netdev->dev_addr[i],
> + &(regs->PAR[i]));
> + }

velocity_init_registers would not suffer from a local vptr->netdev variable.

If you change this code, you may replace &(regs->PAR[i]) with regs->PAR + i.

[...]
> @@ -2730,19 +2773,19 @@ static int velocity_found1(struct pci_dev *pdev,
>* can support more than MAX_UNITS.
>*/
>   if (velocity_nics >= MAX_UNITS) {
> - dev_notice(>dev, "already found %d NICs.\n",
> -velocity_nics);
> + dev_notice(dev, "already found %d NICs.\n", velocity_nics);
>   return -ENODEV;
>   }
>  
> - dev = alloc_etherdev(sizeof(struct velocity_info));
> - if (!dev)
> + netdev = alloc_etherdev(sizeof(struct velocity_info));
> + if (!netdev)
>   goto out;
>  
>   /* Chain it all together */
>  
> - SET_NETDEV_DEV(dev, >dev);
> - vptr = netdev_priv(dev);
> + SET_NETDEV_DEV(netdev, dev);
> + vptr = netdev_priv(netdev);
> + memset(vptr, 0, sizeof(struct velocity_info));

memset is not needed (alloc_etherdev indirectly uses kzalloc).

[...]
> +static int velocity_pci_probe(struct pci_dev *pdev,
> +const struct pci_device_id *ent)

It does not seem to line up as it should.

> +{
> + int ret;
> + const struct velocity_info_tbl *info =
> + _info_table[ent->driver_data];

Long lines ought to come first.

> +
> + ret = pci_enable_device(pdev);
> + if (ret < 0)
> + return ret;
> +
> + ret = pci_request_regions(pdev, VELOCITY_NAME);
> + if (ret < 0) {
> + dev_err(>dev, "No PCI resources.\n");
> + pci_disable_device(pdev);
> + return ret;
> + }
> +
> + ret = velocity_probe(>dev, pdev->irq, info, BUS_PCI);
> + if (ret < 0) {
> + pci_release_regions(pdev);
> + pci_disable_device(pdev);
> + }

Please use gotos for the error paths.

[...]
> @@ -3270,7 +3409,11 @@ static void velocity_get_drvinfo(struct net_device 
> *dev, struct ethtool_drvinfo
>   struct velocity_info *vptr = netdev_priv(dev);
>   strlcpy(info->driver, VELOCITY_NAME, sizeof(info->driver));

You may sneak an empty line after the declaration.

>   strlcpy(info->version, VELOCITY_VERSION, sizeof(info->version));
> - strlcpy(info->bus_info, pci_name(vptr->pdev), sizeof(info->bus_info));
> + if (vptr->bustype == BUS_PCI)
> + strlcpy(info->bus_info, pci_name(vptr->pdev),
> + sizeof(info->bus_info));
> + else
> + strlcpy(info->bus_info, "platform", sizeof(info->bus_info));

strlcpy(info->bus_info, vptr->pdev ? pci_name(vptr->pdev) : "platform",
sizeof(info->bus_info));

>  static void velocity_ethtool_get_wol(struct net_device *dev, struct 
> ethtool_wolinfo *wol)
> @@ -3563,9 +3706,15 @@ static int __init velocity_init_module(void)
>   int ret;
>  
>   velocity_register_notifier();
> - ret = pci_register_driver(_driver);
> +
> + ret = pci_register_driver(_pci_driver);
> + if (ret < 0)
> + velocity_unregister_notifier();
> +
> + ret = platform_driver_register(_platform_driver);
>   if (ret < 0)
>   velocity_unregister_notifier();
> +

I'd rather velocity_unregister_notifier iif both driver registrations
failed.

[...]
> diff --git a/drivers/net/ethernet/via/via-velocity.h 
> b/drivers/net/ethernet/via/via-velocity.h
> index c38bbae..1d94612 100644
> --- a/drivers/net/ethernet/via/via-velocity.h
> +++ b/drivers/net/ethernet/via/via-velocity.h
[...]
> @@ -1433,10 +1433,17 @@ struct velocity_opt {
>  
>  #define GET_RD_BY_IDX(vptr, idx)   (vptr->rd_ring[idx])
>  
> +enum velocity_bus_type {
> + BUS_PCI,
> + BUS_PLATFORM,
> +};
> +
>  struct velocity_info {
> - struct device *dev;
>   struct 

Re: [PATCH] kbuild: Don't assume dts files live in arch/*/boot/dts

2013-05-18 Thread Matthijs Kooijman
Hi Michal,

On Wed, May 08, 2013 at 08:50:49AM -0600, Stephen Warren wrote:
> On 05/08/2013 04:59 AM, Matthijs Kooijman wrote:
> > In commit b40b25ff (kbuild: always run gcc -E on *.dts, remove cmd_dtc_cpp),
> > dts building was changed to always use the C preprocessor. This meant
> > that the .dts file passed to dtc is not the original, but the
> > preprocessed one.
> > 
> > When compiling with a separate build directory (i.e., with O=), this
> > preprocessed file will not live in the same directory as the original.
> > When the .dts file includes .dtsi files, dtc will look for them in the
> > build directory, not in the source directory and compilation will fail.
> > 
> > The commit referenced above tried to fix this by passing arch/*/boot/dts
> > as an include path to dtc. However, for mips, the .dts files are not in
> > this directory, so dts compilation on mips breaks for some targets.
> > 
> > Instead of hardcoding this particular include path, this commit just
> > uses the directory of the .dts file that is being compiled, which
> > effectively restores the previous behaviour wrt includes. For most .dts
> > files, this path is just the same as the previous hardcoded
> > arch/*/boot/dts path.
> > 
> > This was tested on a mips (rt3052) and an arm (bcm2835) target.
> 
> Reviewed-by: Stephen Warren 

Did this patch look ok to you? If so, could you pick it up and send it
over to Linus for 3.10 (or should I send it directly)?

Gr.

Matthijs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Would like to form a pool of Linux copyright holders for faster GPL enforcement against Anthrax Kernels

2013-05-18 Thread luke.leighton
On Sat, May 18, 2013 at 8:24 AM, Eric Appleman  wrote:
> Would anyone be interested in forming such a pool?

 count me in.

> Last I checked, I have 1 long-time poster of this list on board. Would
> anyone else like to join? Ideally I'd like to get the LKML (which I have
> CC'd) involved so that authors of critical Linux components be a part of
> this. I'm not sure if my defconfig commits to Android kernel branches count
> as contributions,

 even if you did not explicitly put "Copyright (C) {your name}" in
them, you still retain copyright.  depending on the country you are in
you cannot even get rid of the copyright even if you say "i forever
renounce irrevocably and without restriction or limitation all
copyright and place this into the public domain signed me" - you have
to actively assign the copyright to someone else.

> so I'm not going to consider myself a Linux contributor
> unless told otherwise.

 you wrote something that's copyrighted.  therefore you're a copyright
holder [therefore automatically any copyright violator must request
your permission to have their GPLv2 license rights reinstated].

 my linux kernel modifications are small, too - they sort of winged
their way by a slow process of migration into tmpfs by way of selinux
xattrs.  and there are likely some unattributed contributions that
came from the xanadux.sf.net project originally (depending on whether
they were picked up or not over time)

 but that makes no odds: i am still a copyright holder, ergo a
contributor, ergo i'd like to be included in the pool please.

> This pool would be used in the following manner:
>
> * Formally requesting source for binaries (means to request source
> * Formally requesting removal of critical copyrighted code that Linux cannot
> function without
> * Informing interested parties with respect to refusals of the above

 it would also serve as a useful point of contact for criminal
copyright violators wishing to have their license rights reinstated.

 also it would serve as a good starting point to be able to contact
large numbers of people wishing to explicitly dual-license their code
contributions to the linux kernel.

 actually, that's a good point.  please can it be specifically noted,
from this moment onwards, that all contributions that i have made to
the linux kernel are dual-licensed under both the GPLv2 and also the
GPLv3+ license?

someone has to start somewhere on this.  it doesn't matter if it takes
20 years for all GPLv2-exlusive contributions to be made obselete,
deleted or replaced: a start has to be made.

question: what is the procedure for having that licensing explicitly
added to the linux kernel sources?

l.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [GIT] kbuild fix for v3.10-rc2

2013-05-18 Thread Linus Torvalds
On Fri, May 17, 2013 at 12:36 PM, Michal Marek  wrote:
>
>   git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild.git for-next
>
> Luiz Capitulino (1):
>   package: Makefile: unbreak binrpm-pkg target
>
>  scripts/package/Makefile |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

Hmm. That's not at all what I get. I also get a merge and another
patch ("kbuild: fix make headers_install when path is too long") and

 scripts/Makefile.headersinst | 20 ++--
 scripts/headers_install.sh   |  7 +--
 scripts/package/Makefile |  2 +-
 3 files changed, 20 insertions(+), 9 deletions(-)

which may all be intentional, but I don't see any updated pull
requests, so I'm not pulling..

  Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] Initial support for Allwinner's Security ID fuses

2013-05-18 Thread Oliver Schinagl

On 05/17/13 23:18, Maxime Ripard wrote:

Hi Oliver,

Le 17/05/2013 15:35, Oliver Schinagl a écrit :

From: Oliver Schinagl 

Allwinner has electric fuses (efuse) on their line of chips. This driver
reads those fuses and exports them as a sysfs node. Also a symbol is exported
for in-kernel useage.

While initially these fuses are used to somewhat determin the chipID, these
appear to be writeable by the user and thus can be used for other purpouses.
For example storing a 128 bit root key, a unique serial number, which could
then even be used as a MAC address.

Because writing to e-fuses can be potentially dangerous, and are certainly
not as often writable (if at all) as flash memory, these shouldn't be easily
changeable, hence only a read-only mode. An offline tool to write the fuses
is in the works.

Currently supported are the following known chips:
Allwinner sun4i (A10)
Allwinner sun5i (A10s A13)
Allwinner sun6i (A31, A31s)
Allwinner sun7i (A20)


Since I don't think those patches have been tested on sun6i/sun7i, and
that there's not even kernel support for those, maybe it's not worth
mentionning them?
A31 is out in the wild, but haven't seen that functionality in, I have 
seen the register named and defined, just not used, so that could go 
until confirmed.


A20 has the same feature as we can see in the dumped sources. [0]






Signed-off-by: Oliver Schinagl 
---
  drivers/misc/eeprom/Kconfig |  19 
  drivers/misc/eeprom/Makefile|   1 +
  drivers/misc/eeprom/sunxi_sid.c | 218 
  3 files changed, 238 insertions(+)
  create mode 100644 drivers/misc/eeprom/sunxi_sid.c

diff --git a/drivers/misc/eeprom/Kconfig b/drivers/misc/eeprom/Kconfig
index 04f2e1f..c9ddda5 100644
--- a/drivers/misc/eeprom/Kconfig
+++ b/drivers/misc/eeprom/Kconfig
@@ -96,4 +96,23 @@ config EEPROM_DIGSY_MTC_CFG

  If unsure, say N.

+config EEPROM_SUNXI_SID
+   tristate "Allwinner sunxi security ID support"
+   depends on ARCH_SUNXI && SYSFS
+   help
+ This is a driver for the 'security ID' available on various Allwinner
+ devices. Currently supported are:
+   sun4i (A10)
+   sun5i (A10s, A12, A13)
+   sun6i (A31)
+   sun7i (A20)


Same things here.


+
+ Due to the potential risks involved with changing e-fuses,
+ this driver is read-only
+
+ For more information visit http://linux-sunxi.org/SID
+
+ This driver can also be built as a module. If so, the module
+ will be called sunxi_sid.
+
  endmenu
diff --git a/drivers/misc/eeprom/Makefile b/drivers/misc/eeprom/Makefile
index fc1e81d..9507aec 100644
--- a/drivers/misc/eeprom/Makefile
+++ b/drivers/misc/eeprom/Makefile
@@ -4,4 +4,5 @@ obj-$(CONFIG_EEPROM_LEGACY) += eeprom.o
  obj-$(CONFIG_EEPROM_MAX6875)  += max6875.o
  obj-$(CONFIG_EEPROM_93CX6)+= eeprom_93cx6.o
  obj-$(CONFIG_EEPROM_93XX46)   += eeprom_93xx46.o
+obj-$(CONFIG_EEPROM_SUNXI_SID) += sunxi_sid.o
  obj-$(CONFIG_EEPROM_DIGSY_MTC_CFG) += digsy_mtc_eeprom.o
diff --git a/drivers/misc/eeprom/sunxi_sid.c b/drivers/misc/eeprom/sunxi_sid.c
new file mode 100644
index 000..953f137
--- /dev/null
+++ b/drivers/misc/eeprom/sunxi_sid.c
@@ -0,0 +1,218 @@
+/*
+ * Copyright (c) 2013 Oliver Schinagl
+ * http://www.linux-sunxi.org
+ *
+ * Oliver Schinagl 
+ *
+ * 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.
+ *
+ * This driver exposes the Allwinner security ID, a 128 bit eeprom, in chunks
+ * of 8 bytes.


16 bytes or 8 bits? because 8 bytes != 128 bits.
fixed, it was late when I wrote that :( It is indeed 8 bits, e.g. byte 
sized chunks.





+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+
+#define DRV_NAME "sunxi-sid"
+#define DRV_VERSION "1.0"
+
+/* Register offsets */
+#define SUNXI_SID_KEY0 0x00
+#define SUNXI_SID_KEY1 0x04
+#define SUNXI_SID_KEY2 0x08
+#define SUNXI_SID_KEY3 0x0c
+
+/* There are 4 32-bit keys */
+#define SUNXI_SID_KEYS 4
+/* and 4 32-bit keys per 32-bit key */


The comment is wrong here.

Same as above, corrected.




+#define SUNXI_SID_SIZE (SUNXI_SID_KEYS * 4)
+
+#if (SUNXI_SID_SIZE > PAGE_SIZE)
+#error "SUNXI_SID_SIZE is larger then the target's PAGE_SIZE, ENOMEM."
+#endif


H, I don't follow you here, what's the relation between your driver
and PAGE_SIZE?

Nothing, I thought there was, but isn't. removed.



+
+static u8 keys_lut[] = {
+   

[PATCH 1/5] drivers: net: usb: rtl8150: bug fixing and cleanup

2013-05-18 Thread Petko Manolov
From: Petko Manolov 

Moving constant and structure definitions out of rtl8150.c;

Signed-off-by: Petko Manolov 
---
 drivers/net/usb/rtl8150.c |  121 +--
 1 file changed, 2 insertions(+), 119 deletions(-)

diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
index a491d3a..7d1897b 100644
--- a/drivers/net/usb/rtl8150.c
+++ b/drivers/net/usb/rtl8150.c
@@ -17,132 +17,15 @@
 #include 
 #include 
 
+#include "rtl8150.h"
+
 /* Version Information */
 #define DRIVER_VERSION "v0.6.2 (2004/08/27)"
 #define DRIVER_AUTHOR "Petko Manolov "
 #define DRIVER_DESC "rtl8150 based usb-ethernet driver"
 
-#defineIDR 0x0120
-#defineMAR 0x0126
-#defineCR  0x012e
-#defineTCR 0x012f
-#defineRCR 0x0130
-#defineTSR 0x0132
-#defineRSR 0x0133
-#defineCON00x0135
-#defineCON10x0136
-#defineMSR 0x0137
-#definePHYADD  0x0138
-#definePHYDAT  0x0139
-#definePHYCNT  0x013b
-#defineGPPC0x013d
-#defineBMCR0x0140
-#defineBMSR0x0142
-#defineANAR0x0144
-#defineANLP0x0146
-#defineAER 0x0148
-#define CSCR   0x014C  /* This one has the link status */
-#define CSCR_LINK_STATUS   (1 << 3)
-
-#defineIDR_EEPROM  0x1202
-
-#definePHY_READ0
-#definePHY_WRITE   0x20
-#definePHY_GO  0x40
-
-#defineMII_TIMEOUT 10
-#defineINTBUFSIZE  8
-
-#defineRTL8150_REQT_READ   0xc0
-#defineRTL8150_REQT_WRITE  0x40
-#defineRTL8150_REQ_GET_REGS0x05
-#defineRTL8150_REQ_SET_REGS0x05
-
-
-/* Transmit status register errors */
-#define TSR_ECOL   (1<<5)
-#define TSR_LCOL   (1<<4)
-#define TSR_LOSS_CRS   (1<<3)
-#define TSR_JBR(1<<2)
-#define TSR_ERRORS (TSR_ECOL | TSR_LCOL | TSR_LOSS_CRS | TSR_JBR)
-/* Receive status register errors */
-#define RSR_CRC(1<<2)
-#define RSR_FAE(1<<1)
-#define RSR_ERRORS (RSR_CRC | RSR_FAE)
-
-/* Media status register definitions */
-#define MSR_DUPLEX (1<<4)
-#define MSR_SPEED  (1<<3)
-#define MSR_LINK   (1<<2)
-
-/* Interrupt pipe data */
-#define INT_TSR0x00
-#define INT_RSR0x01
-#define INT_MSR0x02
-#define INT_WAKSR  0x03
-#define INT_TXOK_CNT   0x04
-#define INT_RXLOST_CNT 0x05
-#define INT_CRERR_CNT  0x06
-#define INT_COL_CNT0x07
-
-
-#defineRTL8150_MTU 1540
-#defineRTL8150_TX_TIMEOUT  (HZ)
-#defineRX_SKB_POOL_SIZE4
-
-/* rtl8150 flags */
-#defineRTL8150_HW_CRC  0
-#defineRX_REG_SET  1
-#defineRTL8150_UNPLUG  2
-#defineRX_URB_FAIL 3
-
-/* Define these values to match your device */
-#defineVENDOR_ID_REALTEK   0x0bda
-#defineVENDOR_ID_MELCO 0x0411
-#defineVENDOR_ID_MICRONET  0x3980
-#defineVENDOR_ID_LONGSHINE 0x07b8
-#defineVENDOR_ID_OQO   0x1557
-#defineVENDOR_ID_ZYXEL 0x0586
-
-#define PRODUCT_ID_RTL8150 0x8150
-#definePRODUCT_ID_LUAKTX   0x0012
-#definePRODUCT_ID_LCS8138TX0x401a
-#define PRODUCT_ID_SP128AR 0x0003
-#definePRODUCT_ID_PRESTIGE 0x401a
-
-#undef EEPROM_WRITE
-
-/* table of devices that work with this driver */
-static struct usb_device_id rtl8150_table[] = {
-   {USB_DEVICE(VENDOR_ID_REALTEK, PRODUCT_ID_RTL8150)},
-   {USB_DEVICE(VENDOR_ID_MELCO, PRODUCT_ID_LUAKTX)},
-   {USB_DEVICE(VENDOR_ID_MICRONET, PRODUCT_ID_SP128AR)},
-   {USB_DEVICE(VENDOR_ID_LONGSHINE, PRODUCT_ID_LCS8138TX)},
-   {USB_DEVICE(VENDOR_ID_OQO, PRODUCT_ID_RTL8150)},
-   {USB_DEVICE(VENDOR_ID_ZYXEL, PRODUCT_ID_PRESTIGE)},
-   {}
-};
-
 MODULE_DEVICE_TABLE(usb, rtl8150_table);
 
-struct rtl8150 {
-   unsigned long flags;
-   struct usb_device *udev;
-   struct tasklet_struct tl;
-   struct net_device *netdev;
-   struct urb *rx_urb, *tx_urb, *intr_urb, *ctrl_urb;
-   struct sk_buff *tx_skb, *rx_skb;
-   struct sk_buff *rx_skb_pool[RX_SKB_POOL_SIZE];
-   spinlock_t rx_pool_lock;
-   struct usb_ctrlrequest dr;
-   int intr_interval;
- 

[PATCH 5/5] drivers: net: usb: rtl8150: bug fixing and cleanup

2013-05-18 Thread Petko Manolov
From: Petko Manolov 

copyright, email address and styling update;

Signed-off-by: Petko Manolov 
---
 drivers/net/usb/rtl8150.c |   69 +--
 1 file changed, 34 insertions(+), 35 deletions(-)

diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
index 0e226d8..928546e 100644
--- a/drivers/net/usb/rtl8150.c
+++ b/drivers/net/usb/rtl8150.c
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2002 Petko Manolov (pet...@users.sourceforge.net)
+ *  Copyright (c) 2002-2013 Petko Manolov (pet...@nucleusys.com)
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -19,8 +19,8 @@
 #include "rtl8150.h"
 
 /* Version Information */
-#define DRIVER_VERSION "v0.6.2 (2004/08/27)"
-#define DRIVER_AUTHOR "Petko Manolov "
+#define DRIVER_VERSION "v0.9.3 (2013/05/18)"
+#define DRIVER_AUTHOR "Petko Manolov "
 #define DRIVER_DESC "rtl8150 based usb-ethernet driver"
 
 MODULE_DEVICE_TABLE(usb, rtl8150_table);
@@ -32,7 +32,7 @@ static const char driver_name [] = "rtl8150";
  * device related part of the code
  *
  */
-static int get_registers(rtl8150_t * dev, u16 indx, u16 size, void *data)
+static int get_registers(rtl8150_t *dev, u16 indx, u16 size, void *data)
 {
int res;
 
@@ -44,7 +44,7 @@ static int get_registers(rtl8150_t * dev, u16 indx, u16 size, 
void *data)
return res;
 }
 
-static int set_registers(rtl8150_t * dev, u16 indx, u16 size, void *data)
+static int set_registers(rtl8150_t *dev, u16 indx, u16 size, void *data)
 {
int res;
 
@@ -99,7 +99,7 @@ static int async_set_registers(rtl8150_t *dev, u16 indx, u16 
size, u16 reg)
return res;
 }
 
-static int read_mii_word(rtl8150_t * dev, u8 phy, __u8 indx, u16 * reg)
+static int read_mii_word(rtl8150_t *dev, u8 phy, __u8 indx, u16 *reg)
 {
int i;
u8 data[3], tmp;
@@ -123,7 +123,7 @@ static int read_mii_word(rtl8150_t * dev, u8 phy, __u8 
indx, u16 * reg)
return 1;
 }
 
-static int write_mii_word(rtl8150_t * dev, u8 phy, __u8 indx, u16 reg)
+static int write_mii_word(rtl8150_t *dev, u8 phy, __u8 indx, u16 reg)
 {
int i;
u8 data[3], tmp;
@@ -146,7 +146,7 @@ static int write_mii_word(rtl8150_t * dev, u8 phy, __u8 
indx, u16 reg)
return 1;
 }
 
-static inline void set_ethernet_addr(rtl8150_t * dev)
+static inline void set_ethernet_addr(rtl8150_t *dev)
 {
u8 node_id[6];
 
@@ -189,7 +189,7 @@ static int rtl8150_set_mac_address(struct net_device 
*netdev, void *p)
return 0;
 }
 
-static int rtl8150_reset(rtl8150_t * dev)
+static int rtl8150_reset(rtl8150_t *dev)
 {
u8 data = 0x10;
int i = HZ;
@@ -202,7 +202,7 @@ static int rtl8150_reset(rtl8150_t * dev)
return (i > 0) ? 1 : 0;
 }
 
-static int alloc_all_urbs(rtl8150_t * dev)
+static int alloc_all_urbs(rtl8150_t *dev)
 {
dev->rx_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!dev->rx_urb)
@@ -221,14 +221,14 @@ static int alloc_all_urbs(rtl8150_t * dev)
return 1;
 }
 
-static void free_all_urbs(rtl8150_t * dev)
+static void free_all_urbs(rtl8150_t *dev)
 {
usb_free_urb(dev->rx_urb);
usb_free_urb(dev->tx_urb);
usb_free_urb(dev->intr_urb);
 }
 
-static void unlink_all_urbs(rtl8150_t * dev)
+static void unlink_all_urbs(rtl8150_t *dev)
 {
usb_kill_urb(dev->rx_urb);
usb_kill_urb(dev->tx_urb);
@@ -364,12 +364,12 @@ static void intr_callback(struct urb *urb)
if ((d[INT_MSR] & MSR_LINK) == 0) {
if (netif_carrier_ok(dev->netdev)) {
netif_carrier_off(dev->netdev);
-   netdev_dbg(dev->netdev, "%s: LINK LOST\n", __func__);
+   netdev_dbg(dev->netdev, "%s: link lost\n", __func__);
}
} else {
if (!netif_carrier_ok(dev->netdev)) {
netif_carrier_on(dev->netdev);
-   netdev_dbg(dev->netdev, "%s: LINK CAME BACK\n", 
__func__);
+   netdev_dbg(dev->netdev, "%s: link is back\n", __func__);
}
}
 
@@ -450,7 +450,7 @@ tlsched:
tasklet_schedule(>tl);
 }
 
-static int enable_net_traffic(rtl8150_t * dev)
+static int enable_net_traffic(rtl8150_t *dev)
 {
u8 cr, tcr, rcr, msr;
 
@@ -471,7 +471,7 @@ static int enable_net_traffic(rtl8150_t * dev)
return 0;
 }
 
-static void disable_net_traffic(rtl8150_t * dev)
+static void disable_net_traffic(rtl8150_t *dev)
 {
u8 cr;
 
@@ -510,7 +510,7 @@ static void rtl8150_set_multicast(struct net_device *netdev)
 }
 
 static netdev_tx_t rtl8150_start_xmit(struct sk_buff *skb,
-   struct net_device *netdev)
+ struct net_device *netdev)
 {
rtl8150_t *dev = netdev_priv(netdev);
int count, res;
@@ -681,16 +681,15 @@ static int rtl8150_ioctl(struct net_device *netdev, 
struct ifreq *rq, int 

[PATCH 4/5] drivers: net: usb: rtl8150: bug fixing and cleanup

2013-05-18 Thread Petko Manolov
From: Petko Manolov 

[get|set]_registers() will now display a message in case of error condition
and if DEBUG is enabled.  All resources required for asynchronous control URB
submission are being dynamically (de)allocated.

Signed-off-by: Petko Manolov 
---
 drivers/net/usb/rtl8150.c |  129 +--
 drivers/net/usb/rtl8150.h |9 ++-
 2 files changed, 68 insertions(+), 70 deletions(-)

diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
index fd4bc2a..0e226d8 100644
--- a/drivers/net/usb/rtl8150.c
+++ b/drivers/net/usb/rtl8150.c
@@ -15,7 +15,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "rtl8150.h"
 
@@ -29,69 +28,75 @@ MODULE_DEVICE_TABLE(usb, rtl8150_table);
 static const char driver_name [] = "rtl8150";
 
 /*
-**
-** device related part of the code
-**
-*/
+ *
+ * device related part of the code
+ *
+ */
 static int get_registers(rtl8150_t * dev, u16 indx, u16 size, void *data)
 {
-   return usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0),
-  RTL8150_REQ_GET_REGS, RTL8150_REQT_READ,
-  indx, 0, data, size, 500);
+   int res;
+
+   res = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0),
+ RTL8150_REQ_GET_REGS, RTL8150_REQT_READ,
+ indx, 0, data, size, 500);
+   if (res < 0)
+   dev_dbg(>udev->dev, "%s returned %d\n", __func__, res);
+   return res;
 }
 
 static int set_registers(rtl8150_t * dev, u16 indx, u16 size, void *data)
 {
-   return usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0),
-  RTL8150_REQ_SET_REGS, RTL8150_REQT_WRITE,
-  indx, 0, data, size, 500);
+   int res;
+
+   res = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0),
+ RTL8150_REQ_SET_REGS, RTL8150_REQT_WRITE,
+ indx, 0, data, size, 500);
+   if (res < 0)
+   dev_dbg(>udev->dev, "%s returned %d\n", __func__, res);
+   return res;
 }
 
-static void ctrl_callback(struct urb *urb)
+static void async_set_reg_cb(struct urb *urb)
 {
-   rtl8150_t *dev;
+   struct async_req *req = (struct async_req *)urb->context;
int status = urb->status;
 
-   switch (status) {
-   case 0:
-   break;
-   case -EINPROGRESS:
-   break;
-   case -ENOENT:
-   break;
-   default:
-   if (printk_ratelimit())
-   dev_warn(>dev->dev, "ctrl urb status %d\n", 
status);
-   }
-   dev = urb->context;
-   clear_bit(RX_REG_SET, >flags);
+   if (status < 0)
+   dev_dbg(>dev->dev, "%s failed with %d", __func__, status);
+   kfree(req);
+   usb_free_urb(urb);
 }
 
-static int async_set_registers(rtl8150_t * dev, u16 indx, u16 size)
+static int async_set_registers(rtl8150_t *dev, u16 indx, u16 size, u16 reg)
 {
-   int ret;
-
-   if (test_bit(RX_REG_SET, >flags))
-   return -EAGAIN;
-
-   dev->dr.bRequestType = RTL8150_REQT_WRITE;
-   dev->dr.bRequest = RTL8150_REQ_SET_REGS;
-   dev->dr.wValue = cpu_to_le16(indx);
-   dev->dr.wIndex = 0;
-   dev->dr.wLength = cpu_to_le16(size);
-   dev->ctrl_urb->transfer_buffer_length = size;
-   usb_fill_control_urb(dev->ctrl_urb, dev->udev,
-usb_sndctrlpipe(dev->udev, 0), (char *) >dr,
->rx_creg, size, ctrl_callback, dev);
-   if ((ret = usb_submit_urb(dev->ctrl_urb, GFP_ATOMIC))) {
-   if (ret == -ENODEV)
-   netif_device_detach(dev->netdev);
-   dev_err(>udev->dev,
-   "control request submission failed: %d\n", ret);
-   } else
-   set_bit(RX_REG_SET, >flags);
+   int res = -ENOMEM;
+   struct urb *async_urb;
+   struct async_req *req;
 
-   return ret;
+   req = kmalloc(sizeof(struct async_req), GFP_ATOMIC);
+   if (req == NULL)
+   return res;
+   async_urb = usb_alloc_urb(0, GFP_ATOMIC);
+   if (async_urb == NULL) {
+   kfree(req);
+   return res;
+   }
+   req->rx_creg = cpu_to_le16(reg);
+   req->dr.bRequestType = RTL8150_REQT_WRITE;
+   req->dr.bRequest = RTL8150_REQ_SET_REGS;
+   req->dr.wIndex = 0;
+   req->dr.wValue = cpu_to_le16(indx);
+   req->dr.wLength = cpu_to_le16(size);
+   usb_fill_control_urb(async_urb, dev->udev,
+usb_sndctrlpipe(dev->udev, 0), (void *) >dr,
+>rx_creg, size, async_set_reg_cb, req);
+   res = usb_submit_urb(async_urb, GFP_ATOMIC);
+   if (res) {
+   if (res == -ENODEV)
+   netif_device_detach(dev->netdev);
+   dev_err(>udev->dev, "%s failed with %d\n", __func__, res);
+   }
+   return res;
 }
 
 

[PATCH 3/5] drivers: net: usb: rtl8150: bug fixing and cleanup

2013-05-18 Thread Petko Manolov
From: Petko Manolov 

removing socket buffer pre-allocation pool;

Signed-off-by: Petko Manolov 
---
 drivers/net/usb/rtl8150.c |   60 +++
 drivers/net/usb/rtl8150.h |3 --
 2 files changed, 5 insertions(+), 58 deletions(-)

diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
index 7d1897b..fd4bc2a 100644
--- a/drivers/net/usb/rtl8150.c
+++ b/drivers/net/usb/rtl8150.c
@@ -240,21 +240,6 @@ static void unlink_all_urbs(rtl8150_t * dev)
usb_kill_urb(dev->ctrl_urb);
 }
 
-static inline struct sk_buff *pull_skb(rtl8150_t *dev)
-{
-   struct sk_buff *skb;
-   int i;
-
-   for (i = 0; i < RX_SKB_POOL_SIZE; i++) {
-   if (dev->rx_skb_pool[i]) {
-   skb = dev->rx_skb_pool[i];
-   dev->rx_skb_pool[i] = NULL;
-   return skb;
-   }
-   }
-   return NULL;
-}
-
 static void read_bulk_callback(struct urb *urb)
 {
rtl8150_t *dev;
@@ -305,9 +290,7 @@ static void read_bulk_callback(struct urb *urb)
netdev->stats.rx_packets++;
netdev->stats.rx_bytes += pkt_len;
 
-   spin_lock(>rx_pool_lock);
-   skb = pull_skb(dev);
-   spin_unlock(>rx_pool_lock);
+   skb = __netdev_alloc_skb_ip_align(dev->netdev, RTL8150_MTU, GFP_ATOMIC);
if (!skb)
goto resched;
 
@@ -441,47 +424,16 @@ static int rtl8150_resume(struct usb_interface *intf)
 **
 */
 
-static void fill_skb_pool(rtl8150_t *dev)
-{
-   struct sk_buff *skb;
-   int i;
-
-   for (i = 0; i < RX_SKB_POOL_SIZE; i++) {
-   if (dev->rx_skb_pool[i])
-   continue;
-   skb = dev_alloc_skb(RTL8150_MTU + 2);
-   if (!skb) {
-   return;
-   }
-   skb_reserve(skb, 2);
-   dev->rx_skb_pool[i] = skb;
-   }
-}
-
-static void free_skb_pool(rtl8150_t *dev)
-{
-   int i;
-
-   for (i = 0; i < RX_SKB_POOL_SIZE; i++)
-   if (dev->rx_skb_pool[i])
-   dev_kfree_skb(dev->rx_skb_pool[i]);
-}
-
 static void rx_fixup(unsigned long data)
 {
struct rtl8150 *dev = (struct rtl8150 *)data;
struct sk_buff *skb;
int status;
 
-   spin_lock_irq(>rx_pool_lock);
-   fill_skb_pool(dev);
-   spin_unlock_irq(>rx_pool_lock);
if (test_bit(RX_URB_FAIL, >flags))
if (dev->rx_skb)
goto try_again;
-   spin_lock_irq(>rx_pool_lock);
-   skb = pull_skb(dev);
-   spin_unlock_irq(>rx_pool_lock);
+   skb = __netdev_alloc_skb_ip_align(dev->netdev, RTL8150_MTU, GFP_ATOMIC);
if (skb == NULL)
goto tlsched;
dev->rx_skb = skb;
@@ -611,7 +563,9 @@ static int rtl8150_open(struct net_device *netdev)
int res;
 
if (dev->rx_skb == NULL)
-   dev->rx_skb = pull_skb(dev);
+   dev->rx_skb = __netdev_alloc_skb_ip_align(dev->netdev,
+ RTL8150_MTU,
+ GFP_ATOMIC);
if (!dev->rx_skb)
return -ENOMEM;
 
@@ -764,7 +718,6 @@ static int rtl8150_probe(struct usb_interface *intf,
}
 
tasklet_init(>tl, rx_fixup, (unsigned long)dev);
-   spin_lock_init(>rx_pool_lock);
 
dev->udev = udev;
dev->netdev = netdev;
@@ -781,7 +734,6 @@ static int rtl8150_probe(struct usb_interface *intf,
dev_err(>dev, "couldn't reset the device\n");
goto out1;
}
-   fill_skb_pool(dev);
set_ethernet_addr(dev);
 
usb_set_intfdata(intf, dev);
@@ -797,7 +749,6 @@ static int rtl8150_probe(struct usb_interface *intf,
 
 out2:
usb_set_intfdata(intf, NULL);
-   free_skb_pool(dev);
 out1:
free_all_urbs(dev);
 out:
@@ -817,7 +768,6 @@ static void rtl8150_disconnect(struct usb_interface *intf)
unregister_netdev(dev->netdev);
unlink_all_urbs(dev);
free_all_urbs(dev);
-   free_skb_pool(dev);
if (dev->rx_skb)
dev_kfree_skb(dev->rx_skb);
kfree(dev->intr_buff);
diff --git a/drivers/net/usb/rtl8150.h b/drivers/net/usb/rtl8150.h
index cfb1e74..a29410c 100644
--- a/drivers/net/usb/rtl8150.h
+++ b/drivers/net/usb/rtl8150.h
@@ -75,7 +75,6 @@
 
 #defineRTL8150_MTU 1540
 #defineRTL8150_TX_TIMEOUT  (HZ)
-#defineRX_SKB_POOL_SIZE4
 
 /* rtl8150 flags */
 #defineRTL8150_HW_CRC  0
@@ -117,8 +116,6 @@ struct rtl8150 {
struct net_device *netdev;
struct urb *rx_urb, *tx_urb, *intr_urb, *ctrl_urb;
struct sk_buff *tx_skb, *rx_skb;
-   struct sk_buff *rx_skb_pool[RX_SKB_POOL_SIZE];
-   spinlock_t rx_pool_lock;
struct usb_ctrlrequest dr;
int intr_interval;
__le16 rx_creg;
--
To 

[PATCH 0/5] drivers: net: usb: rtl8150: bug fixing and cleanup

2013-05-18 Thread Petko Manolov
From: Petko Manolov 

This patch series adds rtl8150.h, which contains structure and constant 
definitons formerly found in rtl8150.c, removes socket buffer 
pre-allocated pool and uses dynamically allocated memory for the 
asynchronous URB requests, thus avoids clobbering the previously scheduled 
for update value.

This patch series is against 'net' tree.

Signed-off-by: Petko Manolov 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/5] drivers: net: usb: rtl8150: bug fixing and cleanup

2013-05-18 Thread Petko Manolov
From: Petko Manolov 

adding rtl8150.h;

Signed-off-by: Petko Manolov 
---
 drivers/net/usb/rtl8150.h |  131 +++
 1 file changed, 131 insertions(+)

diff --git a/drivers/net/usb/rtl8150.h b/drivers/net/usb/rtl8150.h
new file mode 100644
index 000..cfb1e74
--- /dev/null
+++ b/drivers/net/usb/rtl8150.h
@@ -0,0 +1,131 @@
+/*
+ *  Copyright (c) 2002-2013 Petko Manolov (pet...@nucleusys.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ */
+
+#ifndef__rtl8150_h__
+#define__rtl8150_h__
+
+#defineIDR 0x0120
+#defineMAR 0x0126
+#defineCR  0x012e
+#defineTCR 0x012f
+#defineRCR 0x0130
+#defineTSR 0x0132
+#defineRSR 0x0133
+#defineCON00x0135
+#defineCON10x0136
+#defineMSR 0x0137
+#definePHYADD  0x0138
+#definePHYDAT  0x0139
+#definePHYCNT  0x013b
+#defineGPPC0x013d
+#defineBMCR0x0140
+#defineBMSR0x0142
+#defineANAR0x0144
+#defineANLP0x0146
+#defineAER 0x0148
+#define CSCR   0x014C  /* This one has the link status */
+#define CSCR_LINK_STATUS   (1 << 3)
+
+#defineIDR_EEPROM  0x1202
+
+#definePHY_READ0
+#definePHY_WRITE   0x20
+#definePHY_GO  0x40
+
+#defineMII_TIMEOUT 10
+#defineINTBUFSIZE  8
+
+#defineRTL8150_REQT_READ   0xc0
+#defineRTL8150_REQT_WRITE  0x40
+#defineRTL8150_REQ_GET_REGS0x05
+#defineRTL8150_REQ_SET_REGS0x05
+
+
+/* Transmit status register errors */
+#define TSR_ECOL   (1<<5)
+#define TSR_LCOL   (1<<4)
+#define TSR_LOSS_CRS   (1<<3)
+#define TSR_JBR(1<<2)
+#define TSR_ERRORS (TSR_ECOL | TSR_LCOL | TSR_LOSS_CRS | TSR_JBR)
+/* Receive status register errors */
+#define RSR_CRC(1<<2)
+#define RSR_FAE(1<<1)
+#define RSR_ERRORS (RSR_CRC | RSR_FAE)
+
+/* Media status register definitions */
+#define MSR_DUPLEX (1<<4)
+#define MSR_SPEED  (1<<3)
+#define MSR_LINK   (1<<2)
+
+/* Interrupt pipe data */
+#define INT_TSR0x00
+#define INT_RSR0x01
+#define INT_MSR0x02
+#define INT_WAKSR  0x03
+#define INT_TXOK_CNT   0x04
+#define INT_RXLOST_CNT 0x05
+#define INT_CRERR_CNT  0x06
+#define INT_COL_CNT0x07
+
+
+#defineRTL8150_MTU 1540
+#defineRTL8150_TX_TIMEOUT  (HZ)
+#defineRX_SKB_POOL_SIZE4
+
+/* rtl8150 flags */
+#defineRTL8150_HW_CRC  0
+#defineRX_REG_SET  1
+#defineRTL8150_UNPLUG  2
+#defineRX_URB_FAIL 3
+
+/* Define these values to match your device */
+#defineVENDOR_ID_REALTEK   0x0bda
+#defineVENDOR_ID_MELCO 0x0411
+#defineVENDOR_ID_MICRONET  0x3980
+#defineVENDOR_ID_LONGSHINE 0x07b8
+#defineVENDOR_ID_OQO   0x1557
+#defineVENDOR_ID_ZYXEL 0x0586
+
+#define PRODUCT_ID_RTL8150 0x8150
+#definePRODUCT_ID_LUAKTX   0x0012
+#definePRODUCT_ID_LCS8138TX0x401a
+#define PRODUCT_ID_SP128AR 0x0003
+#definePRODUCT_ID_PRESTIGE 0x401a
+
+#undef EEPROM_WRITE
+
+/* table of devices that work with this driver */
+static struct usb_device_id rtl8150_table[] = {
+   {USB_DEVICE(VENDOR_ID_REALTEK, PRODUCT_ID_RTL8150)},
+   {USB_DEVICE(VENDOR_ID_MELCO, PRODUCT_ID_LUAKTX)},
+   {USB_DEVICE(VENDOR_ID_MICRONET, PRODUCT_ID_SP128AR)},
+   {USB_DEVICE(VENDOR_ID_LONGSHINE, PRODUCT_ID_LCS8138TX)},
+   {USB_DEVICE(VENDOR_ID_OQO, PRODUCT_ID_RTL8150)},
+   {USB_DEVICE(VENDOR_ID_ZYXEL, PRODUCT_ID_PRESTIGE)},
+   {}
+};
+
+struct rtl8150 {
+   unsigned long flags;
+   struct usb_device *udev;
+   struct tasklet_struct tl;
+   struct net_device *netdev;
+   struct urb *rx_urb, *tx_urb, *intr_urb, *ctrl_urb;
+   struct sk_buff *tx_skb, *rx_skb;
+   struct sk_buff *rx_skb_pool[RX_SKB_POOL_SIZE];
+   spinlock_t rx_pool_lock;
+   struct usb_ctrlrequest dr;
+   int 

Re: [PATCHv4] arm: Preserve the user r/w register TPIDRURW on context switch and fork

2013-05-18 Thread André Hentschel
Am 08.05.2013 21:03, schrieb André Hentschel:
> From: =?UTF-8?q?Andr=C3=A9=20Hentschel?= 
> 
> Since commit 6a1c53124aa1 the user writeable TLS register was zeroed to
> prevent it from being used as a covert channel between two tasks.
> 
> There are more and more applications coming to WinRT, Wine could support them,
> but mostly they expect to have the thread environment block (TEB) in TPIDRURW.
> 
> This patch preserves that register per thread instead of clearing it.
> Unlike the TPIDRURO, which is already switched, the TPIDRURW
> can be updated from userspace so needs careful treatment in the case that we
> modify TPIDRURW and call fork(). To avoid this we must always read
> TPIDRURW in copy_thread.
> 
> Signed-off-by: André Hentschel 
> Signed-off-by: Will Deacon 
> Signed-off-by: Jonathan Austin  
> 

Hi,
I'm not yet very familiar with the development process here,
am i getting no feedback on v4 because of the mergewindow being closed?
Or is there another reason? Sry for being impatient.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3.9-table] NTB: fix pointer math issues

2013-05-18 Thread Jon Mason
On Sat, May 18, 2013 at 11:39:05AM +0900, Jonghwan Choi wrote:
> From: Dan Carpenter 
> 
> This patch looks like it should be in the 3.9-stable tree, should we apply
> it?

Yes, thanks.

> 
> --
> 
> From: "Dan Carpenter "
> 
> commit cc0f868d8adef7bdc12cda132654870086d766bc upstream
> 
> ->remote_rx_info and ->rx_info are struct ntb_rx_info pointers.  If we
> add sizeof(struct ntb_rx_info) then it goes too far.
> 
> Cc:  # 3.9.x: ad3e2751: ntb: off by one
> Signed-off-by: Dan Carpenter 
> Signed-off-by: Jon Mason 
> Signed-off-by: Jonghwan Choi 
> ---
>  drivers/ntb/ntb_transport.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
> index e0bdfd7..676ee16 100644
> --- a/drivers/ntb/ntb_transport.c
> +++ b/drivers/ntb/ntb_transport.c
> @@ -486,7 +486,7 @@ static void ntb_transport_setup_qp_mw(struct 
> ntb_transport *nt,
>(qp_num / NTB_NUM_MW * rx_size);
>   rx_size -= sizeof(struct ntb_rx_info);
>  
> - qp->rx_buff = qp->remote_rx_info + sizeof(struct ntb_rx_info);
> + qp->rx_buff = qp->remote_rx_info + 1;
>   qp->rx_max_frame = min(transport_mtu, rx_size);
>   qp->rx_max_entry = rx_size / qp->rx_max_frame;
>   qp->rx_index = 0;
> @@ -780,7 +780,7 @@ static void ntb_transport_init_queue(struct ntb_transport 
> *nt,
> (qp_num / NTB_NUM_MW * tx_size);
>   tx_size -= sizeof(struct ntb_rx_info);
>  
> - qp->tx_mw = qp->rx_info + sizeof(struct ntb_rx_info);
> + qp->tx_mw = qp->rx_info + 1;
>   qp->tx_max_frame = min(transport_mtu, tx_size);
>   qp->tx_max_entry = tx_size / qp->tx_max_frame;
>   qp->tx_index = 0;
> -- 
> 1.8.1.2
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3.9-stable] NTB: Multiple NTB client fix

2013-05-18 Thread Jon Mason
On Sat, May 18, 2013 at 11:57:29AM +0900, Jonghwan Choi wrote:
> From: Jon Mason 
> 
> This patch looks like it should be in the 3.9-stable tree, should we apply
> it?

Yes, thanks.

> 
> --
> 
> From: "Jon Mason "
> 
> commit 8b19d450ad188d402a183ff4a4d40f31c3916fbf upstream
> 
> Fix issue with adding multiple ntb client devices to the ntb virtual
> bus.  Previously, multiple devices would be added with the same name,
> resulting in crashes.  To get around this issue, add a unique number to
> the device when it is added.
> 
> Cc:  # 3.9.x: ad3e2751: ntb: off by one
> Cc:  # 3.9.x: cc0f868d: NTB: fix pointer math
> Cc:  # 3.9.x: 113fc505: NTB: Handle 64bit BAR
> Cc:  # 3.9.x: b77b2637: NTB: Link toggle memory
> Cc:  # 3.9.x: 90f9e934: NTB: reset tx_index on
> Cc:  # 3.9.x: c9d534c8: NTB: Correctly handle receive
> Cc:  # 3.9.x: c336acd3: NTB: memcpy lockup workaround
> Cc:  # 3.9.x: 904435cf: ntb_netdev: remove from list
> Signed-off-by: Jon Mason 
> Signed-off-by: Jonghwan Choi 
> ---
>  drivers/ntb/ntb_transport.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
> index 0f66daa..f365b2f 100644
> --- a/drivers/ntb/ntb_transport.c
> +++ b/drivers/ntb/ntb_transport.c
> @@ -300,7 +300,7 @@ int ntb_register_client_dev(char *device_name)
>  {
>   struct ntb_transport_client_dev *client_dev;
>   struct ntb_transport *nt;
> - int rc;
> + int rc, i = 0;
>  
>   if (list_empty(_transport_list))
>   return -ENODEV;
> @@ -318,7 +318,7 @@ int ntb_register_client_dev(char *device_name)
>   dev = _dev->dev;
>  
>   /* setup and register client devices */
> - dev_set_name(dev, "%s", device_name);
> + dev_set_name(dev, "%s%d", device_name, i);
>   dev->bus = _bus_type;
>   dev->release = ntb_client_release;
>   dev->parent = _query_pdev(nt->ndev)->dev;
> @@ -330,6 +330,7 @@ int ntb_register_client_dev(char *device_name)
>   }
>  
>   list_add_tail(_dev->entry, >client_devs);
> + i++;
>   }
>  
>   return 0;
> -- 
> 1.8.1.2
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3.9-stable] ntb_netdev: remove from list on exit

2013-05-18 Thread Jon Mason
On Sat, May 18, 2013 at 11:55:06AM +0900, Jonghwan Choi wrote:
> From: Jon Mason 
> 
> This patch looks like it should be in the 3.9-stable tree, should we apply
> it?

Yes, thanks.

> 
> --
> 
> From: "Jon Mason "
> 
> commit 904435cf76a9bdd5eb41b1c4e049d5a64f3a8400 upstream
> 
> The ntb_netdev device is not removed from the global list of devices
> upon device removal.  If the device is re-added, the removal code would
> find the first instance and try to remove an already removed device.
> 
> Cc:  # 3.9.x: ad3e2751: ntb: off by one
> Cc:  # 3.9.x: cc0f868d: NTB: fix pointer math
> Cc:  # 3.9.x: 113fc505: NTB: Handle 64bit BAR
> Cc:  # 3.9.x: b77b2637: NTB: Link toggle memory
> Cc:  # 3.9.x: 90f9e934: NTB: reset tx_index on
> Cc:  # 3.9.x: c9d534c8: NTB: Correctly handle receive
> Cc:  # 3.9.x: c336acd3: NTB: memcpy lockup workaround
> Signed-off-by: Jon Mason 
> Signed-off-by: Jonghwan Choi 
> ---
>  drivers/net/ntb_netdev.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/ntb_netdev.c b/drivers/net/ntb_netdev.c
> index ed947dd..f3cdf64 100644
> --- a/drivers/net/ntb_netdev.c
> +++ b/drivers/net/ntb_netdev.c
> @@ -375,6 +375,8 @@ static void ntb_netdev_remove(struct pci_dev *pdev)
>   if (dev == NULL)
>   return;
>  
> + list_del(>list);
> +
>   ndev = dev->ndev;
>  
>   unregister_netdev(ndev);
> -- 
> 1.8.1.2
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3.9-stable] NTB: memcpy lockup workaround

2013-05-18 Thread Jon Mason
On Sat, May 18, 2013 at 11:52:17AM +0900, Jonghwan Choi wrote:
> From: Jon Mason 
> 
> This patch looks like it should be in the 3.9-stable tree, should we apply
> it?

Yes, thanks.

> 
> --
> 
> From: "Jon Mason "
> 
> commit c336acd3331dcc191a97dbc66a557d47741657c7 upstream
> 
> The system will appear to lockup for long periods of time due to the NTB
> driver spending too much time in memcpy.  Avoid this by reducing the
> number of packets that can be serviced on a given interrupt.
> 
> Cc:  # 3.9.x: ad3e2751: ntb: off by one
> Cc:  # 3.9.x: cc0f868d: NTB: fix pointer math
> Cc:  # 3.9.x: 113fc505: NTB: Handle 64bit BAR
> Cc:  # 3.9.x: b77b2637: NTB: Link toggle memory
> Cc:  # 3.9.x: 90f9e934: NTB: reset tx_index on
> Cc:  # 3.9.x: c9d534c8: NTB: Correctly handle receive
> Signed-off-by: Jon Mason 
> Signed-off-by: Jonghwan Choi 
> ---
>  drivers/ntb/ntb_transport.c | 11 ---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
> index a288a26..0f66daa 100644
> --- a/drivers/ntb/ntb_transport.c
> +++ b/drivers/ntb/ntb_transport.c
> @@ -1034,11 +1034,16 @@ out:
>  static void ntb_transport_rx(unsigned long data)
>  {
>   struct ntb_transport_qp *qp = (struct ntb_transport_qp *)data;
> - int rc;
> + int rc, i;
>  
> - do {
> + /* Limit the number of packets processed in a single interrupt to
> +  * provide fairness to others
> +  */
> + for (i = 0; i < qp->rx_max_entry; i++) {
>   rc = ntb_process_rxc(qp);
> - } while (!rc);
> + if (rc)
> + break;
> + }
>  }
>  
>  static void ntb_transport_rxc_db(void *data, int db_num)
> -- 
> 1.8.1.2
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3.9-table] NTB: Correctly handle receive buffers of the minimal size

2013-05-18 Thread Jon Mason
On Sat, May 18, 2013 at 11:49:39AM +0900, Jonghwan Choi wrote:
> From: Jon Mason 
> 
> This patch looks like it should be in the 3.9-stable tree, should we apply
> it?

Yes, thanks.

> 
> --
> 
> From: "Jon Mason "
> 
> commit c9d534c8cbaedbb522a1d2cb037c6c394f610317 upstream
> 
> The ring logic of the NTB receive buffer/transmit memory window requires
> there to be at least 2 payload sized allotments.  For the minimal size
> case, split the buffer into two and set the transport_mtu to the
> appropriate size.
> 
> Cc:  # 3.9.x: ad3e2751: ntb: off by one
> Cc:  # 3.9.x: cc0f868d: NTB: fix pointer math
> Cc:  # 3.9.x: 113fc505: NTB: Handle 64bit BAR
> Cc:  # 3.9.x: b77b2637: NTB: Link toggle memory
> Cc:  # 3.9.x: 90f9e934: NTB: reset tx_index on
> Signed-off-by: Jon Mason 
> Signed-off-by: Jonghwan Choi 
> ---
>  drivers/ntb/ntb_transport.c | 8 +---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
> index 0828124..a288a26 100644
> --- a/drivers/ntb/ntb_transport.c
> +++ b/drivers/ntb/ntb_transport.c
> @@ -490,11 +490,12 @@ static void ntb_transport_setup_qp_mw(struct 
> ntb_transport *nt,
>   rx_size -= sizeof(struct ntb_rx_info);
>  
>   qp->rx_buff = qp->remote_rx_info + 1;
> - qp->rx_max_frame = min(transport_mtu, rx_size);
> + /* Due to housekeeping, there must be atleast 2 buffs */
> + qp->rx_max_frame = min(transport_mtu, rx_size / 2);
>   qp->rx_max_entry = rx_size / qp->rx_max_frame;
>   qp->rx_index = 0;
>  
> - qp->remote_rx_info->entry = qp->rx_max_entry;
> + qp->remote_rx_info->entry = qp->rx_max_entry - 1;
>  
>   /* setup the hdr offsets with 0's */
>   for (i = 0; i < qp->rx_max_entry; i++) {
> @@ -818,7 +819,8 @@ static void ntb_transport_init_queue(struct ntb_transport 
> *nt,
>   tx_size -= sizeof(struct ntb_rx_info);
>  
>   qp->tx_mw = qp->rx_info + 1;
> - qp->tx_max_frame = min(transport_mtu, tx_size);
> + /* Due to housekeeping, there must be atleast 2 buffs */
> + qp->tx_max_frame = min(transport_mtu, tx_size / 2);
>   qp->tx_max_entry = tx_size / qp->tx_max_frame;
>  
>   if (nt->debugfs_dir) {
> -- 
> 1.8.1.2
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3.9-stable] NTB: reset tx_index on link toggle

2013-05-18 Thread Jon Mason
On Sat, May 18, 2013 at 11:47:17AM +0900, Jonghwan Choi wrote:
> From: Jon Mason 
> 
> This patch looks like it should be in the 3.9-stable tree, should we apply
> it?

Yes, thanks.

> 
> --
> 
> From: "Jon Mason "
> 
> commit 90f9e934647e652a69396e18c779215a493271cf upstream
> 
> If the NTB link toggles, the driver could stop receiving due to the
> tx_index not being set to 0 on the transmitting size on a link-up event.
> This is due to the driver expecting the incoming data to start at the
> beginning of the receive buffer and not at a random place.
> 
> Cc:  # 3.9.x: ad3e2751: ntb: off by one
> Cc:  # 3.9.x: cc0f868d: NTB: fix pointer math
> Cc:  # 3.9.x: 113fc505: NTB: Handle 64bit BAR
> Cc:  # 3.9.x: b77b2637: NTB: Link toggle memory
> Signed-off-by: Jon Mason 
> Signed-off-by: Jonghwan Choi 
> ---
>  drivers/ntb/ntb_transport.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
> index f5a424d..0828124 100644
> --- a/drivers/ntb/ntb_transport.c
> +++ b/drivers/ntb/ntb_transport.c
> @@ -505,6 +505,7 @@ static void ntb_transport_setup_qp_mw(struct 
> ntb_transport *nt,
>  
>   qp->rx_pkts = 0;
>   qp->tx_pkts = 0;
> + qp->tx_index = 0;
>  }
>  
>  static void ntb_free_mw(struct ntb_transport *nt, int num_mw)
> @@ -819,7 +820,6 @@ static void ntb_transport_init_queue(struct ntb_transport 
> *nt,
>   qp->tx_mw = qp->rx_info + 1;
>   qp->tx_max_frame = min(transport_mtu, tx_size);
>   qp->tx_max_entry = tx_size / qp->tx_max_frame;
> - qp->tx_index = 0;
>  
>   if (nt->debugfs_dir) {
>   char debugfs_name[4];
> -- 
> 1.8.1.2
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3.9-table] NTB: Link toggle memory leak

2013-05-18 Thread Jon Mason
On Sat, May 18, 2013 at 11:44:51AM +0900, Jonghwan Choi wrote:
> From: Jon Mason 
> 
> This patch looks like it should be in the 3.9-stable tree, should we apply
> it?

Yes, thanks.

> 
> --
> 
> From: "Jon Mason "
> 
> commit b77b2637b39ecc380bb08992380d7d48452b0872 upstream
> 
> Each link-up will allocate a new NTB receive buffer when the NTB
> properties are negotiated with the remote system.  These allocations did
> not check for existing buffers and thus did not free them.  Now, the
> driver will check for an existing buffer and free it if not of the
> correct size, before trying to alloc a new one.
> 
> Cc:  # 3.9.x: ad3e2751: ntb: off by one
> Cc:  # 3.9.x: cc0f868d: NTB: fix pointer math
> Cc:  # 3.9.x: 113fc505: NTB: Handle 64bit BAR
> Signed-off-by: Jon Mason 
> Signed-off-by: Jonghwan Choi 
> ---
>  drivers/ntb/ntb_transport.c | 32 
>  1 file changed, 20 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
> index 2258649..f5a424d 100644
> --- a/drivers/ntb/ntb_transport.c
> +++ b/drivers/ntb/ntb_transport.c
> @@ -507,17 +507,37 @@ static void ntb_transport_setup_qp_mw(struct 
> ntb_transport *nt,
>   qp->tx_pkts = 0;
>  }
>  
> +static void ntb_free_mw(struct ntb_transport *nt, int num_mw)
> +{
> + struct ntb_transport_mw *mw = >mw[num_mw];
> + struct pci_dev *pdev = ntb_query_pdev(nt->ndev);
> +
> + if (!mw->virt_addr)
> + return;
> +
> + dma_free_coherent(>dev, mw->size, mw->virt_addr, mw->dma_addr);
> + mw->virt_addr = NULL;
> +}
> +
>  static int ntb_set_mw(struct ntb_transport *nt, int num_mw, unsigned int 
> size)
>  {
>   struct ntb_transport_mw *mw = >mw[num_mw];
>   struct pci_dev *pdev = ntb_query_pdev(nt->ndev);
>  
> + /* No need to re-setup */
> + if (mw->size == ALIGN(size, 4096))
> + return 0;
> +
> + if (mw->size != 0)
> + ntb_free_mw(nt, num_mw);
> +
>   /* Alloc memory for receiving data.  Must be 4k aligned */
>   mw->size = ALIGN(size, 4096);
>  
>   mw->virt_addr = dma_alloc_coherent(>dev, mw->size, >dma_addr,
>  GFP_KERNEL);
>   if (!mw->virt_addr) {
> + mw->size = 0;
>   dev_err(>dev, "Unable to allocate MW buffer of size %d\n",
>  (int) mw->size);
>   return -ENOMEM;
> @@ -529,18 +549,6 @@ static int ntb_set_mw(struct ntb_transport *nt, int 
> num_mw, unsigned int size)
>   return 0;
>  }
>  
> -static void ntb_free_mw(struct ntb_transport *nt, int num_mw)
> -{
> - struct ntb_transport_mw *mw = >mw[num_mw];
> - struct pci_dev *pdev = ntb_query_pdev(nt->ndev);
> -
> - if (!mw->virt_addr)
> - return;
> -
> - dma_free_coherent(>dev, mw->size, mw->virt_addr, mw->dma_addr);
> - mw->virt_addr = NULL;
> -}
> -
>  static void ntb_qp_link_cleanup(struct work_struct *work)
>  {
>   struct ntb_transport_qp *qp = container_of(work,
> -- 
> 1.8.1.2
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3.9-table] NTB: Handle 64bit BAR sizes

2013-05-18 Thread Jon Mason
On Sat, May 18, 2013 at 11:41:56AM +0900, Jonghwan Choi wrote:
> From: Jon Mason 
> 
> This patch looks like it should be in the 3.9-stable tree, should we apply
> it?

Yes, thanks.

> 
> --
> 
> From: "Jon Mason "
> 
> commit 113fc505b83b2d16e820ca74fa07f99a34877b1d upstream
> 
> 64bit BAR sizes are permissible with an NTB device.  To support them
> various modifications and clean-ups were required, most significantly
> using 2 32bit scratch pad registers for each BAR.
> 
> Also, modify the driver to allow more than 2 Memory Windows.
> 
> Cc:  # 3.9.x: ad3e2751: ntb: off by one
> Cc:  # 3.9.x: cc0f868d: NTB: fix pointer math
> Signed-off-by: Jon Mason 
> Signed-off-by: Jonghwan Choi 
> ---
>  drivers/ntb/ntb_hw.c|   4 +-
>  drivers/ntb/ntb_transport.c | 121 
> ++--
>  2 files changed, 75 insertions(+), 50 deletions(-)
> 
> diff --git a/drivers/ntb/ntb_hw.c b/drivers/ntb/ntb_hw.c
> index 195cc51..2dacd19 100644
> --- a/drivers/ntb/ntb_hw.c
> +++ b/drivers/ntb/ntb_hw.c
> @@ -1027,8 +1027,8 @@ static int ntb_pci_probe(struct pci_dev *pdev, const 
> struct pci_device_id *id)
>   ndev->mw[i].vbase =
>   ioremap_wc(pci_resource_start(pdev, MW_TO_BAR(i)),
>  ndev->mw[i].bar_sz);
> - dev_info(>dev, "MW %d size %d\n", i,
> -  (u32) pci_resource_len(pdev, MW_TO_BAR(i)));
> + dev_info(>dev, "MW %d size %llu\n", i,
> +  pci_resource_len(pdev, MW_TO_BAR(i)));
>   if (!ndev->mw[i].vbase) {
>   dev_warn(>dev, "Cannot remap BAR %d\n",
>MW_TO_BAR(i));
> diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
> index 676ee16..2258649 100644
> --- a/drivers/ntb/ntb_transport.c
> +++ b/drivers/ntb/ntb_transport.c
> @@ -58,7 +58,7 @@
>  #include 
>  #include "ntb_hw.h"
>  
> -#define NTB_TRANSPORT_VERSION2
> +#define NTB_TRANSPORT_VERSION3
>  
>  static unsigned int transport_mtu = 0x401E;
>  module_param(transport_mtu, uint, 0644);
> @@ -173,10 +173,13 @@ struct ntb_payload_header {
>  
>  enum {
>   VERSION = 0,
> - MW0_SZ,
> - MW1_SZ,
> - NUM_QPS,
>   QP_LINKS,
> + NUM_QPS,
> + NUM_MWS,
> + MW0_SZ_HIGH,
> + MW0_SZ_LOW,
> + MW1_SZ_HIGH,
> + MW1_SZ_LOW,
>   MAX_SPAD,
>  };
>  
> @@ -526,6 +529,18 @@ static int ntb_set_mw(struct ntb_transport *nt, int 
> num_mw, unsigned int size)
>   return 0;
>  }
>  
> +static void ntb_free_mw(struct ntb_transport *nt, int num_mw)
> +{
> + struct ntb_transport_mw *mw = >mw[num_mw];
> + struct pci_dev *pdev = ntb_query_pdev(nt->ndev);
> +
> + if (!mw->virt_addr)
> + return;
> +
> + dma_free_coherent(>dev, mw->size, mw->virt_addr, mw->dma_addr);
> + mw->virt_addr = NULL;
> +}
> +
>  static void ntb_qp_link_cleanup(struct work_struct *work)
>  {
>   struct ntb_transport_qp *qp = container_of(work,
> @@ -604,25 +619,31 @@ static void ntb_transport_link_work(struct work_struct 
> *work)
>   u32 val;
>   int rc, i;
>  
> - /* send the local info */
> - rc = ntb_write_remote_spad(ndev, VERSION, NTB_TRANSPORT_VERSION);
> - if (rc) {
> - dev_err(>dev, "Error writing %x to remote spad %d\n",
> - 0, VERSION);
> - goto out;
> - }
> + /* send the local info, in the opposite order of the way we read it */
> + for (i = 0; i < NTB_NUM_MW; i++) {
> + rc = ntb_write_remote_spad(ndev, MW0_SZ_HIGH + (i * 2),
> +ntb_get_mw_size(ndev, i) >> 32);
> + if (rc) {
> + dev_err(>dev, "Error writing %u to remote spad 
> %d\n",
> + (u32)(ntb_get_mw_size(ndev, i) >> 32),
> + MW0_SZ_HIGH + (i * 2));
> + goto out;
> + }
>  
> - rc = ntb_write_remote_spad(ndev, MW0_SZ, ntb_get_mw_size(ndev, 0));
> - if (rc) {
> - dev_err(>dev, "Error writing %x to remote spad %d\n",
> - (u32) ntb_get_mw_size(ndev, 0), MW0_SZ);
> - goto out;
> + rc = ntb_write_remote_spad(ndev, MW0_SZ_LOW + (i * 2),
> +(u32) ntb_get_mw_size(ndev, i));
> + if (rc) {
> + dev_err(>dev, "Error writing %u to remote spad 
> %d\n",
> + (u32) ntb_get_mw_size(ndev, i),
> + MW0_SZ_LOW + (i * 2));
> + goto out;
> + }
>   }
>  
> - rc = ntb_write_remote_spad(ndev, MW1_SZ, ntb_get_mw_size(ndev, 1));
> + rc = ntb_write_remote_spad(ndev, NUM_MWS, NTB_NUM_MW);
>   if (rc) {
>   dev_err(>dev, "Error writing %x to remote spad %d\n",
> - (u32) ntb_get_mw_size(ndev, 1), MW1_SZ);
> + 

Re: [PATCH 3.9-stable] ntb: off by one sanity checks

2013-05-18 Thread Jon Mason
On Sat, May 18, 2013 at 11:35:38AM +0900, Jonghwan Choi wrote:
> From: Dan Carpenter 
> 
> This patch looks like it should be in the 3.9-stable tree, should we apply
> it?

Yes, please do.  I'll respond to each of the patch series, but please
apply them all.  Also, one patch was omitted from these, titled 
NTB: variable dereferenced before check

Please include that patch in 3.9 stable as well.

Thank you for doing this.

Thanks,
Jon

> 
> --
> 
> From: "Dan Carpenter "
> 
> commit ad3e2751e7c546ae678be1f8d86e898506b42cef upstream
> 
> These tests are off by one.  If "mw" is equal to NTB_NUM_MW then we
> would go beyond the end of the ndev->mw[] array.
> 
> Signed-off-by: Dan Carpenter 
> Signed-off-by: Jon Mason 
> Signed-off-by: Jonghwan Choi 
> ---
>  drivers/ntb/ntb_hw.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/ntb/ntb_hw.c b/drivers/ntb/ntb_hw.c
> index f802e7c..195cc51 100644
> --- a/drivers/ntb/ntb_hw.c
> +++ b/drivers/ntb/ntb_hw.c
> @@ -345,7 +345,7 @@ int ntb_read_remote_spad(struct ntb_device *ndev, 
> unsigned int idx, u32 *val)
>   */
>  void __iomem *ntb_get_mw_vbase(struct ntb_device *ndev, unsigned int mw)
>  {
> - if (mw > NTB_NUM_MW)
> + if (mw >= NTB_NUM_MW)
>   return NULL;
>  
>   return ndev->mw[mw].vbase;
> @@ -362,7 +362,7 @@ void __iomem *ntb_get_mw_vbase(struct ntb_device *ndev, 
> unsigned int mw)
>   */
>  resource_size_t ntb_get_mw_size(struct ntb_device *ndev, unsigned int mw)
>  {
> - if (mw > NTB_NUM_MW)
> + if (mw >= NTB_NUM_MW)
>   return 0;
>  
>   return ndev->mw[mw].bar_sz;
> @@ -380,7 +380,7 @@ resource_size_t ntb_get_mw_size(struct ntb_device *ndev, 
> unsigned int mw)
>   */
>  void ntb_set_mw_addr(struct ntb_device *ndev, unsigned int mw, u64 addr)
>  {
> - if (mw > NTB_NUM_MW)
> + if (mw >= NTB_NUM_MW)
>   return;
>  
>   dev_dbg(>pdev->dev, "Writing addr %Lx to BAR %d\n", addr,
> -- 
> 1.8.1.2
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[GIT PULL] Btrfs updates

2013-05-18 Thread Chris Mason
Hi Linus,

Please pull my for-linus branch:

git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs.git for-linus

Miao Xie has been very busy, fixing races and enospc problems and many
other small but important pieces.

Alexandre Oliva discovered some problems with how our error handling was
interacting with the block layer and for now has disabled our partial
handling of sub-page writes.  The real sub-page work is in a series of
patches from IBM that we still need to integrate and test.  The code
Alexandre has turned off was really incomplete.

Josef has more error handling fixes and an important fix for the new
skinny extent format.

This also has my fix for the tracepoint crash from late in 3.9.  It's
the first stage in a larger clean up to get rid of btrfs_bio and make
a proper bioset for all the items we need to tack into the bio.  For now
the bioset only holds our mirror_num and stripe_index, but for the next
merge window I'll shuffle more in.

Miao Xie (10) commits (+87/-69):
Btrfs: don't steal the reserved space from the global reserve if their 
space type is different (+4/-2)
Btrfs: don't abort the current transaction if there is no enough space for 
inode cache (+2/-1)
Btrfs: don't invoke btrfs_invalidate_inodes() in the spin lock context 
(+6/-0)
Btrfs: don't use global block reservation for inode cache truncation 
(+34/-22)
Btrfs: fix unprotected root node of the subvolume's inode rb-tree (+3/-4)
Btrfs: remove BUG_ON() in btrfs_read_fs_tree_no_radix() (+0/-1)
Btrfs: pause the space balance when remounting to R/O (+1/-0)
Btrfs: optimize the error handle of use_block_rsv() (+28/-37)
Btrfs: update the global reserve if it is empty (+8/-1)
Btrfs: fix accessing a freed tree root (+1/-1)

Josef Bacik (4) commits (+35/-32):
Btrfs: make sure roots are assigned before freeing their nodes (+21/-18)
Btrfs: handle running extent ops with skinny metadata (+12/-10)
Btrfs: remove warn on in free space cache writeout (+1/-3)
Btrfs: don't null pointer deref on abort (+1/-1)

Stefan Behrens (3) commits (+8/-1):
Btrfs: explicitly use global_block_rsv for quota_tree (+2/-0)
Btrfs: fix possible memory leak in replace_path() (+1/-1)
Btrfs: don't allow device replace on RAID5/RAID6 (+5/-0)

Liu Bo (2) commits (+8/-4):
Btrfs: return errno if possible when we fail to allocate memory (+6/-2)
Btrfs: fix off-by-one in fiemap (+2/-2)

Gabriel de Perthuis (1) commits (+5/-5):
btrfs: don't stop searching after encountering the wrong item

Alexandre Oliva (1) commits (+30/-55):
btrfs: do away with non-whole_page extent I/O

Chris Mason (1) commits (+120/-72):
Btrfs: use a btrfs bioset instead of abusing bio internals

David Sterba (1) commits (+4/-4):
btrfs: annotate quota tree for lockdep

Wang Shilong (1) commits (+2/-1):
Btrfs: fix possible memory leak in the find_parent_nodes()

Andreas Philipp (1) commits (+6/-7):
Correct allowed raid levels on balance.

Total: (25) commits (+305/-250)

 fs/btrfs/backref.c  |   3 +-
 fs/btrfs/check-integrity.c  |   2 +-
 fs/btrfs/ctree.c|   4 +-
 fs/btrfs/ctree.h|   8 +--
 fs/btrfs/delayed-ref.h  |   1 +
 fs/btrfs/dev-replace.c  |   5 ++
 fs/btrfs/disk-io.c  |  52 ++---
 fs/btrfs/extent-tree.c  |  94 --
 fs/btrfs/extent_io.c| 138 +++-
 fs/btrfs/extent_io.h|   2 +
 fs/btrfs/free-space-cache.c |  43 +++---
 fs/btrfs/free-space-cache.h |   2 +
 fs/btrfs/inode-map.c|   8 ++-
 fs/btrfs/inode.c|  81 +-
 fs/btrfs/ioctl.c|  10 ++--
 fs/btrfs/raid56.c   |   2 +-
 fs/btrfs/relocation.c   |   7 ++-
 fs/btrfs/scrub.c|  10 ++--
 fs/btrfs/super.c|   1 +
 fs/btrfs/volumes.c  |  54 -
 fs/btrfs/volumes.h  |  20 +++
 21 files changed, 301 insertions(+), 246 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] cpufreq/intel_pstate: Add additional supported CPU ID

2013-05-18 Thread Theodore Ts'o
On Fri, May 17, 2013 at 09:10:24AM -0700, dirk.brande...@gmail.com wrote:
> From: Dirk Brandewie 
> 
> Add CPU ID for Ivybrigde processor.
> 
> Cc: torva...@linux-foundation.org
> Signed-off-by: Dirk Brandewie 

BTW, there are some good comments about this by Arjan in this G+ post

https://plus.google.com/117091380454742934025/posts/2vEekAsG2QT

I've tested a patch identical to this on my Thinkpad T430s and it
seems to work quite well for me.

- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


ipc/sem.c: Lockup with complex ops, comments not updated

2013-05-18 Thread Manfred Spraul

Hi Rik,

I like your change to the ipc/sem locking:
A scheme with a per-semaphore lock and without the overhead of always 
acquiring both the global and the per-semaphore lock.


But:
1) I found one bug with your sem locking changes:
If
- a complex operation is sleeping [would be woken up by update_queue(,-1)]
- a simple op is sleeping
- the success of the simple op would allow the complex op to complete
[i.e.: update_queue(,sem_num) changes the semaphore value to the 
value that the complex op waits on]

- an operation wakes up the simple op.

then the complex op is not woken up.

One fix would be a loop in do_smart_update():
- first check the global queue
- then the per-semaphore queues
- if one of the per-semaphore queues made progress: check the global 
queue again

- if the global queue made progress: check the per semaphore queues again
...

2) Your patches remove FIFO ordering of the wakeups:
As far as I can see complex ops are now preferred over simple ops.
It's not a bug, noone exept linux implements FIFO.
But the comment it line 28 should be updated

Should I write a patch, do you want to fix it yourself?

--
Manfred
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 4/4] fb: vt8500: Add VGA output support to wm8505fb driver.

2013-05-18 Thread Andy Chernyak
On 05/18/2013 03:28 PM, Alexey Charkov wrote:
> 2013/5/18 Tony Prisk :
>
>> /* Virtual buffer size */
>> @@ -167,7 +176,12 @@ static int wm8505fb_init_hw(struct fb_info *info)
>>
>> /* black magic ;) */
>> writel(0xf,fbi->regbase + REG_GOVRH_FHI);
>> -   writel(4,  fbi->regbase + REG_GOVRH_DVO_SET);
>> +
>> +   if (fbi->interface == INTERFACE_VGA)
>> +   writel(0xe, fbi->regbase + REG_GOVRH_DVO_SET);
>> +   else
>> +   writel(4, fbi->regbase + REG_GOVRH_DVO_SET);
> I don't remember if HDMI is yet another option for this register or
> not... If it is, it would probably warrant defining fbi->interface as
> an enum and changing this if-else into a switch statement to let the
> compiler add its checks/warnings.
HDMI output can work simultaneously with LCD (on 8850 at least), which
fbi->interface in its current form would not allow to express.

> +   if (fbi->interface == INTERFACE_VGA)
> +   writel(h_sync,  fbi->regbase + REG_GOVRH_VGA_HSYNW);
> Will it misbehave on LCD if you write to the VGA register unconditionally?
>
Can we have 3 flags, something like LCD_ON, VGA_ON, HDMI_ON instead of
enum for video interface selection?

Regards,
Andy.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


broadcast arp messages and linux kernel

2013-05-18 Thread Mahmood Naderan

Hello,
Recently I have detected an IP conflict while my OS is redhat.
 Searching for a solution revealed that linux kernel doesn't reply to 
broadcast arp messages *at all*. As a result when someone asks "who has 
ip A.B.C.D?", my kernel won't reply to that and the other host thinks no
 one has that IP so there will be a conflict.

I also searched a lot to find why kernel won't reply to that but didn't find a 
clear answer.
Don't you think kernel should reply to those messages?

 
Regards,
Mahmood

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 4/4] fb: vt8500: Add VGA output support to wm8505fb driver.

2013-05-18 Thread Alexey Charkov
2013/5/18 Tony Prisk :
> The APC8750 does not support an LCD panel, but provides a VGA connector.
> This patch adds support for the VGA interface, and defines an optional
> devicetree property to specify the output interface. The default if not
> specified is LCD for backward compatibility.
>
> Signed-off-by: Tony Prisk 
> ---
>  .../devicetree/bindings/video/wm,wm8505-fb.txt |5 
>  drivers/video/wm8505fb.c   |   31 
> ++--
>  2 files changed, 34 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt 
> b/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt
> index 601416c..9f1d648 100644
> --- a/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt
> +++ b/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt
> @@ -7,6 +7,10 @@ Required properties:
>  - bits-per-pixel : bit depth of framebuffer (16 or 32)
>  - clocks : phandle to DVO clock
>
> +Optional properties:
> +- output-interface : the interface the fb should output on. Valid values are
> +   "lcd" or "vga". If not specified, the default is "lcd".
> +
>  Required subnodes:
>  - display-timings: see display-timing.txt for information
>
> @@ -17,6 +21,7 @@ Example:
> reg = <0xd8051700 0x200>;
> bits-per-pixel = <16>;
> clocks = <>;
> +   output-interface = "vga";
>
> display-timings {
> native-mode = <>;
> diff --git a/drivers/video/wm8505fb.c b/drivers/video/wm8505fb.c
> index f8bffc2..d1f7f33 100644
> --- a/drivers/video/wm8505fb.c
> +++ b/drivers/video/wm8505fb.c
> @@ -130,12 +130,17 @@
>
>  #define to_wm8505fb_info(__info) container_of(__info, \
> struct wm8505fb_info, fb)
> +
> +#define INTERFACE_LCD  1
> +#define INTERFACE_VGA  2
> +
>  struct wm8505fb_info {
> struct fb_info fb;
> void __iomem *regbase;
> unsigned int contrast;
> struct device *dev;
> struct clk *clk_dvo;
> +   int interface;
>  };
>
>
> @@ -158,7 +163,11 @@ static int wm8505fb_init_hw(struct fb_info *info)
>  * 0x31C sets the correct color mode (RGB565) for WM8650
>  * Bit 8+9 (0x300) are ignored on WM8505 as reserved
>  */
> -   writel(0x31c,  fbi->regbase + REG_GOVRH_YUVRGB);
> +   if (fbi->interface == INTERFACE_VGA)
> +   writel(0x338, fbi->regbase + REG_GOVRH_YUVRGB);
> +   else
> +   writel(0x31c, fbi->regbase + REG_GOVRH_YUVRGB);
> +
> writel(1,  fbi->regbase + REG_GOVRH_DVO_PIX);

Tony,

Would it be possible to also define known bit offsets for those
registers, while you are at this? It would probably reduce the black
magic quite a bit :)

> /* Virtual buffer size */
> @@ -167,7 +176,12 @@ static int wm8505fb_init_hw(struct fb_info *info)
>
> /* black magic ;) */
> writel(0xf,fbi->regbase + REG_GOVRH_FHI);
> -   writel(4,  fbi->regbase + REG_GOVRH_DVO_SET);
> +
> +   if (fbi->interface == INTERFACE_VGA)
> +   writel(0xe, fbi->regbase + REG_GOVRH_DVO_SET);
> +   else
> +   writel(4, fbi->regbase + REG_GOVRH_DVO_SET);

I don't remember if HDMI is yet another option for this register or
not... If it is, it would probably warrant defining fbi->interface as
an enum and changing this if-else into a switch statement to let the
compiler add its checks/warnings.

> writel(1,  fbi->regbase + REG_GOVRH_MIF);
> writel(1,  fbi->regbase + REG_GOVRH_REG_STS);
>
> @@ -194,11 +208,15 @@ static int wm8505fb_set_timing(struct fb_info *info)
> writel(h_end,   fbi->regbase + REG_GOVRH_ACTPX_END);
> writel(h_all,   fbi->regbase + REG_GOVRH_H_ALLPXL);
> writel(h_sync,  fbi->regbase + REG_GOVRH_HDMI_HSYNW);
> +   if (fbi->interface == INTERFACE_VGA)
> +   writel(h_sync,  fbi->regbase + REG_GOVRH_VGA_HSYNW);

Will it misbehave on LCD if you write to the VGA register unconditionally?

> writel(v_start, fbi->regbase + REG_GOVRH_ACTLN_BG);
> writel(v_end,   fbi->regbase + REG_GOVRH_ACTLN_END);
> writel(v_all,   fbi->regbase + REG_GOVRH_V_ALLLN);
> writel(v_sync,  fbi->regbase + REG_GOVRH_HDMI_VBISW);
> +   if (fbi->interface == INTERFACE_VGA)
> +   writel(info->var.pixclock,  fbi->regbase + 
> REG_GOVRH_VGA_VSYNW);

Same here. I would assume that setting the pixclock should not hurt
LCD, which would then simplify the code a little.

Thanks,
Alexey
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] n_tty: fix .chars_in_buffer confusion

2013-05-18 Thread Stas Sergeev

Hi.

I think there is a confusion with n_tty_chars_in_buffer(): it
calculates the amount of input chars, but is used as a
.chars_in_buffer member of tty_ldisc_ops, which, AFAIK,
should calculate the amount of _output_ chars buffered.

Here is the patch that changes this.
Since it doesn't fix any problem I can practically observe,
the chances are high that I am missing something obvious.

Can someone please take a look if there is really a bug here?
>From cea19eda592e61db780e3ce1a7bf9a5f0899a0fc Mon Sep 17 00:00:00 2001
From: Stas Sergeev 
Date: Sat, 18 May 2013 15:06:39 +0400
Subject: [PATCH] n_tty: fix .chars_in_buffer confusion

n_tty_chars_in_buffer() was calculating the amount of input
chars, not output chars. It therefore should not be used as
a .chars_in_buffer member.
This patch removes it from tty_ldisc_ops and renames to
chars_in_input_buffer()

Signed-off-by: Stas Sergeev 
---
 drivers/tty/n_tty.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 3f228c9..0567235 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -253,7 +253,7 @@ static void n_tty_flush_buffer(struct tty_struct *tty)
 }
 
 /**
- *	n_tty_chars_in_buffer	-	report available bytes
+ *	chars_in_input_buffer	-	report available bytes
  *	@tty: tty device
  *
  *	Report the number of characters buffered to be delivered to user
@@ -262,7 +262,7 @@ static void n_tty_flush_buffer(struct tty_struct *tty)
  *	Locking: read_lock
  */
 
-static ssize_t n_tty_chars_in_buffer(struct tty_struct *tty)
+static ssize_t chars_in_input_buffer(struct tty_struct *tty)
 {
 	struct n_tty_data *ldata = tty->disc_data;
 	unsigned long flags;
@@ -1977,7 +1977,7 @@ do_it_again:
 		}
 
 		/* If there is enough space in the read buffer now, let the
-		 * low-level driver know. We use n_tty_chars_in_buffer() to
+		 * low-level driver know. We use chars_in_input_buffer() to
 		 * check the buffer, as it now knows about canonical mode.
 		 * Otherwise, if the driver is throttled and the line is
 		 * longer than TTY_THRESHOLD_UNTHROTTLE in canonical mode,
@@ -1985,7 +1985,7 @@ do_it_again:
 		 */
 		while (1) {
 			tty_set_flow_change(tty, TTY_UNTHROTTLE_SAFE);
-			if (n_tty_chars_in_buffer(tty) > TTY_THRESHOLD_UNTHROTTLE)
+			if (chars_in_input_buffer(tty) > TTY_THRESHOLD_UNTHROTTLE)
 break;
 			if (!tty->count)
 break;
@@ -2206,7 +2206,6 @@ struct tty_ldisc_ops tty_ldisc_N_TTY = {
 	.open= n_tty_open,
 	.close   = n_tty_close,
 	.flush_buffer= n_tty_flush_buffer,
-	.chars_in_buffer = n_tty_chars_in_buffer,
 	.read= n_tty_read,
 	.write   = n_tty_write,
 	.ioctl   = n_tty_ioctl,
-- 
1.7.11.7



Re: [PATCH 3.9-table] NTB: fix pointer math issues

2013-05-18 Thread jonghwan Choi
Thanks for your advice.

Best Regards.

On Sat, May 18, 2013 at 3:00 AM, Dan Carpenter  wrote:
> On Sat, May 18, 2013 at 11:39:05AM +0900, Jonghwan Choi wrote:
>> From: Dan Carpenter 
>>
>> This patch looks like it should be in the 3.9-stable tree, should we apply
>> it?
>>
>
> Normally these questions are handled by the subsystem maintainer.
>
> regards,
> dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] cpufreq/intel_pstate: Add additional supported CPU ID

2013-05-18 Thread Viresh Kumar
On Fri, May 17, 2013 at 9:40 PM,   wrote:
> From: Dirk Brandewie 
>
> Add CPU ID for Ivybrigde processor.
>
> Cc: torva...@linux-foundation.org
> Signed-off-by: Dirk Brandewie 
> ---
>  drivers/cpufreq/intel_pstate.c |1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)

Add my Acked-by: Viresh Kumar , even if
next version is required with some more machine no.s
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/3] CPUFreq Fixes for 3.10-rc2

2013-05-18 Thread Viresh Kumar
On 18 May 2013 14:46, Rafael J. Wysocki  wrote:
> Although not necessarily 3.10 material I suppose?

Yes.. Pick only 3/3 for 3.10 and others for later part..
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Regmap and register ranges

2013-05-18 Thread Mark Brown
On Fri, May 17, 2013 at 02:52:46PM -0700, Dmitry Torokhov wrote:
> On Fri, May 17, 2013 at 09:50:25PM +0100, Mark Brown wrote:

> > The general idea is that the pages should be mapped in to virtual
> > addresses rather than real ones so in your example you might add a
> > prefix so all the registers are numbered 0x1 to 0x1.  The
> > physical registers and the ones inside the paged range aren't supposed
> > to overlap.

> The issue I have with doing an arbitrary offset is that then data
> exposed in debugfs does not match the data from device's specification.

Adding a random prefix on the front does mean you can just ignore the
prefix.  But this seems a fairly odd way for the device to do things to
be honest...  paging every single register is a bit random.

> > We should probably either do sanity checks for this at init time or come
> > up with a sensible way to support this in case someone does decide to do
> > it, though this is the first time anyone noticed.

> Does this mean you'll be open to patches allowing this scenario?

Obviously I'm always open to patches that aren't crazy, though I do
reserve the right to define what's crazy :)


signature.asc
Description: Digital signature


Re: [Consult] Why need we call device_remove_file() firstly before call device_unregister() ?

2013-05-18 Thread Ming Lei
Hi,

On Fri, May 17, 2013 at 1:43 PM, Chen Gang  wrote:
> Hello All:
>
> I searched 'arch/*' and 'drivers/*' sub-directory, all of them are 'obey
> this rule', even in device_unregister() itself, it also firstly calls
> device_remove_file(), then call kobject_del().
>
> But after read the related code (fs/sysfs/*, drivers/base/core.c), it
> seems kobject_del() -> sysfs_remove_dir() which will release all related
> things (can instead of device_remove_file()).
>
> So in fact, we need not call device_remove_file() before call
> device_unregister(), is it correct ?

Looks it is correct but it is a bit implicit.

Thanks,
-- 
Ming Lei
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PULL REQUEST] devm usage cleanup #1, no resource check needed with devm_ioremap_resource()

2013-05-18 Thread Wolfram Sang
Linus,

Lately, I have been experimenting how to improve the devm interface to make
writing device drivers easier and less error prone while also getting rid of
its subtle issues. I think it has more potential but still needs work and
definately conistency, especiall in its usage.

The first thing I come up with is a low hanging fruit regarding
devm_ioremap_resouce(). This function already checks if the passed resource is
valid and gives an error message if not. So, we can remove similar checks from
the drivers and get rid of a bit of code and a number of inconsistent error
strings.

This series only removes the unneeded check iff devm_ioremap_resource follows
platform_get_resource directly. The previous version tried to shuffle code if
needed, too, what lead to an embarrasing bug. It turned out to me that
shuffling code for all cases found will make the automated script too complex,
so I am unsure if an automated cleanup is the proper tool for this case.
Removing the easy stuff seems worthwhile to me, though.

Despite various architectures and platform dependencies, I managed to compile
test 45 out of 57 modified files locally using heuristics and defconfigs.

Please pull if you think it is not too late for such a kind of cleanup.

Thanks,

   Wolfram


The following changes since commit f722406faae2d073cc1d01063d1123c35425939e:

  Linux 3.10-rc1 (2013-05-11 17:14:08 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git 
devm_no_resource_check

for you to fetch changes up to 12716cd44da7e6c935e2fb1783417ca31fbbaa97:

  sound/soc/kirkwood: don't check resource with devm_ioremap_resource 
(2013-05-18 11:59:45 +0200)


Wolfram Sang (33):
  drivers/ata: don't check resource with devm_ioremap_resource
  drivers/char/hw_random: don't check resource with devm_ioremap_resource
  drivers/cpufreq: don't check resource with devm_ioremap_resource
  drivers/dma: don't check resource with devm_ioremap_resource
  drivers/gpio: don't check resource with devm_ioremap_resource
  drivers/gpu/drm/exynos: don't check resource with devm_ioremap_resource
  drivers/gpu/host1x/drm: don't check resource with devm_ioremap_resource
  drivers/i2c/busses: don't check resource with devm_ioremap_resource
  drivers/memory: don't check resource with devm_ioremap_resource
  drivers/mfd: don't check resource with devm_ioremap_resource
  drivers/misc: don't check resource with devm_ioremap_resource
  drivers/mtd/nand: don't check resource with devm_ioremap_resource
  drivers/net/ethernet/renesas: don't check resource with 
devm_ioremap_resource
  drivers/pinctrl: don't check resource with devm_ioremap_resource
  drivers/pwm: don't check resource with devm_ioremap_resource
  drivers/rtc: don't check resource with devm_ioremap_resource
  drivers/spi: don't check resource with devm_ioremap_resource
  drivers/staging/dwc2: don't check resource with devm_ioremap_resource
  drivers/staging/nvec: don't check resource with devm_ioremap_resource
  drivers/thermal: don't check resource with devm_ioremap_resource
  drivers/usb/chipidea: don't check resource with devm_ioremap_resource
  drivers/usb/gadget: don't check resource with devm_ioremap_resource
  drivers/usb/host: don't check resource with devm_ioremap_resource
  drivers/usb/phy: don't check resource with devm_ioremap_resource
  drivers/video/omap2: don't check resource with devm_ioremap_resource
  drivers/video/omap2/dss: don't check resource with devm_ioremap_resource
  drivers/w1/masters: don't check resource with devm_ioremap_resource
  drivers/watchdog: don't check resource with devm_ioremap_resource
  arch/arm/mach-tegra: don't check resource with devm_ioremap_resource
  arch/arm/plat-samsung: don't check resource with devm_ioremap_resource
  arch/mips/lantiq/xway: don't check resource with devm_ioremap_resource
  sound/soc/fsl: don't check resource with devm_ioremap_resource
  sound/soc/kirkwood: don't check resource with devm_ioremap_resource

 arch/arm/mach-tegra/tegra2_emc.c  |5 -
 arch/arm/plat-samsung/adc.c   |5 -
 arch/mips/lantiq/xway/gptu.c  |4 
 drivers/ata/pata_ep93xx.c |5 -
 drivers/char/hw_random/mxc-rnga.c |6 --
 drivers/char/hw_random/omap-rng.c |5 -
 drivers/cpufreq/kirkwood-cpufreq.c|4 
 drivers/dma/tegra20-apb-dma.c |5 -
 drivers/gpio/gpio-mvebu.c |5 -
 drivers/gpio/gpio-tegra.c |5 -
 drivers/gpu/drm/exynos/exynos_hdmi.c  |5 -
 drivers/gpu/host1x/drm/dc.c   |5 -
 drivers/i2c/busses/i2c-s3c2410.c  |5 -
 drivers/i2c/busses/i2c-sirf.c |6 --
 drivers/i2c/busses/i2c-tegra.c|5 -
 drivers/memory/emif.c

Re: [ 104/136 ] r8169: fix 8168evl frame padding.

2013-05-18 Thread Francois Romieu
Steven Rostedt  :
> 3.6.11.4 stable review patch.
> If anyone has any objections, please let me know.

You should postpone it until the fix for a regression it induces when
user enable Tx checksumming is merged.

-- 
Ueimor
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3.9-table] NTB: fix pointer math issues

2013-05-18 Thread Dan Carpenter
On Sat, May 18, 2013 at 11:39:05AM +0900, Jonghwan Choi wrote:
> From: Dan Carpenter 
> 
> This patch looks like it should be in the 3.9-stable tree, should we apply
> it?
> 

Normally these questions are handled by the subsystem maintainer.

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/3] Thermal:core: Handle trips focused on current trip point only.

2013-05-18 Thread Jonghwa Lee
When thermal zone device is updated, it doesn't need to check
every trip points and its handling mathod even current temperature
doesn't exceed the trip's temperature. To modify those dissipatve
mechanism, this patch introduces the way to get current thermal
trip point to call only correspond trip point handling.

Signed-off-by: Jonghwa Lee 
Signed-off-by: MyungJoo Ham 
---
 drivers/thermal/thermal_core.c |   28 +---
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index ce4384a..1cc4825 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -333,14 +333,6 @@ static void handle_non_critical_trips(struct 
thermal_zone_device *tz,
 static void handle_critical_trips(struct thermal_zone_device *tz,
int trip, enum thermal_trip_type trip_type)
 {
-   long trip_temp;
-
-   tz->ops->get_trip_temp(tz, trip, _temp);
-
-   /* If we have not crossed the trip_temp, we do not care. */
-   if (tz->temperature < trip_temp)
-   return;
-
if (tz->ops->notify)
tz->ops->notify(tz, trip, trip_type);
 
@@ -437,14 +429,28 @@ static void update_temperature(struct thermal_zone_device 
*tz)
mutex_unlock(>lock);
 }
 
+static int thermal_zone_get_current_trip(struct thermal_zone_device *tz)
+{
+   int trip;
+   long trip_temp;
+
+   for (trip = tz->trips - 1; trip > 0; trip--) {
+   tz->ops->get_trip_temp(tz, trip, _temp);
+   if (tz->temperature > trip_temp)
+   continue;
+   }
+   return trip;
+}
+
 void thermal_zone_device_update(struct thermal_zone_device *tz)
 {
-   int count;
+   int trip;
 
update_temperature(tz);
 
-   for (count = 0; count < tz->trips; count++)
-   handle_thermal_trip(tz, count);
+   trip = thermal_zone_get_current_trip(tz);
+
+   handle_thermal_trip(tz, trip);
 }
 EXPORT_SYMBOL_GPL(thermal_zone_device_update);
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/3] Thermal: core: Modify temp_crit_show() to use proper callback function.

2013-05-18 Thread Jonghwa Lee
This patch modifies temp_crit_show() which is used to create hwmon's sysfs
node to use .get_crit_temp callback function of thermal zone device rather
than .get_trip_temp.

Signed-off-by: Jonghwa Lee 
Signed-off-by: MyungJoo Ham 
---
 drivers/thermal/thermal_core.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index f753f48..ce4384a 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -924,7 +924,7 @@ temp_crit_show(struct device *dev, struct device_attribute 
*attr,
long temperature;
int ret;
 
-   ret = tz->ops->get_trip_temp(tz, 0, );
+   ret = tz->ops->get_crit_temp(tz, );
if (ret)
return ret;
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/3] Thermal: core: Ask .get_trip_temp() to register thermal zone device.

2013-05-18 Thread Jonghwa Lee
This patch adds a requirement needing .get_trip_temp() callback
function for registering thermal zone device. This function is
used when thermal zone is updated and essential where thermal core
handles thermal trip based only polling way not hw interrupt.

Signed-off-by: Jonghwa Lee 
Signed-off-by: MyungJoo Ham 
---
 drivers/thermal/thermal_core.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index d755440..f753f48 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -1624,7 +1624,7 @@ struct thermal_zone_device 
*thermal_zone_device_register(const char *type,
if (!ops || !ops->get_temp)
return ERR_PTR(-EINVAL);
 
-   if (trips > 0 && !ops->get_trip_type)
+   if (trips > 0 && (!ops->get_trip_type || !ops->get_trip_temp))
return ERR_PTR(-EINVAL);
 
tz = kzalloc(sizeof(struct thermal_zone_device), GFP_KERNEL);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ARM: tegra: enable host1x support by default

2013-05-18 Thread Alexandre Courbot
Tegra DRM support used to be enabled in the default Tegra configuration,
but it now depends on CONFIG_TEGRA_HOST1X which is disabled by default.
Enable CONFIG_TEGRA_HOST1X so that DRM support is compiled in again.

Signed-off-by: Alexandre Courbot 
---
 arch/arm/configs/tegra_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/tegra_defconfig b/arch/arm/configs/tegra_defconfig
index a5f0485..dbf83db 100644
--- a/arch/arm/configs/tegra_defconfig
+++ b/arch/arm/configs/tegra_defconfig
@@ -153,6 +153,7 @@ CONFIG_MEDIA_CAMERA_SUPPORT=y
 CONFIG_MEDIA_USB_SUPPORT=y
 CONFIG_USB_VIDEO_CLASS=m
 CONFIG_DRM=y
+CONFIG_TEGRA_HOST1X=y
 CONFIG_DRM_TEGRA=y
 CONFIG_BACKLIGHT_LCD_SUPPORT=y
 # CONFIG_LCD_CLASS_DEVICE is not set
-- 
1.8.2.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/4] fb: vt8500: Move register defines inside driver

2013-05-18 Thread Tony Prisk
The #defines in wm8505fb_regs.h are only used in the wm8505fb driver,
and don't need to be visible outside.

Move the defines into the driver and remove the header.

Signed-off-by: Tony Prisk 
---
 drivers/video/wm8505fb.c  |   25 +-
 drivers/video/wm8505fb_regs.h |   76 -
 2 files changed, 24 insertions(+), 77 deletions(-)
 delete mode 100644 drivers/video/wm8505fb_regs.h

diff --git a/drivers/video/wm8505fb.c b/drivers/video/wm8505fb.c
index 01f9ace..f824af8 100644
--- a/drivers/video/wm8505fb.c
+++ b/drivers/video/wm8505fb.c
@@ -34,11 +34,34 @@
 #include 
 #include 
 
-#include "wm8505fb_regs.h"
 #include "wmt_ge_rops.h"
 
 #define DRIVER_NAME "wm8505-fb"
 
+#define WMT_GOVR_COLORSPACE1   0x030
+#define WMT_GOVR_MIF_ENABLE0x080
+#define WMT_GOVR_FBADDR0x090
+#define WMT_GOVR_FBADDR1   0x094
+#define WMT_GOVR_XRES  0x098
+#define WMT_GOVR_XRES_VIRTUAL  0x09c
+#define WMT_GOVR_YPAN  0x0a0
+#define WMT_GOVR_XPAN  0x0a4
+#define WMT_GOVR_FHI   0x0a8
+#define WMT_GOVR_REG_UPDATE0x0e4
+#define WMT_GOVR_TG0x100
+#define WMT_GOVR_TIMING_H_ALL  0x108
+#define WMT_GOVR_TIMING_V_ALL  0x10c
+#define WMT_GOVR_TIMING_V_START0x110
+#define WMT_GOVR_TIMING_V_END  0x114
+#define WMT_GOVR_TIMING_H_START0x118
+#define WMT_GOVR_TIMING_H_END  0x11c
+#define WMT_GOVR_TIMING_V_SYNC 0x128
+#define WMT_GOVR_TIMING_H_SYNC 0x12c
+#define WMT_GOVR_DVO_SET   0x148
+#define WMT_GOVR_CONTRAST  0x1b8
+#define WMT_GOVR_BRGHTNESS 0x1bc
+#define WMT_GOVR_COLORSPACE0x1e4
+
 #define to_wm8505fb_info(__info) container_of(__info, \
struct wm8505fb_info, fb)
 struct wm8505fb_info {
diff --git a/drivers/video/wm8505fb_regs.h b/drivers/video/wm8505fb_regs.h
deleted file mode 100644
index 4dd4166..000
--- a/drivers/video/wm8505fb_regs.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- *  GOVR registers list for WM8505 chips
- *
- *  Copyright (C) 2010 Ed Spiridonov 
- *   Based on VIA/WonderMedia wm8510-govrh-reg.h
- *   http://github.com/projectgus/kernel_wm8505/blob/wm8505_2.6.29/
- * drivers/video/wmt/register/wm8510/wm8510-govrh-reg.h
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * 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.
- */
-
-#ifndef _WM8505FB_REGS_H
-#define _WM8505FB_REGS_H
-
-/*
- * Color space select register, default value 0x1c
- *   BIT0 GOVRH_DVO_YUV2RGB_ENABLE
- *   BIT1 GOVRH_VGA_YUV2RGB_ENABLE
- *   BIT2 GOVRH_RGB_MODE
- *   BIT3 GOVRH_DAC_CLKINV
- *   BIT4 GOVRH_BLANK_ZERO
- */
-#define WMT_GOVR_COLORSPACE0x1e4
-/*
- * Another colorspace select register, default value 1
- *   BIT0 GOVRH_DVO_RGB
- *   BIT1 GOVRH_DVO_YUV422
- */
-#define WMT_GOVR_COLORSPACE10x30
-
-#define WMT_GOVR_CONTRAST  0x1b8
-#define WMT_GOVR_BRGHTNESS 0x1bc /* incompatible with RGB? */
-
-/* Framubeffer address */
-#define WMT_GOVR_FBADDR 0x90
-#define WMT_GOVR_FBADDR10x94 /* UV offset in YUV mode */
-
-/* Offset of visible window */
-#define WMT_GOVR_XPAN   0xa4
-#define WMT_GOVR_YPAN   0xa0
-
-#define WMT_GOVR_XRES   0x98
-#define WMT_GOVR_XRES_VIRTUAL   0x9c
-
-#define WMT_GOVR_MIF_ENABLE 0x80
-#define WMT_GOVR_FHI0xa8
-#define WMT_GOVR_REG_UPDATE 0xe4
-
-/*
- *   BIT0 GOVRH_DVO_OUTWIDTH
- *   BIT1 GOVRH_DVO_SYNC_POLAR
- *   BIT2 GOVRH_DVO_ENABLE
- */
-#define WMT_GOVR_DVO_SET   0x148
-
-/* Timing generator? */
-#define WMT_GOVR_TG0x100
-
-/* Timings */
-#define WMT_GOVR_TIMING_H_ALL  0x108
-#define WMT_GOVR_TIMING_V_ALL  0x10c
-#define WMT_GOVR_TIMING_V_START0x110
-#define WMT_GOVR_TIMING_V_END  0x114
-#define WMT_GOVR_TIMING_H_START0x118
-#define WMT_GOVR_TIMING_H_END  0x11c
-#define WMT_GOVR_TIMING_V_SYNC 0x128
-#define WMT_GOVR_TIMING_H_SYNC 0x12c
-
-#endif /* _WM8505FB_REGS_H */
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/4] fb: vt8500: Require a device clock for wm8505fb driver

2013-05-18 Thread Tony Prisk
The wm8505fb driver requires a clock to work properly. Without a clock,
the driver can only initialize the display resolution that was set in
uboot.
This patch updates the driver to get and use a clock, and updates
the devicetree documentation to indicate the requirement for a clock.

Signed-off-by: Tony Prisk 
---
 .../devicetree/bindings/video/wm,wm8505-fb.txt |4 ++-
 drivers/video/wm8505fb.c   |   30 +---
 2 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt 
b/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt
index 0bcadb2..601416c 100644
--- a/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt
+++ b/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt
@@ -5,6 +5,7 @@ Required properties:
 - compatible : "wm,wm8505-fb"
 - reg : Should contain 1 register ranges(address and length)
 - bits-per-pixel : bit depth of framebuffer (16 or 32)
+- clocks : phandle to DVO clock
 
 Required subnodes:
 - display-timings: see display-timing.txt for information
@@ -15,11 +16,12 @@ Example:
compatible = "wm,wm8505-fb";
reg = <0xd8051700 0x200>;
bits-per-pixel = <16>;
+   clocks = <>;
 
display-timings {
native-mode = <>;
timing0: 800x480 {
-   clock-frequency = <0>; /* unused but required */
+   clock-frequency = <3000>;
hactive = <800>;
vactive = <480>;
hfront-porch = <40>;
diff --git a/drivers/video/wm8505fb.c b/drivers/video/wm8505fb.c
index 167a9e2..f8bffc2 100644
--- a/drivers/video/wm8505fb.c
+++ b/drivers/video/wm8505fb.c
@@ -14,6 +14,7 @@
  * GNU General Public License for more details.
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -130,9 +131,11 @@
 #define to_wm8505fb_info(__info) container_of(__info, \
struct wm8505fb_info, fb)
 struct wm8505fb_info {
-   struct fb_info  fb;
-   void __iomem*regbase;
-   unsigned intcontrast;
+   struct fb_info fb;
+   void __iomem *regbase;
+   unsigned int contrast;
+   struct device *dev;
+   struct clk *clk_dvo;
 };
 
 
@@ -210,6 +213,13 @@ static int wm8505fb_set_par(struct fb_info *info)
if (!fbi)
return -EINVAL;
 
+   if (info->var.pixclock == 0) {
+   dev_err(fbi->dev, "requested pixclock = 0\n");
+   return -EINVAL;
+   }
+
+   clk_set_rate(fbi->clk_dvo, PICOS2KHZ(info->var.pixclock)*1000);
+
if (info->var.bits_per_pixel == 32) {
info->var.red.offset = 16;
info->var.red.length = 8;
@@ -369,6 +379,8 @@ static int wm8505fb_probe(struct platform_device *pdev)
return -ENOMEM;
}
 
+   fbi->dev = >dev;
+
strcpy(fbi->fb.fix.id, DRIVER_NAME);
 
fbi->fb.fix.type= FB_TYPE_PACKED_PIXELS;
@@ -408,6 +420,14 @@ static int wm8505fb_probe(struct platform_device *pdev)
if (ret)
return ret;
 
+   fbi->clk_dvo = of_clk_get(pdev->dev.of_node, 0);
+   if (IS_ERR(fbi->clk_dvo)) {
+   dev_err(>dev, "Error retrieving clock\n");
+   return PTR_ERR(fbi->clk_dvo);
+   }
+
+   clk_prepare_enable(fbi->clk_dvo);
+
fb_videomode_to_var(>fb.var, );
 
fbi->fb.var.nonstd  = 0;
@@ -421,7 +441,7 @@ static int wm8505fb_probe(struct platform_device *pdev)
fb_mem_virt = dmam_alloc_coherent(>dev, fb_mem_len, _mem_phys,
GFP_KERNEL);
if (!fb_mem_virt) {
-   pr_err("%s: Failed to allocate framebuffer\n", __func__);
+   dev_err(>dev, "Failed to allocate framebuffer\n");
return -ENOMEM;
}
 
@@ -480,6 +500,8 @@ static int wm8505fb_remove(struct platform_device *pdev)
 
unregister_framebuffer(>fb);
 
+   clk_disable_unprepare(fbi->clk_dvo);
+
writel(0, fbi->regbase);
 
if (fbi->fb.cmap.len)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/4] fb: vt8500: Convert to use vendor register names

2013-05-18 Thread Tony Prisk
Change all the #defines to match the vendor defined names, and change the
references in wm8505fb.c and wmt_ge_rops.c.
Add all the missing register offsets as well to prevent churn in the future.

Signed-off-by: Tony Prisk 
---
 drivers/video/wm8505fb.c|  159 
 drivers/video/wmt_ge_rops.c |  280 +--
 2 files changed, 332 insertions(+), 107 deletions(-)

diff --git a/drivers/video/wm8505fb.c b/drivers/video/wm8505fb.c
index f824af8..167a9e2 100644
--- a/drivers/video/wm8505fb.c
+++ b/drivers/video/wm8505fb.c
@@ -38,29 +38,94 @@
 
 #define DRIVER_NAME "wm8505-fb"
 
-#define WMT_GOVR_COLORSPACE1   0x030
-#define WMT_GOVR_MIF_ENABLE0x080
-#define WMT_GOVR_FBADDR0x090
-#define WMT_GOVR_FBADDR1   0x094
-#define WMT_GOVR_XRES  0x098
-#define WMT_GOVR_XRES_VIRTUAL  0x09c
-#define WMT_GOVR_YPAN  0x0a0
-#define WMT_GOVR_XPAN  0x0a4
-#define WMT_GOVR_FHI   0x0a8
-#define WMT_GOVR_REG_UPDATE0x0e4
-#define WMT_GOVR_TG0x100
-#define WMT_GOVR_TIMING_H_ALL  0x108
-#define WMT_GOVR_TIMING_V_ALL  0x10c
-#define WMT_GOVR_TIMING_V_START0x110
-#define WMT_GOVR_TIMING_V_END  0x114
-#define WMT_GOVR_TIMING_H_START0x118
-#define WMT_GOVR_TIMING_H_END  0x11c
-#define WMT_GOVR_TIMING_V_SYNC 0x128
-#define WMT_GOVR_TIMING_H_SYNC 0x12c
-#define WMT_GOVR_DVO_SET   0x148
-#define WMT_GOVR_CONTRAST  0x1b8
-#define WMT_GOVR_BRGHTNESS 0x1bc
-#define WMT_GOVR_COLORSPACE0x1e4
+#define REG_GOVRH_CUR_ADDR 0x
+#define REG_GOVRH_CUR_WIDTH0x0004
+#define REG_GOVRH_CUR_FB_WIDTH 0x0008
+#define REG_GOVRH_CUR_VCROP0x000C
+#define REG_GOVRH_CUR_HCROP0x0010
+#define REG_GOVRH_CUR_HCOORD   0x0014
+#define REG_GOVRH_CUR_VCOORD   0x0018
+#define REG_GOVRH_CUR_STATUS   0x001C
+#define REG_GOVRH_CUR_COLOR_KEY0x0020
+#define REG_GOVRH_DVO_PIX  0x0030
+#define REG_GOVRH_DVO_DLY_SEL  0x0034
+#define REG_GOVRH_INT  0x0038
+#define REG_GOVRH_DVO_BLANK_DATA   0x003C
+#define REG_GOVRH_DIRPATH  0x0040  /* WM8750+ */
+#define REG_GOVRH_MIF  0x0080
+#define REG_GOVRH_COLFMT   0x0084
+#define REG_GOVRH_SRCFMT   0x0088
+#define REG_GOVRH_DSTFMT   0x008C
+#define REG_GOVRH_YSA  0x0090
+#define REG_GOVRH_CSA  0x0094
+#define REG_GOVRH_PIXWID   0x0098
+#define REG_GOVRH_BUFWID   0x009C
+#define REG_GOVRH_VCROP0x00A0
+#define REG_GOVRH_HCROP0x00A4
+#define REG_GOVRH_FHI  0x00A8
+#define REG_GOVRH_COLFMT2  0x00AC
+#define REG_GOVRH_YSA2 0x00B0  /* WM8950 */
+#define REG_GOVRH_CSA2 0x00B4  /* WM8950 */
+#define REG_GOVRH_MIF_FRAME_MODE   0x00B8  /* WM8950 */
+#define REG_GOVRH_REG_STS  0x00E4
+#define REG_GOVRH_SWFLD0x00E8
+#define REG_GOVRH_TG_ENABLE0x0100
+#define REG_GOVRH_READ_CYC 0x0104
+#define REG_GOVRH_H_ALLPXL 0x0108
+#define REG_GOVRH_V_ALLLN  0x010C
+#define REG_GOVRH_ACTLN_BG 0x0110
+#define REG_GOVRH_ACTLN_END0x0114
+#define REG_GOVRH_ACTPX_BG 0x0118
+#define REG_GOVRH_ACTPX_END0x011C
+#define REG_GOVRH_VBIE_LINE0x0120
+#define REG_GOVRH_PVBI_LINE0x0124
+#define REG_GOVRH_HDMI_VBISW   0x0128
+#define REG_GOVRH_HDMI_HSYNW   0x012C
+#define REG_GOVRH_VSYNC_OFFSET 0x0130
+#define REG_GOVRH_FIELD_STATUS 0x0134
+#define REG_GOVRH_HDMI_3D  0x013C  /* WM8950 */
+#define REG_GOVRH_DVO_SET  0x0148
+#define REG_GOVRH_CB_ENABLE0x0150
+#define REG_GOVRH_H_ALLPXL20x0158
+#define REG_GOVRH_V_ALLLN2 0x015C
+#define REG_GOVRH_ACTLN_BG20x0160
+#define REG_GOVRH_ACTLN_END2   0x0164
+#define REG_GOVRH_ACTPX_BG20x0168
+#define REG_GOVRH_ACTPX_END2   0x016C
+#define REG_GOVRH_VBIE_LINE2   0x0170
+#define REG_GOVRH_PVBI_LINE2   0x0174
+#define REG_GOVRH_HDMI_VBISW2  0x0178
+#define REG_GOVRH_HDMI_HSYNW2  0x017C
+#define REG_GOVRH_LVDS_CTRL0x0180  /* WM8750+ */
+#define REG_GOVRH_LVDS_CTRL2   0x0184  /* WM8750+ */
+#define REG_GOVRH_DAC_LP_SENSE_VAL 0x0188  /* WM8750 */
+#define REG_GOVRH_DAC_TEST_MODE0x018C  /* WM8750 */
+#define REG_GOVRH_VGA_HSYNW0x0190  /* WM8750 */
+#define REG_GOVRH_VGA_VSYNW0x0194  /* WM8750 */
+#define REG_GOVRH_VGA_SYNPOLAR 0x0198  /* WM8750 */
+#define REG_GOVRH_DAC_MOD  0x019C  /* WM8750 */
+#define REG_GOVRH_DAC_VAL  0x01A0  /* WM8750 */
+#define REG_GOVRH_DAC_CON  0x01A4  /* WM8750 */
+#define 

[PATCH 4/4] fb: vt8500: Add VGA output support to wm8505fb driver.

2013-05-18 Thread Tony Prisk
The APC8750 does not support an LCD panel, but provides a VGA connector.
This patch adds support for the VGA interface, and defines an optional
devicetree property to specify the output interface. The default if not
specified is LCD for backward compatibility.

Signed-off-by: Tony Prisk 
---
 .../devicetree/bindings/video/wm,wm8505-fb.txt |5 
 drivers/video/wm8505fb.c   |   31 ++--
 2 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt 
b/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt
index 601416c..9f1d648 100644
--- a/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt
+++ b/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt
@@ -7,6 +7,10 @@ Required properties:
 - bits-per-pixel : bit depth of framebuffer (16 or 32)
 - clocks : phandle to DVO clock
 
+Optional properties:
+- output-interface : the interface the fb should output on. Valid values are
+   "lcd" or "vga". If not specified, the default is "lcd".
+
 Required subnodes:
 - display-timings: see display-timing.txt for information
 
@@ -17,6 +21,7 @@ Example:
reg = <0xd8051700 0x200>;
bits-per-pixel = <16>;
clocks = <>;
+   output-interface = "vga";
 
display-timings {
native-mode = <>;
diff --git a/drivers/video/wm8505fb.c b/drivers/video/wm8505fb.c
index f8bffc2..d1f7f33 100644
--- a/drivers/video/wm8505fb.c
+++ b/drivers/video/wm8505fb.c
@@ -130,12 +130,17 @@
 
 #define to_wm8505fb_info(__info) container_of(__info, \
struct wm8505fb_info, fb)
+
+#define INTERFACE_LCD  1
+#define INTERFACE_VGA  2
+
 struct wm8505fb_info {
struct fb_info fb;
void __iomem *regbase;
unsigned int contrast;
struct device *dev;
struct clk *clk_dvo;
+   int interface;
 };
 
 
@@ -158,7 +163,11 @@ static int wm8505fb_init_hw(struct fb_info *info)
 * 0x31C sets the correct color mode (RGB565) for WM8650
 * Bit 8+9 (0x300) are ignored on WM8505 as reserved
 */
-   writel(0x31c,  fbi->regbase + REG_GOVRH_YUVRGB);
+   if (fbi->interface == INTERFACE_VGA)
+   writel(0x338, fbi->regbase + REG_GOVRH_YUVRGB);
+   else
+   writel(0x31c, fbi->regbase + REG_GOVRH_YUVRGB);
+
writel(1,  fbi->regbase + REG_GOVRH_DVO_PIX);
 
/* Virtual buffer size */
@@ -167,7 +176,12 @@ static int wm8505fb_init_hw(struct fb_info *info)
 
/* black magic ;) */
writel(0xf,fbi->regbase + REG_GOVRH_FHI);
-   writel(4,  fbi->regbase + REG_GOVRH_DVO_SET);
+
+   if (fbi->interface == INTERFACE_VGA)
+   writel(0xe, fbi->regbase + REG_GOVRH_DVO_SET);
+   else
+   writel(4, fbi->regbase + REG_GOVRH_DVO_SET);
+
writel(1,  fbi->regbase + REG_GOVRH_MIF);
writel(1,  fbi->regbase + REG_GOVRH_REG_STS);
 
@@ -194,11 +208,15 @@ static int wm8505fb_set_timing(struct fb_info *info)
writel(h_end,   fbi->regbase + REG_GOVRH_ACTPX_END);
writel(h_all,   fbi->regbase + REG_GOVRH_H_ALLPXL);
writel(h_sync,  fbi->regbase + REG_GOVRH_HDMI_HSYNW);
+   if (fbi->interface == INTERFACE_VGA)
+   writel(h_sync,  fbi->regbase + REG_GOVRH_VGA_HSYNW);
 
writel(v_start, fbi->regbase + REG_GOVRH_ACTLN_BG);
writel(v_end,   fbi->regbase + REG_GOVRH_ACTLN_END);
writel(v_all,   fbi->regbase + REG_GOVRH_V_ALLLN);
writel(v_sync,  fbi->regbase + REG_GOVRH_HDMI_VBISW);
+   if (fbi->interface == INTERFACE_VGA)
+   writel(info->var.pixclock,  fbi->regbase + REG_GOVRH_VGA_VSYNW);
 
writel(1, fbi->regbase + REG_GOVRH_TG_ENABLE);
 
@@ -371,6 +389,7 @@ static int wm8505fb_probe(struct platform_device *pdev)
dma_addr_t fb_mem_phys;
unsigned long fb_mem_len;
void *fb_mem_virt;
+   const char *intf;
 
fbi = devm_kzalloc(>dev, sizeof(struct wm8505fb_info) +
sizeof(u32) * 16, GFP_KERNEL);
@@ -428,6 +447,14 @@ static int wm8505fb_probe(struct platform_device *pdev)
 
clk_prepare_enable(fbi->clk_dvo);
 
+   fbi->interface = INTERFACE_LCD;
+   ret = of_property_read_string(pdev->dev.of_node, "output-interface",
+   );
+   if (!ret) {
+   if (!strcmp(intf, "vga"))
+   fbi->interface = INTERFACE_VGA;
+   }
+
fb_videomode_to_var(>fb.var, );
 
fbi->fb.var.nonstd  = 0;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  

[PATCH 0/4] FB updates for 3.11

2013-05-18 Thread Tony Prisk
Patch #1 - Move register defines inside the driver and drop the header.
Patch #2 - Convert the register defines to use the vendor preferred names.
Patch #3 - Add a device clock to wm8505fb. Without it, only the uboot
initialized resolution is supported.
Patch #4 - Add support for the VGA output found on the APC8750 board.

Tony Prisk (4):
  fb: vt8500: Move register defines inside driver
  fb: vt8500: Convert to use vendor register names
  fb: vt8500: Require a device clock for wm8505fb driver
  fb: vt8500: Add VGA output support to wm8505fb driver.

 .../devicetree/bindings/video/wm,wm8505-fb.txt |9 +-
 drivers/video/wm8505fb.c   |  195 --
 drivers/video/wm8505fb_regs.h  |   76 --
 drivers/video/wmt_ge_rops.c|  280 +++-
 4 files changed, 394 insertions(+), 166 deletions(-)
 delete mode 100644 drivers/video/wm8505fb_regs.h

-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/3] CPUFreq Fixes for 3.10-rc2

2013-05-18 Thread Rafael J. Wysocki
On Saturday, May 18, 2013 07:45:45 AM Viresh Kumar wrote:
> On 18 May 2013 05:10, Rafael J. Wysocki  wrote:
> > Well, I actually meant "can you please verify your belief?". :-)
> >
> > And that's because I'm wondering why the zero-day build testing doesn't
> > catch this problem.  Apparently, it doesn't build .configs with cpufreq
> > governors configured as modules, although I believe it does test
> > "make allmodconfig" for a couple of architectures at least.  What gives?
> 
> My assumption was wrong. Actually cpufreq_governor.c is never compiled
> as module, but cpufreq_ondemand is...
> 
> And this routine isn't used from cpufreq_ondemand but cpufreq_governor..
> 
> But we were lucky that we didn't get a error here and EXPORT_SYMBOL
> is still required :)

Although not necessarily 3.10 material I suppose?

Rafael


-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 4/4] MAINTAINERS: vt8500: Add clk-vt8500.c to MAINTAINERS file

2013-05-18 Thread Tony Prisk

On 18/05/13 18:40, Alexey Charkov wrote:

On 18 May 2013 01:18, "Tony Prisk"  wrote:

This file has missed being added under ARM/VT8500 ARM ARCHITECTURE,
and is maintained along with the rest of the vt8500 arch code.

Signed-off-by: Tony Prisk 
---
  MAINTAINERS |1 +
  1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 3d7782b..5ab8ccb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1283,6 +1283,7 @@ M:Tony Prisk 
  L: linux-arm-ker...@lists.infradead.org (moderated for

non-subscribers)

  S: Maintained
  F: arch/arm/mach-vt8500/
+F: drivers/clk/vt8500-vt8500.c

This looks like a typo (clk vs. vt8500).

Best,
Alexey


eeek - oops.

Mike,

Disregard this patch - I will send a more complete one through arm-soc 
as there are other files missing as well.


Regards
Tony P
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Would like to form a pool of Linux copyright holders for faster GPL enforcement against Anthrax Kernels

2013-05-18 Thread Eric Appleman

On 5/18/2013 3:24 AM, Eric Appleman wrote:
Would anyone be interested in forming such a pool? I am willing to 
wait years for this to be resolved through certain organizations, but 
I believe we can do better.


Last I checked, I have 1 long-time poster of this list on board. Would 
anyone else like to join? Ideally I'd like to get the LKML (which I 
have CC'd) involved so that authors of critical Linux components be a 
part of this. I'm not sure if my defconfig commits to Android kernel 
branches count as contributions, so I'm not going to consider myself a 
Linux contributor unless told otherwise.


This pool would be used in the following manner:

* Formally requesting source for binaries (means to request source
* Formally requesting removal of critical copyrighted code that Linux 
cannot function without

* Informing interested parties with respect to refusals of the above

The CTO of Anthrax's hosting server is very interested in terminating 
Chad Goodman's account. Bullet point #3 might come into effect here.


If this is a bad idea, uses incorrect logic, or does not follow the 
conventions of GPL enforcement, feel free to shoot this idea down with 
utmost prejudice.


- Eric

Forgot to add background on Anthrax Kernels and their violations:
http://pastebin.com/X5Cciy03

- Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] fsfreeze: wait in killable state in __sb_start_write

2013-05-18 Thread Marco

Any comments about these patches?

Marco

Il 04/05/2013 08:49, Marco Stornelli ha scritto:

Added a new enum to decide if we want to sleep in uninterruptible or
killable state or we want simply to return immediately.

Signed-off-by: Marco Stornelli 
Reviewed-by: Jan Kara 
---
  fs/super.c |   24 ++--
  include/linux/fs.h |   19 +--
  2 files changed, 31 insertions(+), 12 deletions(-)

diff --git a/fs/super.c b/fs/super.c
index 7465d43..6b70c7f 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -1190,14 +1190,25 @@ static void acquire_freeze_lock(struct super_block *sb, 
int level, bool trylock,
   * This is an internal function, please use 
sb_start_{write,pagefault,intwrite}
   * instead.
   */
-int __sb_start_write(struct super_block *sb, int level, bool wait)
+int __sb_start_write(struct super_block *sb, int level, int wait)
  {
+   int ret = 0;
  retry:
if (unlikely(sb->s_writers.frozen >= level)) {
-   if (!wait)
-   return 0;
-   wait_event(sb->s_writers.wait_unfrozen,
-  sb->s_writers.frozen < level);
+   switch (wait) {
+   case FREEZE_NOWAIT:
+   return ret;
+   case FREEZE_WAIT:
+   wait_event(sb->s_writers.wait_unfrozen,
+  sb->s_writers.frozen < level);
+   break;
+   case FREEZE_WAIT_KILLABLE:
+   ret = wait_event_killable(sb->s_writers.wait_unfrozen,
+  sb->s_writers.frozen < level);
+   if (ret)
+   return -EINTR;
+   break;
+   }
}

  #ifdef CONFIG_LOCKDEP
@@ -1213,7 +1224,8 @@ retry:
__sb_end_write(sb, level);
goto retry;
}
-   return 1;
+   ret = 1;
+   return ret;
  }
  EXPORT_SYMBOL(__sb_start_write);

diff --git a/include/linux/fs.h b/include/linux/fs.h
index e8cd6b8..6d9bcef 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1220,6 +1220,13 @@ enum {

  #define SB_FREEZE_LEVELS (SB_FREEZE_COMPLETE - 1)

+/* Possible waiting modes */
+enum {
+   FREEZE_NOWAIT = 0,  /* no blocking call */
+   FREEZE_WAIT = 1,/* wait in uninterruptible state */
+   FREEZE_WAIT_KILLABLE = 2,   /* wait in killable state */
+};
+
  struct sb_writers {
/* Counters for counting writers at each level */
struct percpu_counter   counter[SB_FREEZE_LEVELS];
@@ -1335,7 +1342,7 @@ extern struct timespec current_fs_time(struct super_block 
*sb);
   */

  void __sb_end_write(struct super_block *sb, int level);
-int __sb_start_write(struct super_block *sb, int level, bool wait);
+int __sb_start_write(struct super_block *sb, int level, int wait);

  /**
   * sb_end_write - drop write access to a superblock
@@ -1394,12 +1401,12 @@ static inline void sb_end_intwrite(struct super_block 
*sb)
   */
  static inline void sb_start_write(struct super_block *sb)
  {
-   __sb_start_write(sb, SB_FREEZE_WRITE, true);
+   __sb_start_write(sb, SB_FREEZE_WRITE, FREEZE_WAIT);
  }

  static inline int sb_start_write_trylock(struct super_block *sb)
  {
-   return __sb_start_write(sb, SB_FREEZE_WRITE, false);
+   return __sb_start_write(sb, SB_FREEZE_WRITE, FREEZE_NOWAIT);
  }

  /**
@@ -1423,7 +1430,7 @@ static inline int sb_start_write_trylock(struct 
super_block *sb)
   */
  static inline void sb_start_pagefault(struct super_block *sb)
  {
-   __sb_start_write(sb, SB_FREEZE_PAGEFAULT, true);
+   __sb_start_write(sb, SB_FREEZE_PAGEFAULT, FREEZE_WAIT);
  }

  /*
@@ -1441,7 +1448,7 @@ static inline void sb_start_pagefault(struct super_block 
*sb)
   */
  static inline void sb_start_intwrite(struct super_block *sb)
  {
-   __sb_start_write(sb, SB_FREEZE_FS, true);
+   __sb_start_write(sb, SB_FREEZE_FS, FREEZE_WAIT);
  }


@@ -2224,7 +2231,7 @@ static inline void file_start_write(struct file *file)
  {
if (!S_ISREG(file_inode(file)->i_mode))
return;
-   __sb_start_write(file_inode(file)->i_sb, SB_FREEZE_WRITE, true);
+   __sb_start_write(file_inode(file)->i_sb, SB_FREEZE_WRITE, FREEZE_WAIT);
  }

  static inline void file_end_write(struct file *file)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Would like to form a pool of Linux copyright holders for faster GPL enforcement against Anthrax Kernels

2013-05-18 Thread Eric Appleman
Would anyone be interested in forming such a pool? I am willing to wait 
years for this to be resolved through certain organizations, but I 
believe we can do better.


Last I checked, I have 1 long-time poster of this list on board. Would 
anyone else like to join? Ideally I'd like to get the LKML (which I have 
CC'd) involved so that authors of critical Linux components be a part of 
this. I'm not sure if my defconfig commits to Android kernel branches 
count as contributions, so I'm not going to consider myself a Linux 
contributor unless told otherwise.


This pool would be used in the following manner:

* Formally requesting source for binaries (means to request source
* Formally requesting removal of critical copyrighted code that Linux 
cannot function without

* Informing interested parties with respect to refusals of the above

The CTO of Anthrax's hosting server is very interested in terminating 
Chad Goodman's account. Bullet point #3 might come into effect here.


If this is a bad idea, uses incorrect logic, or does not follow the 
conventions of GPL enforcement, feel free to shoot this idea down with 
utmost prejudice.


- Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: REGRESSION: 3.10-rc1: Dell Latitude e6410 hangs within 3 seconds

2013-05-18 Thread Arend van Spriel

On 05/18/13 03:47, Paul E. McKenney wrote:

On Fri, May 17, 2013 at 10:49:16PM +0200, Arend van Spriel wrote:

On 05/14/2013 10:38 PM, Arend van Spriel wrote:

On 05/14/2013 10:34 PM, Rafael J. Wysocki wrote:

On Tuesday, May 14, 2013 03:03:58 PM Arend van Spriel wrote:

Laptop hangs pretty soon after booting. Workaround for me was to turn
off ACPI on kernel command line, ie. acpi=off

Attached is my kernel configuration.


Well, I have no idea what may be the source of this.


Me neither.


Any chance to bisect?


can try. Rebuilding kernels can be a drag :-p

Regards,
Arend


Hi Rafael,

The bisect result found commit c0f4dfd4f as culprit. I also verified
that the merge into Linus' tree introduced the issue upstream, ie.
6c24499 works and 1f889ec does not. I tried to revert the commit,
but that was a bit risky (conflict to resolve) and did not give me a
stable kernel. The only thing that works is selecting acpi=off. I
tried also nohz=off but that resulted in /init failure.

Regards,
Arend

---8<

commit 1f889ec62c3f0d8913f3c32f9aff2a1e15099346
   Merge: 6c24499 8fcfae3

   commit 8fcfae31719c0a6c03f2cf63f815b46d378d8be4
 Merge: d02a9a8 6d87669

 commit 6d87669357936bffa1e8fea7a4e7743e76905736
   Merge: 3f944ad 81e5949 910ee45

   commit c0f4dfd4f90f1667d234d21f15153ea09a2eaa66
   Author: Paul E. McKenney
   Date:   Fri Dec 28 11:30:36 2012 -0800

   rcu: Make RCU_FAST_NO_HZ take advantage of numbered callbacks

   Because RCU callbacks are now associated with the number
   of the grace period that they must wait for, CPUs can now
   take advance callbacks corresponding to grace periods that
   ended while a given CPU was in dyntick-idle mode. This
   eliminates the need to try forcing the RCU state machine
   while entering idle, thus reducing the CPU intensiveness
   of RCU_FAST_NO_HZ, which should increase its energy
   efficiency.

   Signed-off-by: Paul E. McKenney
   Signed-off-by: Paul E. McKenney


Hello, Arend,

Thank you for tracking this down!  Could you please try out the following
patch?


Thanks, Paul

That did the trick. Made me bumping into another regression in the 
driver I am maintaining so more fun to do :-)


Looking at the commit message I guess it is already in some tree. 
Otherwise I would have said: "You may add


Tested-by: Arend van Spriel "




rcu: Fix comparison sense in rcu_needs_cpu()

Commit c0f4dfd4f (rcu: Make RCU_FAST_NO_HZ take advantage of numbered
callbacks) introduced a bug that can result in excessively long grace
periods.  This bug reverse the senes of the "if" statement checking


Oh, there is a typo in the commit message: sense iso senes.


for lazy callbacks, so that RCU takes a lazy approach when there are
in fact non-lazy callbacks.  This can result in excessive boot, suspend,
and resume times.

This commit therefore fixes the sense of this "if" statement.

Reported-by: Borislav Petkov
Reported-by: Bjørn Mork
Reported-by: Joerg Roedel
Signed-off-by: Paul E. McKenney
Tested-by: Bjørn Mork
Tested-by: Joerg Roedel


Gr. AvS

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] md: Partially revert 2f6db2a7, which broke raid5

2013-05-18 Thread Jens Axboe
On Fri, May 17 2013, Calvin Owens wrote:
> Commit 2f6db2a7 was part of a series that cleaned up mdraid code by
> replacing explicit re-initialization of struct bio with bio_reset().
> 
> In raid5 it incorrectly assumed that a couple initializations of its
> members was a full reset, erasing the existing data and unconditionally
> triggering the following BUG when assembling arrays:
> 
> [   14.653072] kernel BUG at 
> /home/calvinow/git/linux/drivers/scsi/scsi_lib.c:1196!
> [   14.653074] invalid opcode:  [#1] PREEMPT SMP
> [   14.653076] CPU: 1 PID: 40 Comm: kworker/1:0H Not tainted 
> 3.10.0-rc1-amd-00279-g8f710dd #3
> [   14.653077] Hardware name: System manufacturer System Product 
> Name/M5A88-M, BIOS 060109/20/2011
> [   14.653082] Workqueue: kblockd blk_delay_work
> 
> [   14.653123] Call Trace:
> [   14.653126]  [] sd_prep_fn+0x2c8/0xb70
> [   14.653129]  [] ? 
> deadline_remove_request.isra.9+0x50/0x90
> [   14.653132]  [] blk_peek_request+0xdb/0x210
> [   14.653134]  [] scsi_request_fn+0x45/0x4e0
> [   14.653136]  [] __blk_run_queue+0x31/0x40
> [   14.653138]  [] blk_delay_work+0x24/0x40
> [   14.653141]  [] process_one_work+0x1da/0x490
> [   14.653143]  [] ? process_one_work+0x17d/0x490
> [   14.653145]  [] worker_thread+0x11a/0x370
> [   14.653147]  [] ? rescuer_thread+0x2f0/0x2f0
> [   14.653149]  [] kthread+0xd6/0xe0
> [   14.653151]  [] ? __kthread_unpark+0x50/0x50
> [   14.653154]  [] ret_from_fork+0x7c/0xb0
> [   14.653156]  [] ? __kthread_unpark+0x50/0x50
> [   14.653172] Code: 
> [   14.653174] RIP  [] scsi_setup_fs_cmnd+0x89/0x90
> 
> Signed-off-by: Calvin Owens 

Kent, there was a report on this issue yesterday as well. We need to get
this fixed up ASAP.

-- 
Jens Axboe

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


hpfs: deadlock and race in hpfs_dir_lseek()

2013-05-18 Thread Al Viro
For one thing, there's an ABBA deadlock on hpfs fs-wide lock and i_mutex
in hpfs_dir_lseek() - there's a lot of methods that grab the former with
the caller already holding the latter, so it must take i_mutex first.

For another, locking the damn thing, carefully validating the offset,
then dropping locks and assigning the offset is obviously racy.

Moreover, we _must_ do hpfs_add_pos(), or the machinery in dnode.c
won't modify the sucker on B-tree surgeries.

Signed-off-by: Al Viro 
--
diff --git a/fs/hpfs/dir.c b/fs/hpfs/dir.c
index 546f6d3..834ac13 100644
--- a/fs/hpfs/dir.c
+++ b/fs/hpfs/dir.c
@@ -33,25 +33,27 @@ static loff_t hpfs_dir_lseek(struct file *filp, loff_t off, 
int whence)
if (whence == SEEK_DATA || whence == SEEK_HOLE)
return -EINVAL;
 
+   mutex_lock(>i_mutex);
hpfs_lock(s);
 
/*printk("dir lseek\n");*/
if (new_off == 0 || new_off == 1 || new_off == 11 || new_off == 12 || 
new_off == 13) goto ok;
-   mutex_lock(>i_mutex);
pos = ((loff_t) hpfs_de_as_down_as_possible(s, hpfs_inode->i_dno) << 4) 
+ 1;
while (pos != new_off) {
if (map_pos_dirent(i, , )) hpfs_brelse4();
else goto fail;
if (pos == 12) goto fail;
}
-   mutex_unlock(>i_mutex);
+   hpfs_add_pos(i, >f_pos);
 ok:
+   filp->f_pos = new_off;
hpfs_unlock(s);
-   return filp->f_pos = new_off;
-fail:
mutex_unlock(>i_mutex);
+   return new_off;
+fail:
/*printk("illegal lseek: %016llx\n", new_off);*/
hpfs_unlock(s);
+   mutex_unlock(>i_mutex);
return -ESPIPE;
 }
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCHv3 4/6] clocksource: Add TI-Nspire timer drivers

2013-05-18 Thread Daniel Tang

On 17/05/2013, at 11:17 PM, Linus Walleij  wrote:

>>> If this timer is really just 16 bits, it's a *pretty* good idea to use
>>> the prescaler (I guess this is what IO_DIVIDER is) beacuse else you
>>> will get short sleep times with CONFIG_NO_HZ_IDLE on this system,
>>> and wake up unnecessarily often.
>>> 
>>> The same goes for the clock event.
>> 
>> The clock frequency is 32768Hz. Should I be scaling it down at that 
>> frequency?
> 
> No. But that was *pretty* slow.
> 
> The thing is that the driver is getting "some clockfrequency" from
> the clk subsystem and does not know what it is.
> 
> Usually (and I've seen this hardware design pattern a lot) when you
> have a clock like this, and go talk to the clk implementation specialist
> s/he will say "oh, yeah, I can mux in this 34 MHz clock to the timer
> as well", and if that is possible then that is often what you want,
> because it's good for things like HRtimers, and then it's useful to have
> a prescaler och the clocksource/clockevent.
> 
> You can use that 32768 Hz for clock events and clocksource (but I
> suspect that HRtimers will never be useful on this platform due to this).
> 

I forgot to mention before that there is also another timer that runs at the 
same freq as the APB (which is usually around 30MHz). Is this what you were 
alluding to? I haven't tested the driver on that timer yet.

As I understand it, you're saying to use a prescaler on faster clock rates so 
the kernel can have a longer maximum delay time (since a 16 bit register can 
only hold only so much). In that case, what kind of range should I be scaling 
to? I suspect it needs to be large enough to keep the kernel from constantly 
waking but small enough for HR timers to be useful.

> Yours,
> Linus Walleij

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCHv3 4/6] clocksource: Add TI-Nspire timer drivers

2013-05-18 Thread Daniel Tang

On 17/05/2013, at 11:17 PM, Linus Walleij linus.wall...@linaro.org wrote:

 If this timer is really just 16 bits, it's a *pretty* good idea to use
 the prescaler (I guess this is what IO_DIVIDER is) beacuse else you
 will get short sleep times with CONFIG_NO_HZ_IDLE on this system,
 and wake up unnecessarily often.
 
 The same goes for the clock event.
 
 The clock frequency is 32768Hz. Should I be scaling it down at that 
 frequency?
 
 No. But that was *pretty* slow.
 
 The thing is that the driver is getting some clockfrequency from
 the clk subsystem and does not know what it is.
 
 Usually (and I've seen this hardware design pattern a lot) when you
 have a clock like this, and go talk to the clk implementation specialist
 s/he will say oh, yeah, I can mux in this 34 MHz clock to the timer
 as well, and if that is possible then that is often what you want,
 because it's good for things like HRtimers, and then it's useful to have
 a prescaler och the clocksource/clockevent.
 
 You can use that 32768 Hz for clock events and clocksource (but I
 suspect that HRtimers will never be useful on this platform due to this).
 

I forgot to mention before that there is also another timer that runs at the 
same freq as the APB (which is usually around 30MHz). Is this what you were 
alluding to? I haven't tested the driver on that timer yet.

As I understand it, you're saying to use a prescaler on faster clock rates so 
the kernel can have a longer maximum delay time (since a 16 bit register can 
only hold only so much). In that case, what kind of range should I be scaling 
to? I suspect it needs to be large enough to keep the kernel from constantly 
waking but small enough for HR timers to be useful.

 Yours,
 Linus Walleij

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


hpfs: deadlock and race in hpfs_dir_lseek()

2013-05-18 Thread Al Viro
For one thing, there's an ABBA deadlock on hpfs fs-wide lock and i_mutex
in hpfs_dir_lseek() - there's a lot of methods that grab the former with
the caller already holding the latter, so it must take i_mutex first.

For another, locking the damn thing, carefully validating the offset,
then dropping locks and assigning the offset is obviously racy.

Moreover, we _must_ do hpfs_add_pos(), or the machinery in dnode.c
won't modify the sucker on B-tree surgeries.

Signed-off-by: Al Viro v...@zeniv.linux.org.uk
--
diff --git a/fs/hpfs/dir.c b/fs/hpfs/dir.c
index 546f6d3..834ac13 100644
--- a/fs/hpfs/dir.c
+++ b/fs/hpfs/dir.c
@@ -33,25 +33,27 @@ static loff_t hpfs_dir_lseek(struct file *filp, loff_t off, 
int whence)
if (whence == SEEK_DATA || whence == SEEK_HOLE)
return -EINVAL;
 
+   mutex_lock(i-i_mutex);
hpfs_lock(s);
 
/*printk(dir lseek\n);*/
if (new_off == 0 || new_off == 1 || new_off == 11 || new_off == 12 || 
new_off == 13) goto ok;
-   mutex_lock(i-i_mutex);
pos = ((loff_t) hpfs_de_as_down_as_possible(s, hpfs_inode-i_dno)  4) 
+ 1;
while (pos != new_off) {
if (map_pos_dirent(i, pos, qbh)) hpfs_brelse4(qbh);
else goto fail;
if (pos == 12) goto fail;
}
-   mutex_unlock(i-i_mutex);
+   hpfs_add_pos(i, filp-f_pos);
 ok:
+   filp-f_pos = new_off;
hpfs_unlock(s);
-   return filp-f_pos = new_off;
-fail:
mutex_unlock(i-i_mutex);
+   return new_off;
+fail:
/*printk(illegal lseek: %016llx\n, new_off);*/
hpfs_unlock(s);
+   mutex_unlock(i-i_mutex);
return -ESPIPE;
 }
 
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] md: Partially revert 2f6db2a7, which broke raid5

2013-05-18 Thread Jens Axboe
On Fri, May 17 2013, Calvin Owens wrote:
 Commit 2f6db2a7 was part of a series that cleaned up mdraid code by
 replacing explicit re-initialization of struct bio with bio_reset().
 
 In raid5 it incorrectly assumed that a couple initializations of its
 members was a full reset, erasing the existing data and unconditionally
 triggering the following BUG when assembling arrays:
 
 [   14.653072] kernel BUG at 
 /home/calvinow/git/linux/drivers/scsi/scsi_lib.c:1196!
 [   14.653074] invalid opcode:  [#1] PREEMPT SMP
 [   14.653076] CPU: 1 PID: 40 Comm: kworker/1:0H Not tainted 
 3.10.0-rc1-amd-00279-g8f710dd #3
 [   14.653077] Hardware name: System manufacturer System Product 
 Name/M5A88-M, BIOS 060109/20/2011
 [   14.653082] Workqueue: kblockd blk_delay_work
 snip
 [   14.653123] Call Trace:
 [   14.653126]  [81477248] sd_prep_fn+0x2c8/0xb70
 [   14.653129]  [812c8b70] ? 
 deadline_remove_request.isra.9+0x50/0x90
 [   14.653132]  [812b8f5b] blk_peek_request+0xdb/0x210
 [   14.653134]  [81465f15] scsi_request_fn+0x45/0x4e0
 [   14.653136]  [812b6a51] __blk_run_queue+0x31/0x40
 [   14.653138]  [812b6a84] blk_delay_work+0x24/0x40
 [   14.653141]  [8105dc2a] process_one_work+0x1da/0x490
 [   14.653143]  [8105dbcd] ? process_one_work+0x17d/0x490
 [   14.653145]  [8105e32a] worker_thread+0x11a/0x370
 [   14.653147]  [8105e210] ? rescuer_thread+0x2f0/0x2f0
 [   14.653149]  [81066296] kthread+0xd6/0xe0
 [   14.653151]  [810661c0] ? __kthread_unpark+0x50/0x50
 [   14.653154]  [816e4d6c] ret_from_fork+0x7c/0xb0
 [   14.653156]  [810661c0] ? __kthread_unpark+0x50/0x50
 [   14.653172] Code: snip
 [   14.653174] RIP  [81467329] scsi_setup_fs_cmnd+0x89/0x90
 
 Signed-off-by: Calvin Owens jcalvinow...@gmail.com

Kent, there was a report on this issue yesterday as well. We need to get
this fixed up ASAP.

-- 
Jens Axboe

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: REGRESSION: 3.10-rc1: Dell Latitude e6410 hangs within 3 seconds

2013-05-18 Thread Arend van Spriel

On 05/18/13 03:47, Paul E. McKenney wrote:

On Fri, May 17, 2013 at 10:49:16PM +0200, Arend van Spriel wrote:

On 05/14/2013 10:38 PM, Arend van Spriel wrote:

On 05/14/2013 10:34 PM, Rafael J. Wysocki wrote:

On Tuesday, May 14, 2013 03:03:58 PM Arend van Spriel wrote:

Laptop hangs pretty soon after booting. Workaround for me was to turn
off ACPI on kernel command line, ie. acpi=off

Attached is my kernel configuration.


Well, I have no idea what may be the source of this.


Me neither.


Any chance to bisect?


can try. Rebuilding kernels can be a drag :-p

Regards,
Arend


Hi Rafael,

The bisect result found commit c0f4dfd4f as culprit. I also verified
that the merge into Linus' tree introduced the issue upstream, ie.
6c24499 works and 1f889ec does not. I tried to revert the commit,
but that was a bit risky (conflict to resolve) and did not give me a
stable kernel. The only thing that works is selecting acpi=off. I
tried also nohz=off but that resulted in /init failure.

Regards,
Arend

---8

commit 1f889ec62c3f0d8913f3c32f9aff2a1e15099346
   Merge: 6c24499 8fcfae3

   commit 8fcfae31719c0a6c03f2cf63f815b46d378d8be4
 Merge: d02a9a8 6d87669

 commit 6d87669357936bffa1e8fea7a4e7743e76905736
   Merge: 3f944ad 81e5949 910ee45

   commit c0f4dfd4f90f1667d234d21f15153ea09a2eaa66
   Author: Paul E. McKenneypaul.mcken...@linaro.org
   Date:   Fri Dec 28 11:30:36 2012 -0800

   rcu: Make RCU_FAST_NO_HZ take advantage of numbered callbacks

   Because RCU callbacks are now associated with the number
   of the grace period that they must wait for, CPUs can now
   take advance callbacks corresponding to grace periods that
   ended while a given CPU was in dyntick-idle mode. This
   eliminates the need to try forcing the RCU state machine
   while entering idle, thus reducing the CPU intensiveness
   of RCU_FAST_NO_HZ, which should increase its energy
   efficiency.

   Signed-off-by: Paul E. McKenneypaul.mcken...@linaro.org
   Signed-off-by: Paul E. McKenneypaul...@linux.vnet.ibm.com


Hello, Arend,

Thank you for tracking this down!  Could you please try out the following
patch?


Thanks, Paul

That did the trick. Made me bumping into another regression in the 
driver I am maintaining so more fun to do :-)


Looking at the commit message I guess it is already in some tree. 
Otherwise I would have said: You may add


Tested-by: Arend van Spriel ar...@broadcom.com




rcu: Fix comparison sense in rcu_needs_cpu()

Commit c0f4dfd4f (rcu: Make RCU_FAST_NO_HZ take advantage of numbered
callbacks) introduced a bug that can result in excessively long grace
periods.  This bug reverse the senes of the if statement checking


Oh, there is a typo in the commit message: sense iso senes.


for lazy callbacks, so that RCU takes a lazy approach when there are
in fact non-lazy callbacks.  This can result in excessive boot, suspend,
and resume times.

This commit therefore fixes the sense of this if statement.

Reported-by: Borislav Petkovb...@alien8.de
Reported-by: Bjørn Morkbj...@mork.no
Reported-by: Joerg Roedelj...@8bytes.org
Signed-off-by: Paul E. McKenneypaul...@linux.vnet.ibm.com
Tested-by: Bjørn Morkbj...@mork.no
Tested-by: Joerg Roedelj...@8bytes.org


Gr. AvS

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Would like to form a pool of Linux copyright holders for faster GPL enforcement against Anthrax Kernels

2013-05-18 Thread Eric Appleman
Would anyone be interested in forming such a pool? I am willing to wait 
years for this to be resolved through certain organizations, but I 
believe we can do better.


Last I checked, I have 1 long-time poster of this list on board. Would 
anyone else like to join? Ideally I'd like to get the LKML (which I have 
CC'd) involved so that authors of critical Linux components be a part of 
this. I'm not sure if my defconfig commits to Android kernel branches 
count as contributions, so I'm not going to consider myself a Linux 
contributor unless told otherwise.


This pool would be used in the following manner:

* Formally requesting source for binaries (means to request source
* Formally requesting removal of critical copyrighted code that Linux 
cannot function without

* Informing interested parties with respect to refusals of the above

The CTO of Anthrax's hosting server is very interested in terminating 
Chad Goodman's account. Bullet point #3 might come into effect here.


If this is a bad idea, uses incorrect logic, or does not follow the 
conventions of GPL enforcement, feel free to shoot this idea down with 
utmost prejudice.


- Eric
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/4] fsfreeze: wait in killable state in __sb_start_write

2013-05-18 Thread Marco

Any comments about these patches?

Marco

Il 04/05/2013 08:49, Marco Stornelli ha scritto:

Added a new enum to decide if we want to sleep in uninterruptible or
killable state or we want simply to return immediately.

Signed-off-by: Marco Stornelli marco.storne...@gmail.com
Reviewed-by: Jan Kara j...@suse.cz
---
  fs/super.c |   24 ++--
  include/linux/fs.h |   19 +--
  2 files changed, 31 insertions(+), 12 deletions(-)

diff --git a/fs/super.c b/fs/super.c
index 7465d43..6b70c7f 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -1190,14 +1190,25 @@ static void acquire_freeze_lock(struct super_block *sb, 
int level, bool trylock,
   * This is an internal function, please use 
sb_start_{write,pagefault,intwrite}
   * instead.
   */
-int __sb_start_write(struct super_block *sb, int level, bool wait)
+int __sb_start_write(struct super_block *sb, int level, int wait)
  {
+   int ret = 0;
  retry:
if (unlikely(sb-s_writers.frozen = level)) {
-   if (!wait)
-   return 0;
-   wait_event(sb-s_writers.wait_unfrozen,
-  sb-s_writers.frozen  level);
+   switch (wait) {
+   case FREEZE_NOWAIT:
+   return ret;
+   case FREEZE_WAIT:
+   wait_event(sb-s_writers.wait_unfrozen,
+  sb-s_writers.frozen  level);
+   break;
+   case FREEZE_WAIT_KILLABLE:
+   ret = wait_event_killable(sb-s_writers.wait_unfrozen,
+  sb-s_writers.frozen  level);
+   if (ret)
+   return -EINTR;
+   break;
+   }
}

  #ifdef CONFIG_LOCKDEP
@@ -1213,7 +1224,8 @@ retry:
__sb_end_write(sb, level);
goto retry;
}
-   return 1;
+   ret = 1;
+   return ret;
  }
  EXPORT_SYMBOL(__sb_start_write);

diff --git a/include/linux/fs.h b/include/linux/fs.h
index e8cd6b8..6d9bcef 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1220,6 +1220,13 @@ enum {

  #define SB_FREEZE_LEVELS (SB_FREEZE_COMPLETE - 1)

+/* Possible waiting modes */
+enum {
+   FREEZE_NOWAIT = 0,  /* no blocking call */
+   FREEZE_WAIT = 1,/* wait in uninterruptible state */
+   FREEZE_WAIT_KILLABLE = 2,   /* wait in killable state */
+};
+
  struct sb_writers {
/* Counters for counting writers at each level */
struct percpu_counter   counter[SB_FREEZE_LEVELS];
@@ -1335,7 +1342,7 @@ extern struct timespec current_fs_time(struct super_block 
*sb);
   */

  void __sb_end_write(struct super_block *sb, int level);
-int __sb_start_write(struct super_block *sb, int level, bool wait);
+int __sb_start_write(struct super_block *sb, int level, int wait);

  /**
   * sb_end_write - drop write access to a superblock
@@ -1394,12 +1401,12 @@ static inline void sb_end_intwrite(struct super_block 
*sb)
   */
  static inline void sb_start_write(struct super_block *sb)
  {
-   __sb_start_write(sb, SB_FREEZE_WRITE, true);
+   __sb_start_write(sb, SB_FREEZE_WRITE, FREEZE_WAIT);
  }

  static inline int sb_start_write_trylock(struct super_block *sb)
  {
-   return __sb_start_write(sb, SB_FREEZE_WRITE, false);
+   return __sb_start_write(sb, SB_FREEZE_WRITE, FREEZE_NOWAIT);
  }

  /**
@@ -1423,7 +1430,7 @@ static inline int sb_start_write_trylock(struct 
super_block *sb)
   */
  static inline void sb_start_pagefault(struct super_block *sb)
  {
-   __sb_start_write(sb, SB_FREEZE_PAGEFAULT, true);
+   __sb_start_write(sb, SB_FREEZE_PAGEFAULT, FREEZE_WAIT);
  }

  /*
@@ -1441,7 +1448,7 @@ static inline void sb_start_pagefault(struct super_block 
*sb)
   */
  static inline void sb_start_intwrite(struct super_block *sb)
  {
-   __sb_start_write(sb, SB_FREEZE_FS, true);
+   __sb_start_write(sb, SB_FREEZE_FS, FREEZE_WAIT);
  }


@@ -2224,7 +2231,7 @@ static inline void file_start_write(struct file *file)
  {
if (!S_ISREG(file_inode(file)-i_mode))
return;
-   __sb_start_write(file_inode(file)-i_sb, SB_FREEZE_WRITE, true);
+   __sb_start_write(file_inode(file)-i_sb, SB_FREEZE_WRITE, FREEZE_WAIT);
  }

  static inline void file_end_write(struct file *file)


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Would like to form a pool of Linux copyright holders for faster GPL enforcement against Anthrax Kernels

2013-05-18 Thread Eric Appleman

On 5/18/2013 3:24 AM, Eric Appleman wrote:
Would anyone be interested in forming such a pool? I am willing to 
wait years for this to be resolved through certain organizations, but 
I believe we can do better.


Last I checked, I have 1 long-time poster of this list on board. Would 
anyone else like to join? Ideally I'd like to get the LKML (which I 
have CC'd) involved so that authors of critical Linux components be a 
part of this. I'm not sure if my defconfig commits to Android kernel 
branches count as contributions, so I'm not going to consider myself a 
Linux contributor unless told otherwise.


This pool would be used in the following manner:

* Formally requesting source for binaries (means to request source
* Formally requesting removal of critical copyrighted code that Linux 
cannot function without

* Informing interested parties with respect to refusals of the above

The CTO of Anthrax's hosting server is very interested in terminating 
Chad Goodman's account. Bullet point #3 might come into effect here.


If this is a bad idea, uses incorrect logic, or does not follow the 
conventions of GPL enforcement, feel free to shoot this idea down with 
utmost prejudice.


- Eric

Forgot to add background on Anthrax Kernels and their violations:
http://pastebin.com/X5Cciy03

- Eric
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 4/4] MAINTAINERS: vt8500: Add clk-vt8500.c to MAINTAINERS file

2013-05-18 Thread Tony Prisk

On 18/05/13 18:40, Alexey Charkov wrote:

On 18 May 2013 01:18, Tony Prisk li...@prisktech.co.nz wrote:

This file has missed being added under ARM/VT8500 ARM ARCHITECTURE,
and is maintained along with the rest of the vt8500 arch code.

Signed-off-by: Tony Prisk li...@prisktech.co.nz
---
  MAINTAINERS |1 +
  1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 3d7782b..5ab8ccb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1283,6 +1283,7 @@ M:Tony Prisk li...@prisktech.co.nz
  L: linux-arm-ker...@lists.infradead.org (moderated for

non-subscribers)

  S: Maintained
  F: arch/arm/mach-vt8500/
+F: drivers/clk/vt8500-vt8500.c

This looks like a typo (clk vs. vt8500).

Best,
Alexey


eeek - oops.

Mike,

Disregard this patch - I will send a more complete one through arm-soc 
as there are other files missing as well.


Regards
Tony P
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/3] CPUFreq Fixes for 3.10-rc2

2013-05-18 Thread Rafael J. Wysocki
On Saturday, May 18, 2013 07:45:45 AM Viresh Kumar wrote:
 On 18 May 2013 05:10, Rafael J. Wysocki r...@sisk.pl wrote:
  Well, I actually meant can you please verify your belief?. :-)
 
  And that's because I'm wondering why the zero-day build testing doesn't
  catch this problem.  Apparently, it doesn't build .configs with cpufreq
  governors configured as modules, although I believe it does test
  make allmodconfig for a couple of architectures at least.  What gives?
 
 My assumption was wrong. Actually cpufreq_governor.c is never compiled
 as module, but cpufreq_ondemand is...
 
 And this routine isn't used from cpufreq_ondemand but cpufreq_governor..
 
 But we were lucky that we didn't get a error here and EXPORT_SYMBOL
 is still required :)

Although not necessarily 3.10 material I suppose?

Rafael


-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


  1   2   >