Re: [PATCH 1/2] staging: dgnc: use schedule_timeout_interruptible()

2015-05-30 Thread Nicholas Mc Guire
On Sun, 31 May 2015, Greg Kroah-Hartman wrote:

> On Fri, May 29, 2015 at 06:41:27PM +0200, Nicholas Mc Guire wrote:
> > API consolidation with coccinelle found:
> > ./drivers/staging/dgnc/dgnc_utils.c:16:1-17:
> > consolidation with schedule_timeout_*() recommended
> > 
> > This is a 1:1 conversion with respect to schedule_timeout() to the
> > schedule_timeout_interruptible() helper only - so only an API
> > consolidation to improve readability. The timeout was being passed
> > as (ms * HZ) / 1000 but that is not reliable as it allows the timeout
> > to become 0 for small values of ms. As this cut-off is HZ dependent
> > this is most likely not intended, so the timeout is converted with 
> > msecs_to_jiffies which handles all corener-cases correctly.
> > 
> > Patch was compile tested with x86_64_defconfig + CONFIG_STAGING=y,
> > CONFIG_DGNC=m
> > 
> > Patch is against 4.1-rc5 (localversion-next is -next-20150529)
> 
> Can you resend this without these two sentances?  They are not needed
> and are just "implied" as you should have done this for every patch
> submitted.

The config does allow for some level of variantion (e.g. what hardware
it was compile tested for) and also if it was a module or built-in.

I originally put this below the "---" until I was explicitly ast to put 
it above http://lkml.org/lkml/2015/5/11/552

will fix it up and resend.

thx!
hofrat 
--
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/1] x86 TSC: set X86_FEATURE_TSC_RELIABLE, per CPUID

2015-05-30 Thread Len Brown
From: Len Brown 

Speed cpu_up() by believing CPUID's "invariant TSC" flag,
and skipping the TSC warp test on single socket systems.

On my desktop, cpu_up() duration drops from 4.4ms to 2.4ms.
That savings is per-CPU, and occurs during boot, online
and resume from S3.

Originally, this was done for all sized systems, in Feb-2009
by 83ce40092868 (x86: set X86_FEATURE_TSC_RELIABLE).

But in Dec-2009, it was disabled for all sized systems by
6c56ccecf05f (x86: Reenable TSC sync check at boot, even with NONSTOP_TSC)
due to discovery of a TSC time warp on a multi-node system.

Here we re-enable this optimization for single-socket systems.

Multi-node systems will still run the sanity test.

"tsc=reliable" is still available to tell them to not bother.

Perhaps in the future we can up the node count to 2, or perhaps 4,
using dmi_check_multi[] to workaround bugs, per the original design.

Signed-off-by: Len Brown 
---
 arch/x86/kernel/cpu/intel.c | 21 +++--
 arch/x86/kernel/tsc.c   |  2 +-
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index 50163fa..aa00390 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -79,17 +79,26 @@ static void early_init_intel(struct cpuinfo_x86 *c)
c->x86_phys_bits = 36;
 
/*
-* c->x86_power is 8000_0007 edx. Bit 8 is TSC runs at constant rate
-* with P/T states and does not stop in deep C-states.
-*
-* It is also reliable across cores and sockets. (but not across
-* cabinets - we turn it off in that case explicitly.)
+* c->x86_power is CPUID(0x8007).EDX
+* Bit 8 describes the "invariant TSC" feature, where the TSC
+* continues running at a constant rate across P/T/C states.
+* Linux X86_FEATURE_CONSTANT_TSC describes the constant rate.
+* Linux X86_FEATURE_NONSTOP_TSC describes not stopping in C-states.
+* Linux X86_FEATURE_TSC_RELIABLE means that Linux should skip
+* TSC sanity checks because we know the TSC is sufficient for
+* clocksource.  This was invented for VMM use, but can also
+* be used to skip sanity check cost on bare metal.
+* We set it here, but the TSC code currently tests anyway
+* on multi-node systems, out of paranoia.
+* dmi_check_multi[] can also be used to clear this flag.
 */
if (c->x86_power & (1 << 8)) {
set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC);
-   if (!check_tsc_unstable())
+   if (!check_tsc_unstable()) {
set_sched_clock_stable();
+   set_cpu_cap(c, X86_FEATURE_TSC_RELIABLE);
+   }
}
 
/* Penwell and Cloverview have the TSC which doesn't sleep on S3 */
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 5054497..f1a25e5 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -1014,7 +1014,7 @@ static void __init check_system_tsc_reliable(void)
if (res_low & RTSC_SUSP)
tsc_clocksource_reliable = 1;
 #endif
-   if (boot_cpu_has(X86_FEATURE_TSC_RELIABLE))
+   if (boot_cpu_has(X86_FEATURE_TSC_RELIABLE) && (nr_node_ids == 1))
tsc_clocksource_reliable = 1;
 }
 
-- 
2.4.1.314.g9532ead

--
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 v2] Staging: lustre: Replace kzalloc followed by memcpy with kmemdup

2015-05-30 Thread Dighe, Niranjan (N.)
From: Niranjan Dighe 

Replace kzalloc followed by memcpy by kmemdup. This patch was generated
by 'make coccicheck'

Signed-off-by: Niranjan Dighe 
---
drivers/staging/lustre/lustre/obdclass/obd_config.c | 9 +++--
1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/obd_config.c 
b/drivers/staging/lustre/lustre/obdclass/obd_config.c
index 0bda9c5..274cae3 100644
--- a/drivers/staging/lustre/lustre/obdclass/obd_config.c
+++ b/drivers/staging/lustre/lustre/obdclass/obd_config.c
@@ -866,29 +866,26 @@ int class_add_profile(int proflen, char *prof, int 
osclen, char *osc,
INIT_LIST_HEAD(>lp_list);
 
LASSERT(proflen == (strlen(prof) + 1));
-   lprof->lp_profile = kzalloc(proflen, GFP_NOFS);
+   lprof->lp_profile = kmemdup(prof, proflen, GFP_NOFS);
if (lprof->lp_profile == NULL) {
err = -ENOMEM;
goto free_lprof;
}
-   memcpy(lprof->lp_profile, prof, proflen);
 
LASSERT(osclen == (strlen(osc) + 1));
-   lprof->lp_dt = kzalloc(osclen, GFP_NOFS);
+   lprof->lp_dt = kmemdup(osc, osclen, GFP_NOFS);
if (lprof->lp_dt == NULL) {
err = -ENOMEM;
goto free_lp_profile;
}
-   memcpy(lprof->lp_dt, osc, osclen);
 
if (mdclen > 0) {
LASSERT(mdclen == (strlen(mdc) + 1));
-   lprof->lp_md = kzalloc(mdclen, GFP_NOFS);
+   lprof->lp_md = kmemdup(mdc, mdclen, GFP_NOFS);
if (lprof->lp_md == NULL) {
err = -ENOMEM;
goto free_lp_dt;
}
-   memcpy(lprof->lp_md, mdc, mdclen);
}
 
list_add(>lp_list, _profile_list);
-- 
1.9.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/


Re: [PATCH] Staging: lustre: Replace kzalloc followed by memcpy with kmemdup

2015-05-30 Thread Dighe, Niranjan (N.)
Thanks Greg, I will send out a v2 of the patch with additional
"From: " in the email body as you suggested in the mail chain
with Madhu. 

Regards,
Niranjan --
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 2/4] target: Drop lun_sep_lock for se_lun->lun_se_dev RCU usage

2015-05-30 Thread Nicholas A. Bellinger
On Thu, 2015-05-28 at 08:57 -0700, Paul E. McKenney wrote:
> On Wed, May 27, 2015 at 11:02:10PM -0700, Nicholas A. Bellinger wrote:
> > On Wed, 2015-05-27 at 14:04 -0700, Paul E. McKenney wrote:
> > > On Tue, May 26, 2015 at 10:29:45PM -0700, Nicholas A. Bellinger wrote:



> > > > In this particular case, the se_device behind se_lun->lun_se_dev
> > > > __rcu protected pointer can't be released without first releasing the
> > > > pre-existing se_lun->lun_group reference to se_device->dev_group.
> > > > 
> > > > And since se_lun->lun_group is the source of a configfs symlink to
> > > > se_lun_acl->se_lun_group here, the se_lun associated RCU pointer and
> > > > underlying se_device can't be released out from under the above
> > > > target_fabric_mappedlun_link() code accessing a __rcu protected pointer.
> > > > 
> > > > Paul, is lockless_dereference the correct notation for this type of
> > > > use-case..?
> > > 
> > > My guess is "no", but I don't claim to understand your use case.
> > > 
> > > The splat is against some other code than the patch, judging by the
> > > patch line numbers.
> > > 
> > > The rule is that if a pointer points to something that is freed (or
> > > reused) after a grace period, you mark that pointer with __rcu.
> > > Any access to that pointer must then be accessed in an RCU read-side
> > > critical section, using one of the RCU list iterators or one of the
> > > rcu_dereference() macros.  No lockless_dereference() in this case.
> > > 
> > > You use lockless_dereference() when something other than RCU controls
> > > when the pointer target is freed.
> > 
> > For this case, there is a pointer with __rcu notation being
> > dereferenced, but given the way configfs parent/child config_group
> > reference counting works, it's impossible for this __rcu pointer to be
> > modified, and impossible for RCU updater path (-> kfree_rcu) of the
> > structure being dereferenced to run, while this particular code is
> > executed.
> > 
> > So I was thinking this should be using something like
> > rcu_dereference_protected(), but from the comment it sounds like this is
> > intended only for RCU updater path code.
> 
> If something is preventing the pointer from changing, then it is OK
> to use rcu_dereference_protected().  If the pointer might change, then
> you are right, you absolutely cannot use rcu_dereference_protected(),
> as it does not protect against concurrent updates.
> 
> If reasonably possible, you should pass a reference-held expression to
> rcu_dereference_protected().
> 
> > Is there some other notation to use for this type of case where the RCU
> > updater path can't run due to external reference counting, or should
> > this not be using __rcu notation at all..?
> 
> You should be OK with rcu_dereference_protected().  However, for
> rcu_dereference_protected() to work properly, it must be the case
> that the pointer it is reading doesn't change.
> 
> So you do have to be a bit careful.  For example, if structure A has
> a reference held so that it cannot be removed at the moment, but if it
> points to some structure B that -can- be removed, then you cannot use
> rcu_dereference_protected() to access the pointer from A to B because
> that pointer could change.
> 
> For another example, assume that structures C and D both have references
> held (and thus cannot be removed), and that structure C points to
> structure D.  But if a structure E could be inserted between C and D,
> we -cannot- use rcu_dereference_protected() because the pointer from
> C to D could change at any time, despite both C and D being nailed down.
> 
> In other words, the distinction is whether or not a given pointer can
> change, not whether or not the enclosing structure is guaranteed to live.
> 
> Make sense?
> 

Most certainly.  Thanks for the explanation here, it's very helpful.

Ok, so converting the bogus lockless_dereference() usage to:

 - rcu_dereference_check() when called from a read-critical path to 
   include the necessary smp_read_barrier_depends() + ACCESS_ONCE(), 
   when RCU updater side can potentially execute.
 - rcu_dereference_protected() when called from an updater path with
   a lock held.
 - rcu_dereference_protected() when called from a reader path that can
   only run while the updater side cannot execute due to external 
   reference counting.
 - rcu_dereference_raw() for other special cases where a reference
   can't be verified, with an appropriate comment.

Thank you,

--nab

--
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 V2 3/3] Drivers: hv: vmbus: Allocate ring buffer memory in NUMA aware fashion

2015-05-30 Thread K. Y. Srinivasan
Allocate ring buffer memory from the NUMA node assigned to the channel.

Signed-off-by: K. Y. Srinivasan 
---
 drivers/hv/channel.c |   14 --
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index 7a1c2db..603ce97 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -73,6 +73,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 
send_ringbuffer_size,
unsigned long flags;
int ret, err = 0;
unsigned long t;
+   struct page *page;
 
spin_lock_irqsave(>lock, flags);
if (newchannel->state == CHANNEL_OPEN_STATE) {
@@ -87,8 +88,17 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 
send_ringbuffer_size,
newchannel->channel_callback_context = context;
 
/* Allocate the ring buffer */
-   out = (void *)__get_free_pages(GFP_KERNEL|__GFP_ZERO,
-   get_order(send_ringbuffer_size + recv_ringbuffer_size));
+   page = alloc_pages_node(cpu_to_node(newchannel->target_cpu),
+   GFP_KERNEL|__GFP_ZERO,
+   get_order(send_ringbuffer_size +
+   recv_ringbuffer_size));
+
+   if (!page)
+   out = (void *)__get_free_pages(GFP_KERNEL|__GFP_ZERO,
+  get_order(send_ringbuffer_size +
+  recv_ringbuffer_size));
+   else
+   out = (void *)page_address(page);
 
if (!out) {
err = -ENOMEM;
-- 
1.7.4.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 V2 2/3] Drivers: hv: vmbus: Implement NUMA aware CPU affinity for channels

2015-05-30 Thread K. Y. Srinivasan
Channels/sub-channels can be affinitized to VCPUs in the guest. Implement
this affinity in a way that is NUMA aware. The current protocol distributed
the primary channels uniformly across all available CPUs. The new protocol
is NUMA aware: primary channels are distributed across the available NUMA
nodes while the sub-channels within a primary channel are distributed amongst
CPUs within the NUMA node assigned to the primary channel.

Signed-off-by: K. Y. Srinivasan 
---
 drivers/hv/channel_mgmt.c |   72 +++--
 include/linux/hyperv.h|5 +++
 2 files changed, 48 insertions(+), 29 deletions(-)

diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index c3eba37..4506a66 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -370,25 +370,27 @@ static const struct hv_vmbus_device_id hp_devs[] = {
 /*
  * We use this state to statically distribute the channel interrupt load.
  */
-static u32  next_vp;
+static int next_numa_node_id;
 
 /*
  * Starting with Win8, we can statically distribute the incoming
- * channel interrupt load by binding a channel to VCPU. We
- * implement here a simple round robin scheme for distributing
- * the interrupt load.
- * We will bind channels that are not performance critical to cpu 0 and
- * performance critical channels (IDE, SCSI and Network) will be uniformly
- * distributed across all available CPUs.
+ * channel interrupt load by binding a channel to VCPU.
+ * We do this in a hierarchical fashion:
+ * First distribute the primary channels across available NUMA nodes
+ * and then distribute the subchannels amongst the CPUs in the NUMA
+ * node assigned to the primary channel.
+ *
+ * For pre-win8 hosts or non-performance critical channels we assign the
+ * first CPU in the first NUMA node.
  */
 static void init_vp_index(struct vmbus_channel *channel, const uuid_le 
*type_guid)
 {
u32 cur_cpu;
int i;
bool perf_chn = false;
-   u32 max_cpus = num_online_cpus();
-   struct vmbus_channel *primary = channel->primary_channel, *prev;
-   unsigned long flags;
+   struct vmbus_channel *primary = channel->primary_channel;
+   int next_node;
+   struct cpumask available_mask;
 
for (i = IDE; i < MAX_PERF_CHN; i++) {
if (!memcmp(type_guid->b, hp_devs[i].guid,
@@ -405,36 +407,48 @@ static void init_vp_index(struct vmbus_channel *channel, 
const uuid_le *type_gui
 * Also if the channel is not a performance critical
 * channel, bind it to cpu 0.
 */
+   channel->numa_node = 0;
+   cpumask_set_cpu(0, >alloced_cpus_in_node);
channel->target_cpu = 0;
channel->target_vp = hv_context.vp_index[0];
return;
}
 
/*
-* Primary channels are distributed evenly across all vcpus we have.
-* When the host asks us to create subchannels it usually makes us
-* num_cpus-1 offers and we are supposed to distribute the work evenly
-* among the channel itself and all its subchannels. Make sure they are
-* all assigned to different vcpus.
+* We distribute primary channels evenly across all the available
+* NUMA nodes and within the assigned NUMA node we will assign the
+* first available CPU to the primary channel.
+* The sub-channels will be assigned to the CPUs available in the
+* NUMA node evenly.
 */
-   if (!primary)
-   cur_cpu = (++next_vp % max_cpus);
-   else {
+   if (!primary) {
+   while (true) {
+   next_node = next_numa_node_id++;
+   if (next_node == nr_node_ids)
+   next_node = next_numa_node_id = 0;
+   if (cpumask_empty(cpumask_of_node(next_node)))
+   continue;
+   break;
+   }
+   channel->numa_node = next_node;
+   primary = channel;
+   }
+
+   if (cpumask_weight(>alloced_cpus_in_node) ==
+   cpumask_weight(cpumask_of_node(primary->numa_node))) {
/*
-* Let's assign the first subchannel of a channel to the
-* primary->target_cpu+1 and all the subsequent channels to
-* the prev->target_cpu+1.
+* We have cycled through all the CPUs in the node;
+* reset the alloced map.
 */
-   spin_lock_irqsave(>lock, flags);
-   if (primary->num_sc == 1)
-   cur_cpu = (primary->target_cpu + 1) % max_cpus;
-   else {
-   prev = list_prev_entry(channel, sc_list);
-   cur_cpu = (prev->target_cpu + 1) % max_cpus;
-   }
-   spin_unlock_irqrestore(>lock, flags);
+   

[PATCH V2 1/3] Drivers: hv: vmbus: Use the vp_index map even for channels bound to CPU 0

2015-05-30 Thread K. Y. Srinivasan
Map target_cpu to target_vcpu using the mapping table.
We should use the mapping table to transform guest CPU ID to VP Index
as is done for the non-performance critical channels.
While the value CPU 0 is special and will
map to VP index 0, it is good to be consistent.



Signed-off-by: K. Y. Srinivasan 
---
V2: Added clarification to the commit log (Dan Carpenter)

 drivers/hv/channel_mgmt.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index 1f1417d..c3eba37 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -406,7 +406,7 @@ static void init_vp_index(struct vmbus_channel *channel, 
const uuid_le *type_gui
 * channel, bind it to cpu 0.
 */
channel->target_cpu = 0;
-   channel->target_vp = 0;
+   channel->target_vp = hv_context.vp_index[0];
return;
}
 
-- 
1.7.4.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 V2 0/3] Drivers: hv: vmbus: Make VMBUS driver NUMA aware

2015-05-30 Thread K. Y. Srinivasan
Implement CPU affinity for channels based on NUMA topology. Also, allocate all
channel specific memory from the appropriate NUMA node.

In this version of the series, I have added additional information to the
commit log for some of the patches.

K. Y. Srinivasan (3):
  Drivers: hv: vmbus: Use the vp_index map even for channels bound to
CPU 0
  Drivers: hv: vmbus: Implement NUMA aware CPU affinity for channels
  Drivers: hv: vmbus: Allocate ring buffer memory in NUMA aware fashion

 drivers/hv/channel.c  |   14 +++-
 drivers/hv/channel_mgmt.c |   74 ++--
 include/linux/hyperv.h|5 +++
 3 files changed, 61 insertions(+), 32 deletions(-)

-- 
1.7.4.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/


[RFC PATCH v2] suspend/resume performance improvement

2015-05-30 Thread EunTaik Lee
When a task that calls state_store() to suspend
the device has used up most of its time slice,
suspend sometimes take too long. (User noticeable)

Suspend/resume is a system wide operation.
So, instead of depending on a userspace task's time
slice, let kworker do the work to avoid a long wait
on the runqueue.

Signed-off-by: Eun Taik Lee 
---
 kernel/power/main.c | 95 ++---
 1 file changed, 90 insertions(+), 5 deletions(-)

diff --git a/kernel/power/main.c b/kernel/power/main.c
index 86e8157..848bf2d 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -15,7 +15,7 @@
 #include 
 #include 
 #include 
-
+#include 
 #include "power.h"
 
 DEFINE_MUTEX(pm_mutex);
@@ -335,15 +335,46 @@ static suspend_state_t decode_state(const char *buf, 
size_t n)
return PM_SUSPEND_ON;
 }
 
+static struct workqueue_struct *suspend_helper_wq;
+struct state_store_params {
+   const char *buf;
+   size_t n;
+};
+
+struct suspend_helper_data {
+   struct work_struct work;
+   struct completion done;
+   struct state_store_params params;
+   int result;
+};
+struct suspend_helper_data suspend_helper_data;
+
+static ssize_t state_store_helper(struct kobject *kobj,
+   struct kobj_attribute *attr,
+   const char *buf, size_t n);
+
 static ssize_t state_store(struct kobject *kobj, struct kobj_attribute *attr,
   const char *buf, size_t n)
 {
+   return state_store_helper(kobj, attr, buf, n);
+}
+
+power_attr(state);
+
+static void suspend_helper(struct work_struct *work)
+{
+   struct suspend_helper_data *data = (struct suspend_helper_data *)
+   container_of(work, struct suspend_helper_data, work);
+   const char *buf = data->params.buf;
+   size_t n = data->params.n;
suspend_state_t state;
-   int error;
+   int error = 0;
+
+   pr_debug("%s: start!\n", __func__);
 
error = pm_autosleep_lock();
if (error)
-   return error;
+   goto out_nolock;
 
if (pm_autosleep_state() > PM_SUSPEND_ON) {
error = -EBUSY;
@@ -358,12 +389,64 @@ static ssize_t state_store(struct kobject *kobj, struct 
kobj_attribute *attr,
else
error = -EINVAL;
 
- out:
+out:
pm_autosleep_unlock();
+
+out_nolock:
+   /* set result and notify completion */
+   data->result = error;
+   complete(>done);
+
+   pr_debug("%s: result = %d\n", __func__, error);
+}
+
+static ssize_t state_store_helper(struct kobject *kobj,
+   struct kobj_attribute *attr,
+   const char *buf, size_t n)
+{
+   int error;
+   int freezable = 0;
+
+   /* we don't need to freeze. so tell the freezer */
+   if (!freezer_should_skip(current)) {
+   freezable = 1;
+   freezer_do_not_count();
+   pr_debug("%s: freezer should skip me (%s:%d)\n",
+   __func__, current->comm, current->pid);
+   }
+
+   suspend_helper_data.params.buf = buf;
+   suspend_helper_data.params.n = n;
+   init_completion(_helper_data.done);
+
+   /* use kworker for suspend resume */
+   queue_work(suspend_helper_wq, _helper_data.work);
+
+   /* wait for suspend/resume work to be complete */
+   wait_for_completion(_helper_data.done);
+
+   if (freezable) {
+   /* set ourself as freezable */
+   freezer_count();
+   }
+
+   error = suspend_helper_data.result;
+   pr_debug("%s: suspend_helper returned %d\n", __func__, error);
+
return error ? error : n;
 }
 
-power_attr(state);
+static int suspend_helper_init(void)
+{
+   suspend_helper_wq = alloc_ordered_workqueue("suspend_helper", 0);
+   if (!suspend_helper_wq)
+   return -ENOMEM;
+
+   INIT_WORK(_helper_data.work, suspend_helper);
+   init_completion(_helper_data.done);
+
+   return 0;
+}
 
 #ifdef CONFIG_PM_SLEEP
 /*
@@ -640,6 +723,8 @@ static int __init pm_init(void)
if (error)
return error;
pm_print_times_init();
+   suspend_helper_init();
+
return pm_autosleep_init();
 }
 
-- 
1.9.1

N�r��yb�X��ǧv�^�)޺{.n�+{zX����ܨ}���Ơz�:+v���zZ+��+zf���h���~i���z��w���?�&�)ߢf��^jǫy�m��@A�a���
0��h���i

[GIT PULL rcu/next] RCU commits for 4.2

2015-05-30 Thread Paul E. McKenney
Hello, Ingo,

The changes in this series include the following:

1.  Remove all uses of RCU-protected array indexes.  These were posted
to LKML at https://lkml.org/lkml/2015/5/12/827.

2.  Documentation updates.  These were posted to LKML at
https://lkml.org/lkml/2015/5/12/848.

3.  Miscellaneous fixes.  These were posted to LKML at
https://lkml.org/lkml/2015/5/12/876.

4.  CPU-hotplug updates.  These were posted to LKML at
https://lkml.org/lkml/2015/5/12/880.

5.  Initialization/Kconfig updates.  These were posted to LKML at
https://lkml.org/lkml/2015/5/12/918, however, the updates to
Tree RCU's initialization have been deferred to 4.3.

6.  Updates to Tiny RCU.  These were posted to LKML at
https://lkml.org/lkml/2015/5/12/957.

7.  Torture-testing updates.  These were posted to LKML at
https://lkml.org/lkml/2015/5/12/964.

All of these changes have been subjected to -next testing, and are
available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git for-mingo

for you to fetch changes up to 0868aa22167d93dd974c253d259c3e6fd47a16c8:

  Merge branches 'array.2015.05.27a', 'doc.2015.05.27a', 'fixes.2015.05.27a', 
'hotplug.2015.05.27a', 'init.2015.05.27a', 'tiny.2015.05.27a' and 
'torture.2015.05.27a' into HEAD (2015-05-27 13:00:49 -0700)



Alexey Kodanev (1):
  locktorture: fix deadlock in 'rw_lock_irq' type

Joe Perches (1):
  rcu: tree_plugin: Use bool function return values of true/false not 1/0

Milos Vyletel (1):
  documentation: State that rcu_dereference() reloads pointer

Nicholas Mc Guire (1):
  rcu: Change function declaration to bool

Nicolas Iooss (1):
  rcu: Make rcu_*_data variables static

Patrick Daly (1):
  rcu: Fix missing task information during rcu-preempt stall

Paul E. McKenney (51):
  rcu: Convert ACCESS_ONCE() to READ_ONCE() and WRITE_ONCE()
  mce: Stop using array-index-based RCU primitives
  rcu: Eliminate array-index-based RCU primitives
  documentation: RCU-protected array indexes no longer supported
  mce: mce_chrdev_write() can be static
  documentation: Update rcu_dereference.txt based on WG21 discussions
  rcu: Convert from rcu_preempt_state to *rcu_state_p
  rcu: Eliminate a few RCU_BOOST #ifdefs in favor of IS_ENABLED()
  rcu: Tell the compiler that rcu_state_p is immutable
  rcu: Create an immutable rcu_data_p pointer to default rcu_data structure
  rcu: Eliminate a few CONFIG_RCU_NOCB_CPU_ALL #ifdefs
  rcu: Force wakeup of rcu_gp_kthread at grace-period end
  powerpc: Fix smp_mb__before_spinlock()
  rcu: Add more debug info on "kthread starved" RCU CPU stall warnings
  smp: Make control dependencies work on Alpha, improve documentation
  rcu: Make synchronize_sched_expedited() call wait_rcu_gp()
  rcu: Eliminate HOTPLUG_CPU #ifdef in favor of IS_ENABLED()
  rcu: Adjust ->lock acquisition for tasks no longer migrating
  rcu: Remove dead code from force_qs_rnp()
  rcu: Remove redundant offline check
  rcu: Correctly initialize ->rcu_qs_ctr_snap at online time
  cpu: Handle smpboot_unpark_threads() uniformly
  rcu: Modulate grace-period slow init to normalize delay
  rcu: Shut up spurious gcc uninitialized-variable warning
  rcu: Provide diagnostic option to slow down grace-period scans
  rcu: Directly drive TASKS_RCU from Kconfig
  rcu: Directly drive RCU_USER_QS from Kconfig
  rcu: Convert CONFIG_RCU_FANOUT_EXACT to boot parameter
  rcu: Enable diagnostic dump of rcu_node combining tree
  rcu: Create RCU_EXPERT Kconfig and hide booleans behind it
  rcu: Break dependency of RCU_FANOUT_LEAF on RCU_FANOUT
  rcu: Make RCU able to tolerate undefined CONFIG_RCU_FANOUT
  rcu: Make RCU able to tolerate undefined CONFIG_RCU_FANOUT_LEAF
  rcu: Make RCU able to tolerate undefined CONFIG_RCU_KTHREAD_PRIO
  rcu: Conditionally compile RCU's eqs warnings
  rcu: Further shrink Tiny RCU by making empty functions static inlines
  rcutorture: Test both RCU-sched and RCU-bh for Tiny RCU
  rcu: Correctly handle non-empty Tiny RCU callback list with none ready
  rcutorture: Exchange TREE03 and TREE04 geometries
  rcutorture: Exchange TREE03 and TREE08 NR_CPUS, speed up CPU hotplug
  rcutorture: Allow negative values of nreaders to oversubscribe
  locktorture: Change longdelay_us to longdelay_ms
  rcutorture: Replace barriers with smp_store_release() and 
smp_load_acquire()
  rcutorture: Test SRCU cleanup code path
  rcutorture: TASKS_RCU set directly, so don't explicitly set it
  rcutorture: Update configuration fragments for rcutree.rcu_fanout_exact
  rcutorture: Make rcutorture scripts force RCU_EXPERT
  rcutorture: Update TREE_RCU-kconfig.txt
  rcutorture: Display "make 

[GIT PULL] target fixes for v4.1-rc6

2015-05-30 Thread Nicholas A. Bellinger
Hi Linus,

Here are the outstanding target-pending fixes for v4.1-rc6 code.

Please go ahead and pull from:

  git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git master

These are mostly minor fixes, with the exception of the following that
address fall-out from recent v4.1-rc1 changes:

  - Regression fix related to the big fabric API registration changes 
and configfs_depend_item() usage, that required cherry-picking one 
of HCH's patches from for-next to address the issue for v4.1 code.
  - Remaining TCM-USER -v2 related changes to enforce full CDB 
passthrough from Andy + Ilias.

Also included is a target_core_pscsi driver fix from Andy that addresses
a long standing issue with a Scsi_Host reference being leaked on PSCSI
device shutdown.

Thank you,

--nab

Andy Grover (6):
  target/user: Disallow full passthrough (pass_level=0)
  target/pscsi: Don't leak scsi_host if hba is VIRTUAL_HOST
  target/user: Update example code for new ABI requirements
  target/user: Only support full command pass-through
  target: Move passthrough CDB parsing into a common function
  target: Use a PASSTHROUGH flag instead of transport_types

Bart Van Assche (2):
  target: Fix bidi command handling
  target: Add missing parentheses

Christoph Hellwig (1):
  target: Fix se_tpg_tfo->tf_subsys regression + remove tf_subsystem

Evgenii Lepikhin (1):
  ISCSI: fix minor memory leak

Nicholas Bellinger (1):
  target: Drop signal_pending checks after interruptible lock acquire

Roland Dreier (1):
  iser-target: Fix error path in isert_create_pi_ctx()

 Documentation/target/tcmu-design.txt  |  33 ++-
 drivers/infiniband/ulp/isert/ib_isert.c   |   6 +-
 drivers/scsi/qla2xxx/tcm_qla2xxx.c|   6 +-
 drivers/target/iscsi/iscsi_target.c   |   2 +-
 drivers/target/iscsi/iscsi_target_login.c |   1 +
 drivers/target/iscsi/iscsi_target_tpg.c   |   5 +-
 drivers/target/target_core_alua.c |   4 +-
 drivers/target/target_core_configfs.c |  40 -
 drivers/target/target_core_device.c   |  78 +++-
 drivers/target/target_core_file.c |   1 -
 drivers/target/target_core_iblock.c   |   1 -
 drivers/target/target_core_internal.h |   3 -
 drivers/target/target_core_pr.c   |  34 ++-
 drivers/target/target_core_pscsi.c|  58 ++--
 drivers/target/target_core_pscsi.h|   1 +
 drivers/target/target_core_rd.c   |   1 -
 drivers/target/target_core_sbc.c  |   2 +-
 drivers/target/target_core_transport.c|  13 ++-
 drivers/target/target_core_user.c | 143 +++---
 drivers/target/target_core_xcopy.c|  15 ++--
 drivers/vhost/scsi.c  |   6 +-
 include/target/target_core_backend.h  |   8 +-
 include/target/target_core_configfs.h |   2 -
 include/target/target_core_fabric.h   |   4 +-
 24 files changed, 180 insertions(+), 287 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/


[PATCH] regulator: da9063: Fix up irq leak

2015-05-30 Thread Axel Lin
Current code does not set regulators->irq_ldo_lim and regulators->irq_uvov,
so it actually calls free_irq(0, regulators) twice in remove() but does not
free the irq actually used.

Convert to use devm_request_threaded_irq instead and then we don't need to
take care the clean up irq so remove irq_ldo_lim and irq_uvov from
struct da9063_regulators. Note, regulators->irq_uvov is not used at all in
current code.

There is a slightly change in this patch, it will return error in probe()
if devm_request_threaded_irq fails. If the irq is optional, it should be
fine to allow platform_get_irq_byname fails. But current code does not
allow platform_get_irq_byname fails. So I think the reason to allow
request irq failure is just because the irq leak.

Signed-off-by: Axel Lin 
---
 drivers/regulator/da9063-regulator.c | 21 +++--
 1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/drivers/regulator/da9063-regulator.c 
b/drivers/regulator/da9063-regulator.c
index 31c2c59..aed1ad3 100644
--- a/drivers/regulator/da9063-regulator.c
+++ b/drivers/regulator/da9063-regulator.c
@@ -117,9 +117,6 @@ struct da9063_regulator {
 
 /* Encapsulates all information for the regulators driver */
 struct da9063_regulators {
-   int irq_ldo_lim;
-   int irq_uvov;
-
unsignedn_regulators;
/* Array size to be defined during init. Keep at end. */
struct da9063_regulator regulator[0];
@@ -867,35 +864,23 @@ static int da9063_regulator_probe(struct platform_device 
*pdev)
return irq;
}
 
-   ret = request_threaded_irq(irq,
+   ret = devm_request_threaded_irq(>dev, irq,
NULL, da9063_ldo_lim_event,
IRQF_TRIGGER_LOW | IRQF_ONESHOT,
"LDO_LIM", regulators);
if (ret) {
-   dev_err(>dev,
-   "Failed to request LDO_LIM IRQ.\n");
-   regulators->irq_ldo_lim = -ENXIO;
+   dev_err(>dev, "Failed to request LDO_LIM IRQ.\n");
+   return ret;
}
 
return 0;
 }
 
-static int da9063_regulator_remove(struct platform_device *pdev)
-{
-   struct da9063_regulators *regulators = platform_get_drvdata(pdev);
-
-   free_irq(regulators->irq_ldo_lim, regulators);
-   free_irq(regulators->irq_uvov, regulators);
-
-   return 0;
-}
-
 static struct platform_driver da9063_regulator_driver = {
.driver = {
.name = DA9063_DRVNAME_REGULATORS,
},
.probe = da9063_regulator_probe,
-   .remove = da9063_regulator_remove,
 };
 
 static int __init da9063_regulator_init(void)
-- 
2.1.0



--
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 07/24] x86/thinkpad_acpi: Use arch_nvram_ops methods instead of nvram_read_byte() and nvram_write_byte()

2015-05-30 Thread Henrique de Moraes Holschuh
On Sun, 31 May 2015, Finn Thain wrote:
> Make use of arch_nvram_ops in the thinkpad_acpi driver so that the
> nvram_* function exports can be removed.
> 
> This patch series was tested on a ThinkPad T43.

Can you describe how you did the testing?  A specific procedure is required
to test the hotkey NVRAM polling codepaths (which will read several NVRAM
bytes @10Hz by default) in a T43...

> Signed-off-by: Finn Thain 

The patch looks correct, so I don't expect any problems.

Provided that your test procedure did enable hotkey NVRAM polling in the T43
and your hotkeys all still worked fine, you have my Acked-by.

> ---
>  drivers/platform/x86/thinkpad_acpi.c |   20 ++--
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> Index: linux/drivers/platform/x86/thinkpad_acpi.c
> ===
> --- linux.orig/drivers/platform/x86/thinkpad_acpi.c   2015-05-31 
> 11:00:59.0 +1000
> +++ linux/drivers/platform/x86/thinkpad_acpi.c2015-05-31 
> 11:01:07.0 +1000
> @@ -2311,30 +2311,30 @@ static void hotkey_read_nvram(struct tp_
>   u8 d;
>  
>   if (m & TP_NVRAM_HKEY_GROUP_HK2) {
> - d = nvram_read_byte(TP_NVRAM_ADDR_HK2);
> + d = arch_nvram_ops.read_byte(TP_NVRAM_ADDR_HK2);
>   n->thinkpad_toggle = !!(d & TP_NVRAM_MASK_HKT_THINKPAD);
>   n->zoom_toggle = !!(d & TP_NVRAM_MASK_HKT_ZOOM);
>   n->display_toggle = !!(d & TP_NVRAM_MASK_HKT_DISPLAY);
>   n->hibernate_toggle = !!(d & TP_NVRAM_MASK_HKT_HIBERNATE);
>   }
>   if (m & TP_ACPI_HKEY_THNKLGHT_MASK) {
> - d = nvram_read_byte(TP_NVRAM_ADDR_THINKLIGHT);
> + d = arch_nvram_ops.read_byte(TP_NVRAM_ADDR_THINKLIGHT);
>   n->thinklight_toggle = !!(d & TP_NVRAM_MASK_THINKLIGHT);
>   }
>   if (m & TP_ACPI_HKEY_DISPXPAND_MASK) {
> - d = nvram_read_byte(TP_NVRAM_ADDR_VIDEO);
> + d = arch_nvram_ops.read_byte(TP_NVRAM_ADDR_VIDEO);
>   n->displayexp_toggle =
>   !!(d & TP_NVRAM_MASK_HKT_DISPEXPND);
>   }
>   if (m & TP_NVRAM_HKEY_GROUP_BRIGHTNESS) {
> - d = nvram_read_byte(TP_NVRAM_ADDR_BRIGHTNESS);
> + d = arch_nvram_ops.read_byte(TP_NVRAM_ADDR_BRIGHTNESS);
>   n->brightness_level = (d & TP_NVRAM_MASK_LEVEL_BRIGHTNESS)
>   >> TP_NVRAM_POS_LEVEL_BRIGHTNESS;
>   n->brightness_toggle =
>   !!(d & TP_NVRAM_MASK_HKT_BRIGHTNESS);
>   }
>   if (m & TP_NVRAM_HKEY_GROUP_VOLUME) {
> - d = nvram_read_byte(TP_NVRAM_ADDR_MIXER);
> + d = arch_nvram_ops.read_byte(TP_NVRAM_ADDR_MIXER);
>   n->volume_level = (d & TP_NVRAM_MASK_LEVEL_VOLUME)
>   >> TP_NVRAM_POS_LEVEL_VOLUME;
>   n->mute = !!(d & TP_NVRAM_MASK_MUTE);
> @@ -6153,7 +6153,7 @@ static unsigned int tpacpi_brightness_nv
>  {
>   u8 lnvram;
>  
> - lnvram = (nvram_read_byte(TP_NVRAM_ADDR_BRIGHTNESS)
> + lnvram = (arch_nvram_ops.read_byte(TP_NVRAM_ADDR_BRIGHTNESS)
> & TP_NVRAM_MASK_LEVEL_BRIGHTNESS)
> >> TP_NVRAM_POS_LEVEL_BRIGHTNESS;
>   lnvram &= bright_maxlvl;
> @@ -6178,7 +6178,7 @@ static void tpacpi_brightness_checkpoint
>   if (unlikely(!acpi_ec_read(TP_EC_BACKLIGHT, )))
>   goto unlock;
>   lec &= TP_EC_BACKLIGHT_LVLMSK;
> - b_nvram = nvram_read_byte(TP_NVRAM_ADDR_BRIGHTNESS);
> + b_nvram = arch_nvram_ops.read_byte(TP_NVRAM_ADDR_BRIGHTNESS);
>  
>   if (lec != ((b_nvram & TP_NVRAM_MASK_LEVEL_BRIGHTNESS)
>>> TP_NVRAM_POS_LEVEL_BRIGHTNESS)) {
> @@ -6186,7 +6186,7 @@ static void tpacpi_brightness_checkpoint
>   b_nvram &= ~(TP_NVRAM_MASK_LEVEL_BRIGHTNESS <<
>   TP_NVRAM_POS_LEVEL_BRIGHTNESS);
>   b_nvram |= lec;
> - nvram_write_byte(b_nvram, TP_NVRAM_ADDR_BRIGHTNESS);
> + arch_nvram_ops.write_byte(b_nvram, TP_NVRAM_ADDR_BRIGHTNESS);
>   dbg_printk(TPACPI_DBG_BRGHT,
>  "updated NVRAM backlight level to %u (0x%02x)\n",
>  (unsigned int) lec, (unsigned int) b_nvram);
> @@ -6794,13 +6794,13 @@ static void tpacpi_volume_checkpoint_nvr
>   if (unlikely(!acpi_ec_read(TP_EC_AUDIO, )))
>   goto unlock;
>   lec &= ec_mask;
> - b_nvram = nvram_read_byte(TP_NVRAM_ADDR_MIXER);
> + b_nvram = arch_nvram_ops.read_byte(TP_NVRAM_ADDR_MIXER);
>  
>   if (lec != (b_nvram & ec_mask)) {
>   /* NVRAM needs update */
>   b_nvram &= ~ec_mask;
>   b_nvram |= lec;
> - nvram_write_byte(b_nvram, TP_NVRAM_ADDR_MIXER);
> + arch_nvram_ops.write_byte(b_nvram, TP_NVRAM_ADDR_MIXER);
>   dbg_printk(TPACPI_DBG_MIXER,
>  

Re: [PATCH v03 00/98] Userspace compile test and fixes for exported uapi header files

2015-05-30 Thread Mikko Rapeli
On Sat, May 30, 2015 at 10:12:48PM +0200, Richard Weinberger wrote:
> On Sat, May 30, 2015 at 5:37 PM, Mikko Rapeli  wrote:
> > v3:
> > tried to fix all v2 review findings
> > tried to guess how to fix a few more issue
> > with a few hacks, 0 files fail and 760 files pass the compile test on 32bit 
> > x86
> >
> > v2:
> > https://lkml.org/lkml/2015/2/16/521
> > added cross compiler support with CROSS_COMPILE,
> > detecting libc and GCC headers from compiler,
> > more header file fixes
> >
> > v1:
> > https://lkml.org/lkml/2014/8/21/665
> >
> > Users of kernel header files would be happier if they did not contain
> > kernel specific parts and would contain #include statements for all
> > other header files that they depend on, and in general would compile.
> 
> Maybe this is a stupid question, but does that mean that many of our uapi
> headers never worked as expected and don't build at all?

Yes. Many uapi headers do not compile in userspace and users of those
headers need to either copy stuff out or do other tricks when including
them. See patch nr 0002 for stats, or https://lkml.org/lkml/2015/5/30/98

-Mikko
--
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/6] staging/lustre/llite: Move all remaining procfs entries to debugfs

2015-05-30 Thread green
From: Oleg Drokin 

This moves all remaining procfs handling in llite layer to debugfs.

Signed-off-by: Dmitry Eremin 
Signed-off-by: Oleg Drokin 
---
 .../staging/lustre/lustre/llite/llite_internal.h   | 27 +++-
 drivers/staging/lustre/lustre/llite/llite_lib.c| 13 +++---
 drivers/staging/lustre/lustre/llite/lproc_llite.c  | 48 --
 drivers/staging/lustre/lustre/llite/super25.c  | 20 -
 drivers/staging/lustre/lustre/llite/vvp_dev.c  | 21 +-
 5 files changed, 68 insertions(+), 61 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h 
b/drivers/staging/lustre/lustre/llite/llite_internal.h
index e180912..b30eb85 100644
--- a/drivers/staging/lustre/lustre/llite/llite_internal.h
+++ b/drivers/staging/lustre/lustre/llite/llite_internal.h
@@ -465,7 +465,7 @@ struct ll_sb_info {
struct obd_uuidll_sb_uuid;
struct obd_export   *ll_md_exp;
struct obd_export   *ll_dt_exp;
-   struct proc_dir_entry*ll_proc_root;
+   struct dentry   *ll_debugfs_entry;
struct lu_fidll_root_fid; /* root object fid */
 
intll_flags;
@@ -636,7 +636,7 @@ struct lov_stripe_md;
 
 extern spinlock_t inode_lock;
 
-extern struct proc_dir_entry *proc_lustre_fs_root;
+extern struct dentry *llite_root;
 extern struct kset *llite_kset;
 
 static inline struct inode *ll_info2i(struct ll_inode_info *lli)
@@ -664,20 +664,25 @@ struct ll_ra_read *ll_ra_read_get(struct file *f);
 
 /* llite/lproc_llite.c */
 #if defined (CONFIG_PROC_FS)
-int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
-   struct super_block *sb, char *osc, char *mdc);
-void lprocfs_unregister_mountpoint(struct ll_sb_info *sbi);
+int ldebugfs_register_mountpoint(struct dentry *parent,
+struct super_block *sb, char *osc, char *mdc);
+void ldebugfs_unregister_mountpoint(struct ll_sb_info *sbi);
 void ll_stats_ops_tally(struct ll_sb_info *sbi, int op, int count);
 void lprocfs_llite_init_vars(struct lprocfs_static_vars *lvars);
 void ll_rw_stats_tally(struct ll_sb_info *sbi, pid_t pid,
   struct ll_file_data *file, loff_t pos,
   size_t count, int rw);
-#else
-static inline int lprocfs_register_mountpoint(struct proc_dir_entry *parent,
-   struct super_block *sb, char *osc, char *mdc){return 0;}
-static inline void lprocfs_unregister_mountpoint(struct ll_sb_info *sbi) {}
+#else /* CONFIG_PROC_FS */
+static inline
+int ldebugfs_register_mountpoint(struct dentry *parent,
+struct super_block *sb, char *osc, char *mdc)
+{ return 0; }
 static inline
-void ll_stats_ops_tally(struct ll_sb_info *sbi, int op, int count) {}
+void ldebugfs_unregister_mountpoint(struct ll_sb_info *sbi)
+{}
+static inline
+void ll_stats_ops_tally(struct ll_sb_info *sbi, int op, int count)
+{}
 static inline void lprocfs_llite_init_vars(struct lprocfs_static_vars *lvars)
 {
memset(lvars, 0, sizeof(*lvars));
@@ -685,7 +690,7 @@ static inline void lprocfs_llite_init_vars(struct 
lprocfs_static_vars *lvars)
 static inline void ll_rw_stats_tally(struct ll_sb_info *sbi, pid_t pid,
 struct ll_file_data *file, loff_t pos,
 size_t count, int rw) {}
-#endif
+#endif /* CONFIG_PROC_FS */
 
 
 /* llite/dir.c */
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c 
b/drivers/staging/lustre/lustre/llite/llite_lib.c
index 4c9fd4a..2513988 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -57,7 +57,7 @@
 #include "llite_internal.h"
 
 struct kmem_cache *ll_file_data_slab;
-struct proc_dir_entry *proc_lustre_fs_root;
+struct dentry *llite_root;
 struct kset *llite_kset;
 
 static LIST_HEAD(ll_super_blocks);
@@ -184,11 +184,10 @@ static int client_common_fill_super(struct super_block 
*sb, char *md, char *dt,
return -ENOMEM;
}
 
-   if (proc_lustre_fs_root) {
-   err = lprocfs_register_mountpoint(proc_lustre_fs_root, sb,
- dt, md);
+   if (llite_root != NULL) {
+   err = ldebugfs_register_mountpoint(llite_root, sb, dt, md);
if (err < 0)
-   CERROR("could not register mount in /proc/fs/lustre\n");
+   CERROR("could not register mount in 
/lustre/llite\n");
}
 
/* indicate the features supported by this client */
@@ -601,7 +600,7 @@ out_md:
 out:
kfree(data);
kfree(osfs);
-   lprocfs_unregister_mountpoint(sbi);
+   ldebugfs_unregister_mountpoint(sbi);
return err;
 }
 
@@ -682,7 +681,7 @@ static void client_common_put_super(struct super_block *sb)
 * see LU-2543. */
obd_zombie_barrier();
 
-   

[PATCH 5/6] staging/lustre/obd: Remove nid_stats tracking

2015-05-30 Thread green
From: Oleg Drokin 

This nid_stats tracking only makes sense on the server side,
on the client there are no other clients to keep track of anyway.

Signed-off-by: Dmitry Eremin 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/dt_object.h  |  1 -
 .../staging/lustre/lustre/include/lprocfs_status.h | 15 
 drivers/staging/lustre/lustre/include/lu_object.h  |  2 -
 .../staging/lustre/lustre/include/lustre_export.h  | 29 ---
 drivers/staging/lustre/lustre/include/obd.h|  3 -
 drivers/staging/lustre/lustre/include/obd_class.h  | 18 
 .../lustre/lustre/obdclass/lprocfs_status.c| 96 --
 .../staging/lustre/lustre/obdclass/obd_config.c| 80 --
 8 files changed, 244 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/dt_object.h 
b/drivers/staging/lustre/lustre/include/dt_object.h
index be4c7d9..866d04b 100644
--- a/drivers/staging/lustre/lustre/include/dt_object.h
+++ b/drivers/staging/lustre/lustre/include/dt_object.h
@@ -58,7 +58,6 @@
 #include "../../include/linux/libcfs/libcfs.h"
 
 struct seq_file;
-struct proc_dir_entry;
 struct lustre_cfg;
 
 struct thandle;
diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h 
b/drivers/staging/lustre/lustre/include/lprocfs_status.h
index 4b8c265..6a77ea8 100644
--- a/drivers/staging/lustre/lustre/include/lprocfs_status.h
+++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h
@@ -558,7 +558,6 @@ extern void lprocfs_counter_init(struct lprocfs_stats 
*stats, int index,
 extern void lprocfs_free_obd_stats(struct obd_device *obddev);
 extern void lprocfs_free_md_stats(struct obd_device *obddev);
 struct obd_export;
-struct nid_stat;
 extern int lprocfs_add_clear_entry(struct obd_device *obd,
   struct proc_dir_entry *entry);
 extern int lprocfs_exp_cleanup(struct obd_export *exp);
@@ -573,11 +572,6 @@ extern struct proc_dir_entry *lprocfs_add_simple(struct 
proc_dir_entry *root,
 extern struct dentry *
 ldebugfs_add_symlink(const char *name, struct dentry *parent,
const char *format, ...);
-extern void lprocfs_free_per_client_stats(struct obd_device *obd);
-extern int
-lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
- unsigned long count, void *data);
-extern int lprocfs_nid_stats_clear_read(struct seq_file *m, void *data);
 
 extern int ldebugfs_register_stats(struct dentry *parent,
   const char *name,
@@ -909,15 +903,6 @@ static inline struct proc_dir_entry *
 lprocfs_add_simple(struct proc_dir_entry *root, char *name,
   void *data, struct file_operations *fops)
 {return 0; }
-static inline void lprocfs_free_per_client_stats(struct obd_device *obd)
-{ return; }
-static inline
-int lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
- unsigned long count, void *data)
-{return count;}
-static inline
-int lprocfs_nid_stats_clear_read(struct seq_file *m, void *data)
-{ return 0; }
 
 static inline struct proc_dir_entry *
 lprocfs_register(const char *name, struct proc_dir_entry *parent,
diff --git a/drivers/staging/lustre/lustre/include/lu_object.h 
b/drivers/staging/lustre/lustre/include/lu_object.h
index c8cc48f..e1d72a7 100644
--- a/drivers/staging/lustre/lustre/include/lu_object.h
+++ b/drivers/staging/lustre/lustre/include/lu_object.h
@@ -43,7 +43,6 @@
 #include "lu_ref.h"
 
 struct seq_file;
-struct proc_dir_entry;
 struct lustre_cfg;
 struct lprocfs_stats;
 
@@ -277,7 +276,6 @@ struct lu_device {
 * Stack this device belongs to.
 */
struct lu_site  *ld_site;
-   struct proc_dir_entry*ld_proc_entry;
 
/** \todo XXX: temporary back pointer into obd. */
struct obd_device*ld_obd;
diff --git a/drivers/staging/lustre/lustre/include/lustre_export.h 
b/drivers/staging/lustre/lustre/include/lustre_export.h
index 9c06a49..3b992b4 100644
--- a/drivers/staging/lustre/lustre/include/lustre_export.h
+++ b/drivers/staging/lustre/lustre/include/lustre_export.h
@@ -106,34 +106,6 @@ struct mgs_export_data {
spinlock_t  med_lock;   /* protect med_clients */
 };
 
-/**
- * per-NID statistics structure.
- * It tracks access patterns to this export on a per-client-NID basis
- */
-struct nid_stat {
-   lnet_nid_t nid;
-   struct hlist_nodenid_hash;
-   struct list_head   nid_list;
-   struct obd_device   *nid_obd;
-   struct proc_dir_entry   *nid_proc;
-   struct lprocfs_stats*nid_stats;
-   struct lprocfs_stats*nid_ldlm_stats;
-   atomic_t nid_exp_ref_count; /* for obd_nid_stats_hash
-  exp_nid_stats */
-};
-
-#define nidstat_getref(nidstat)
\
-do {  

[PATCH 6/6] staging/lustre/obd: final removal of procfs stuff

2015-05-30 Thread green
From: Dmitry Eremin 

Signed-off-by: Dmitry Eremin 
Signed-off-by: Oleg Drokin 
---
 .../lustre/include/linux/libcfs/linux/libcfs.h |   1 -
 drivers/staging/lustre/lustre/fid/Makefile |   3 +-
 drivers/staging/lustre/lustre/fld/Makefile |   3 +-
 drivers/staging/lustre/lustre/include/dt_object.h  |   2 -
 .../lustre/lustre/include/linux/lustre_lite.h  |   1 -
 drivers/staging/lustre/lustre/include/linux/obd.h  |  10 +-
 .../staging/lustre/lustre/include/lprocfs_status.h | 225 +--
 drivers/staging/lustre/lustre/include/lustre_fid.h |   3 -
 drivers/staging/lustre/lustre/include/lustre_fld.h |   4 -
 drivers/staging/lustre/lustre/include/lustre_net.h |   6 -
 .../staging/lustre/lustre/include/lustre_quota.h   | 241 -
 drivers/staging/lustre/lustre/include/obd_class.h  |  15 --
 .../staging/lustre/lustre/include/obd_support.h|  41 
 drivers/staging/lustre/lustre/ldlm/ldlm_resource.c |   2 +-
 drivers/staging/lustre/lustre/libcfs/module.c  |   1 -
 drivers/staging/lustre/lustre/llite/Makefile   |   3 +-
 .../staging/lustre/lustre/llite/llite_internal.h   |  21 --
 drivers/staging/lustre/lustre/llite/vvp_dev.c  |   2 +-
 drivers/staging/lustre/lustre/lmv/Makefile |   3 +-
 drivers/staging/lustre/lustre/lmv/lmv_internal.h   |   8 +-
 drivers/staging/lustre/lustre/lov/Makefile |   3 +-
 drivers/staging/lustre/lustre/lov/lov_internal.h   |   7 -
 drivers/staging/lustre/lustre/lov/lov_pool.c   |   2 -
 drivers/staging/lustre/lustre/mdc/Makefile |   3 +-
 drivers/staging/lustre/lustre/mdc/lproc_mdc.c  |   2 +-
 drivers/staging/lustre/lustre/mdc/mdc_internal.h   |   7 -
 drivers/staging/lustre/lustre/mgc/Makefile |   3 +-
 drivers/staging/lustre/lustre/mgc/mgc_internal.h   |  11 -
 drivers/staging/lustre/lustre/mgc/mgc_request.c|   2 -
 drivers/staging/lustre/lustre/obdclass/Makefile|   4 +-
 drivers/staging/lustre/lustre/obdclass/class_obd.c |  37 ++--
 drivers/staging/lustre/lustre/obdclass/dt_object.c |   6 -
 .../lustre/lustre/obdclass/linux/linux-module.c|   1 -
 .../lustre/lustre/obdclass/linux/linux-sysctl.c|   1 -
 .../lustre/lustre/obdclass/lprocfs_status.c| 153 +
 drivers/staging/lustre/lustre/obdclass/lu_object.c |   4 -
 drivers/staging/lustre/lustre/osc/Makefile |   3 +-
 drivers/staging/lustre/lustre/osc/lproc_osc.c  |   4 +-
 drivers/staging/lustre/lustre/osc/osc_internal.h   |   8 -
 drivers/staging/lustre/lustre/ptlrpc/Makefile  |   3 +-
 .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c|   5 +-
 .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h |  12 -
 drivers/staging/lustre/lustre/ptlrpc/sec_lproc.c   |   8 +-
 43 files changed, 54 insertions(+), 830 deletions(-)
 delete mode 100644 drivers/staging/lustre/lustre/include/lustre_quota.h

diff --git a/drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h 
b/drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h
index 4fe50841..3e2502a 100644
--- a/drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h
+++ b/drivers/staging/lustre/include/linux/libcfs/linux/libcfs.h
@@ -61,7 +61,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/staging/lustre/lustre/fid/Makefile 
b/drivers/staging/lustre/lustre/fid/Makefile
index 5513ce4..b7ef314 100644
--- a/drivers/staging/lustre/lustre/fid/Makefile
+++ b/drivers/staging/lustre/lustre/fid/Makefile
@@ -1,3 +1,2 @@
 obj-$(CONFIG_LUSTRE_FS) += fid.o
-fid-y := fid_request.o fid_lib.o
-fid-$(CONFIG_PROC_FS) += lproc_fid.o
+fid-y := fid_request.o fid_lib.o lproc_fid.o
diff --git a/drivers/staging/lustre/lustre/fld/Makefile 
b/drivers/staging/lustre/lustre/fld/Makefile
index 2bbf084..646e315 100644
--- a/drivers/staging/lustre/lustre/fld/Makefile
+++ b/drivers/staging/lustre/lustre/fld/Makefile
@@ -1,3 +1,2 @@
 obj-$(CONFIG_LUSTRE_FS) += fld.o
-fld-y := fld_request.o fld_cache.o
-fld-$(CONFIG_PROC_FS) += lproc_fld.o
+fld-y := fld_request.o fld_cache.o lproc_fld.o
diff --git a/drivers/staging/lustre/lustre/include/dt_object.h 
b/drivers/staging/lustre/lustre/include/dt_object.h
index 866d04b..abae31b 100644
--- a/drivers/staging/lustre/lustre/include/dt_object.h
+++ b/drivers/staging/lustre/lustre/include/dt_object.h
@@ -1480,7 +1480,6 @@ static inline struct dt_thread_info *dt_info(const struct 
lu_env *env)
 int dt_global_init(void);
 void dt_global_fini(void);
 
-#if defined (CONFIG_PROC_FS)
 int lprocfs_dt_rd_blksize(char *page, char **start, off_t off,
  int count, int *eof, void *data);
 int lprocfs_dt_rd_kbytestotal(char *page, char **start, off_t off,
@@ -1493,6 +1492,5 @@ int lprocfs_dt_rd_filestotal(char *page, char **start, 
off_t off,
 int count, int *eof, void *data);
 int lprocfs_dt_rd_filesfree(char *page, char **start, off_t off,
int count, int *eof, void *data);
-#endif /* CONFIG_PROC_FS */
 

[PATCH 4/6] staging/lustre/obd: remove unused lprocfs_exp_setup() and related functions

2015-05-30 Thread green
From: Oleg Drokin 

This code only made sense on servers.

Signed-off-by: Dmitry Eremin 
Signed-off-by: Oleg Drokin 
---
 .../staging/lustre/lustre/include/lprocfs_status.h |   2 -
 drivers/staging/lustre/lustre/include/obd.h|   1 -
 .../lustre/lustre/obdclass/lprocfs_status.c| 182 -
 3 files changed, 185 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h 
b/drivers/staging/lustre/lustre/include/lprocfs_status.h
index 328cd07..4b8c265 100644
--- a/drivers/staging/lustre/lustre/include/lprocfs_status.h
+++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h
@@ -561,8 +561,6 @@ struct obd_export;
 struct nid_stat;
 extern int lprocfs_add_clear_entry(struct obd_device *obd,
   struct proc_dir_entry *entry);
-extern int lprocfs_exp_setup(struct obd_export *exp,
-lnet_nid_t *peer_nid, int *newnid);
 extern int lprocfs_exp_cleanup(struct obd_export *exp);
 extern struct dentry *ldebugfs_add_simple(struct dentry *root,
  char *name,
diff --git a/drivers/staging/lustre/lustre/include/obd.h 
b/drivers/staging/lustre/lustre/include/obd.h
index d3df9eb..5268ae5 100644
--- a/drivers/staging/lustre/lustre/include/obd.h
+++ b/drivers/staging/lustre/lustre/include/obd.h
@@ -918,7 +918,6 @@ struct obd_device {
struct lprocfs_stats  *md_stats;
 
struct dentry   *obd_debugfs_entry;
-   struct proc_dir_entry  *obd_proc_exports_entry;
struct dentry   *obd_svc_debugfs_entry;
struct lprocfs_stats  *obd_svc_stats;
atomic_t   obd_evict_inprogress;
diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c 
b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
index 79ff72c..3ef5474 100644
--- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
+++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
@@ -1096,12 +1096,6 @@ int lprocfs_obd_cleanup(struct obd_device *obd)
if (!obd)
return -EINVAL;
 
-   if (obd->obd_proc_exports_entry) {
-   /* Should be no exports left */
-   lprocfs_remove(>obd_proc_exports_entry);
-   obd->obd_proc_exports_entry = NULL;
-   }
-
if (!IS_ERR_OR_NULL(obd->obd_debugfs_entry))
ldebugfs_remove(>obd_debugfs_entry);
 
@@ -1685,72 +1679,6 @@ void lprocfs_init_ldlm_stats(struct lprocfs_stats 
*ldlm_stats)
 }
 EXPORT_SYMBOL(lprocfs_init_ldlm_stats);
 
-int lprocfs_exp_print_uuid(struct cfs_hash *hs, struct cfs_hash_bd *bd,
-  struct hlist_node *hnode, void *data)
-
-{
-   struct obd_export *exp = cfs_hash_object(hs, hnode);
-   struct seq_file *m = (struct seq_file *)data;
-
-   if (exp->exp_nid_stats)
-   seq_printf(m, "%s\n", obd_uuid2str(>exp_client_uuid));
-
-   return 0;
-}
-
-static int
-lproc_exp_uuid_seq_show(struct seq_file *m, void *unused)
-{
-   struct nid_stat *stats = (struct nid_stat *)m->private;
-   struct obd_device *obd = stats->nid_obd;
-
-   cfs_hash_for_each_key(obd->obd_nid_hash, >nid,
- lprocfs_exp_print_uuid, m);
-   return 0;
-}
-
-LPROC_SEQ_FOPS_RO(lproc_exp_uuid);
-
-struct exp_hash_cb_data {
-   struct seq_file *m;
-   boolfirst;
-};
-
-int lprocfs_exp_print_hash(struct cfs_hash *hs, struct cfs_hash_bd *bd,
-  struct hlist_node *hnode, void *cb_data)
-
-{
-   struct exp_hash_cb_data *data = (struct exp_hash_cb_data *)cb_data;
-   struct obd_export   *exp = cfs_hash_object(hs, hnode);
-
-   if (exp->exp_lock_hash != NULL) {
-   if (data->first) {
-   cfs_hash_debug_header(data->m);
-   data->first = false;
-   }
-   cfs_hash_debug_str(hs, data->m);
-   }
-
-   return 0;
-}
-
-static int
-lproc_exp_hash_seq_show(struct seq_file *m, void *unused)
-{
-   struct nid_stat *stats = (struct nid_stat *)m->private;
-   struct obd_device *obd = stats->nid_obd;
-   struct exp_hash_cb_data cb_data = {
-   .m = m,
-   .first = true
-   };
-
-   cfs_hash_for_each_key(obd->obd_nid_hash, >nid,
- lprocfs_exp_print_hash, _data);
-   return 0;
-}
-
-LPROC_SEQ_FOPS_RO(lproc_exp_hash);
-
 int lprocfs_nid_stats_clear_read(struct seq_file *m, void *data)
 {
seq_printf(m, "%s\n",
@@ -1799,116 +1727,6 @@ int lprocfs_nid_stats_clear_write(struct file *file, 
const char *buffer,
 }
 EXPORT_SYMBOL(lprocfs_nid_stats_clear_write);
 
-int lprocfs_exp_setup(struct obd_export *exp, lnet_nid_t *nid, int *newnid)
-{
-   struct nid_stat *new_stat, *old_stat;
-   struct obd_device *obd = NULL;
-   struct proc_dir_entry *entry;
-   char *buffer = NULL;
-   int rc = 0;
-
-   *newnid = 0;
-
-   if (!exp || !exp->exp_obd || 

[PATCH 2/6] staging/lustre/obd: remove unused proc_lustre_root

2015-05-30 Thread green
From: Dmitry Eremin 

Signed-off-by: Dmitry Eremin 
---
 drivers/staging/lustre/lustre/include/lprocfs_status.h |  3 ---
 .../lustre/lustre/obdclass/linux/linux-module.c| 18 --
 2 files changed, 21 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h 
b/drivers/staging/lustre/lustre/include/lprocfs_status.h
index 721efd6..19ab9e8 100644
--- a/drivers/staging/lustre/lustre/include/lprocfs_status.h
+++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h
@@ -349,7 +349,6 @@ enum {
 
 #define EXTRA_FIRST_OPC LDLM_GLIMPSE_ENQUEUE
 /* class_obd.c */
-extern struct proc_dir_entry *proc_lustre_root;
 extern struct dentry *debugfs_lustre_root;
 extern struct kobject *lustre_kobj;
 
@@ -851,8 +850,6 @@ extern int lprocfs_quota_wr_qs_factor(struct file *file,
 #else
 /* CONFIG_PROC_FS is not defined */
 
-#define proc_lustre_root NULL
-
 static inline void lprocfs_counter_add(struct lprocfs_stats *stats,
   int index, long amount)
 { return; }
diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c 
b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
index 03a982a..50c3d1d 100644
--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
@@ -322,11 +322,6 @@ static ssize_t jobid_name_store(struct kobject *kobj, 
struct attribute *attr,
 struct dentry *debugfs_lustre_root;
 EXPORT_SYMBOL_GPL(debugfs_lustre_root);
 
-#if defined(CONFIG_PROC_FS)
-/* Root for /proc/fs/lustre */
-struct proc_dir_entry *proc_lustre_root = NULL;
-EXPORT_SYMBOL(proc_lustre_root);
-
 LUSTRE_RO_ATTR(version);
 LUSTRE_RO_ATTR(pinger);
 LUSTRE_RO_ATTR(health);
@@ -459,14 +454,6 @@ int class_procfs_init(void)
kobject_put(lustre_kobj);
goto out;
}
-
-   proc_lustre_root = lprocfs_register("fs/lustre", NULL, NULL, NULL);
-   if (IS_ERR(proc_lustre_root)) {
-   rc = PTR_ERR(proc_lustre_root);
-   proc_lustre_root = NULL;
-   kobject_put(lustre_kobj);
-   goto out;
-   }
 out:
return rc;
 }
@@ -478,12 +465,7 @@ int class_procfs_clean(void)
 
debugfs_lustre_root = NULL;
 
-   if (proc_lustre_root) {
-   lprocfs_remove(_lustre_root);
-   }
-
kobject_put(lustre_kobj);
 
return 0;
 }
-#endif /* CONFIG_PROC_FS */
-- 
2.1.0

--
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/6] staging/lustre/obd: Rename lprocfs_add_symlink to ldebugfs_add_symlink

2015-05-30 Thread green
From: Oleg Drokin 

Signed-off-by: Dmitry Eremin 
---
 drivers/staging/lustre/lustre/include/lprocfs_status.h  | 12 ++--
 drivers/staging/lustre/lustre/obdclass/lprocfs_status.c | 16 +---
 2 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h 
b/drivers/staging/lustre/lustre/include/lprocfs_status.h
index 19ab9e8..328cd07 100644
--- a/drivers/staging/lustre/lustre/include/lprocfs_status.h
+++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h
@@ -572,8 +572,8 @@ extern struct proc_dir_entry *lprocfs_add_simple(struct 
proc_dir_entry *root,
char *name,
void *data,
struct file_operations *fops);
-extern struct proc_dir_entry *
-lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
+extern struct dentry *
+ldebugfs_add_symlink(const char *name, struct dentry *parent,
const char *format, ...);
 extern void lprocfs_free_per_client_stats(struct obd_device *obd);
 extern int
@@ -905,20 +905,12 @@ static inline void lprocfs_free_md_stats(struct 
obd_device *obddev)
 struct obd_export;
 static inline int lprocfs_add_clear_entry(struct obd_export *exp)
 { return 0; }
-static inline int lprocfs_exp_setup(struct obd_export *exp,
-   lnet_nid_t *peer_nid,
-   int *newnid)
-{ return 0; }
 static inline int lprocfs_exp_cleanup(struct obd_export *exp)
 { return 0; }
 static inline struct proc_dir_entry *
 lprocfs_add_simple(struct proc_dir_entry *root, char *name,
   void *data, struct file_operations *fops)
 {return 0; }
-static inline struct proc_dir_entry *
-lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent,
-   const char *format, ...)
-{return NULL; }
 static inline void lprocfs_free_per_client_stats(struct obd_device *obd)
 { return; }
 static inline
diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c 
b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
index 51865dd..79ff72c 100644
--- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
+++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
@@ -289,10 +289,10 @@ struct proc_dir_entry *lprocfs_add_simple(struct 
proc_dir_entry *root,
 }
 EXPORT_SYMBOL(lprocfs_add_simple);
 
-struct proc_dir_entry *lprocfs_add_symlink(const char *name,
-   struct proc_dir_entry *parent, const char *format, ...)
+struct dentry *ldebugfs_add_symlink(const char *name, struct dentry *parent,
+   const char *format, ...)
 {
-   struct proc_dir_entry *entry;
+   struct dentry *entry;
char *dest;
va_list ap;
 
@@ -307,15 +307,17 @@ struct proc_dir_entry *lprocfs_add_symlink(const char 
*name,
vsnprintf(dest, MAX_STRING_SIZE, format, ap);
va_end(ap);
 
-   entry = proc_symlink(name, parent, dest);
-   if (entry == NULL)
-   CERROR("LprocFS: Could not create symbolic link from %s to %s",
+   entry = debugfs_create_symlink(name, parent, dest);
+   if (IS_ERR_OR_NULL(entry)) {
+   CERROR("LdebugFS: Could not create symbolic link from %s to %s",
name, dest);
+   entry = NULL;
+   }
 
kfree(dest);
return entry;
 }
-EXPORT_SYMBOL(lprocfs_add_symlink);
+EXPORT_SYMBOL(ldebugfs_add_symlink);
 
 static struct file_operations lprocfs_generic_fops = { };
 
-- 
2.1.0

--
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 0/6] Final part of lustre procfs removal series

2015-05-30 Thread green
From: Oleg Drokin 

Due to a patch naming error this remainder of patches did not merge.
Fixed the commit message to resolve this.
lustresysctl code still stays in place and would be removed in a
separate patch series.

Additionally resolved a merge conflict with some other patch
that touched lprocfs_exp_setup and made the
lprocfs_exp_setup removal patch unmergeable.

Dmitry Eremin (2):
  staging/lustre/obd: remove unused proc_lustre_root
  staging/lustre/obd: final removal of procfs stuff

Oleg Drokin (4):
  staging/lustre/llite: Move all remaining procfs entries to debugfs
  staging/lustre/obd: Rename lprocfs_add_symlink to ldebugfs_add_symlink
  staging/lustre/obd: remove unused lprocfs_exp_setup() and related
functions
  staging/lustre/obd: Remove nid_stats tracking

 .../lustre/include/linux/libcfs/linux/libcfs.h |   1 -
 drivers/staging/lustre/lustre/fid/Makefile |   3 +-
 drivers/staging/lustre/lustre/fld/Makefile |   3 +-
 drivers/staging/lustre/lustre/include/dt_object.h  |   3 -
 .../lustre/lustre/include/linux/lustre_lite.h  |   1 -
 drivers/staging/lustre/lustre/include/linux/obd.h  |  10 +-
 .../staging/lustre/lustre/include/lprocfs_status.h | 257 +---
 drivers/staging/lustre/lustre/include/lu_object.h  |   2 -
 .../staging/lustre/lustre/include/lustre_export.h  |  29 --
 drivers/staging/lustre/lustre/include/lustre_fid.h |   3 -
 drivers/staging/lustre/lustre/include/lustre_fld.h |   4 -
 drivers/staging/lustre/lustre/include/lustre_net.h |   6 -
 .../staging/lustre/lustre/include/lustre_quota.h   | 241 ---
 drivers/staging/lustre/lustre/include/obd.h|   4 -
 drivers/staging/lustre/lustre/include/obd_class.h  |  33 --
 .../staging/lustre/lustre/include/obd_support.h|  41 --
 drivers/staging/lustre/lustre/ldlm/ldlm_resource.c |   2 +-
 drivers/staging/lustre/lustre/libcfs/module.c  |   1 -
 drivers/staging/lustre/lustre/llite/Makefile   |   3 +-
 .../staging/lustre/lustre/llite/llite_internal.h   |  26 +-
 drivers/staging/lustre/lustre/llite/llite_lib.c|  13 +-
 drivers/staging/lustre/lustre/llite/lproc_llite.c  |  48 ++-
 drivers/staging/lustre/lustre/llite/super25.c  |  20 +-
 drivers/staging/lustre/lustre/llite/vvp_dev.c  |  21 +-
 drivers/staging/lustre/lustre/lmv/Makefile |   3 +-
 drivers/staging/lustre/lustre/lmv/lmv_internal.h   |   8 +-
 drivers/staging/lustre/lustre/lov/Makefile |   3 +-
 drivers/staging/lustre/lustre/lov/lov_internal.h   |   7 -
 drivers/staging/lustre/lustre/lov/lov_pool.c   |   2 -
 drivers/staging/lustre/lustre/mdc/Makefile |   3 +-
 drivers/staging/lustre/lustre/mdc/lproc_mdc.c  |   2 +-
 drivers/staging/lustre/lustre/mdc/mdc_internal.h   |   7 -
 drivers/staging/lustre/lustre/mgc/Makefile |   3 +-
 drivers/staging/lustre/lustre/mgc/mgc_internal.h   |  11 -
 drivers/staging/lustre/lustre/mgc/mgc_request.c|   2 -
 drivers/staging/lustre/lustre/obdclass/Makefile|   4 +-
 drivers/staging/lustre/lustre/obdclass/class_obd.c |  37 +-
 drivers/staging/lustre/lustre/obdclass/dt_object.c |   6 -
 .../lustre/lustre/obdclass/linux/linux-module.c|  19 -
 .../lustre/lustre/obdclass/linux/linux-sysctl.c|   1 -
 .../lustre/lustre/obdclass/lprocfs_status.c| 447 +
 drivers/staging/lustre/lustre/obdclass/lu_object.c |   4 -
 .../staging/lustre/lustre/obdclass/obd_config.c|  80 
 drivers/staging/lustre/lustre/osc/Makefile |   3 +-
 drivers/staging/lustre/lustre/osc/lproc_osc.c  |   4 +-
 drivers/staging/lustre/lustre/osc/osc_internal.h   |   8 -
 drivers/staging/lustre/lustre/ptlrpc/Makefile  |   3 +-
 .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c|   5 +-
 .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h |  12 -
 drivers/staging/lustre/lustre/ptlrpc/sec_lproc.c   |   8 +-
 50 files changed, 121 insertions(+), 1346 deletions(-)
 delete mode 100644 drivers/staging/lustre/lustre/include/lustre_quota.h

-- 
2.1.0

--
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] char:xilinx_hwicap:buffer_icap - change 1/0 to true/false for bool type variable in function buffer_icap_set_configuration().

2015-05-30 Thread Greg Kroah-Hartman
On Wed, May 27, 2015 at 02:33:59PM +0200, Michal Simek wrote:
> +Greg
> 
> On 05/25/2015 09:41 PM, Shailendra Verma wrote:
> > The variable dirty is bool type. Hence assign the variable with
> > bool value true/false instead of 1/0.
> > 
> > Signed-off-by: Shailendra Verma 
> > ---
> >  drivers/char/xilinx_hwicap/buffer_icap.c |6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/char/xilinx_hwicap/buffer_icap.c 
> > b/drivers/char/xilinx_hwicap/buffer_icap.c
> > index 05d8977..53c3882 100644
> > --- a/drivers/char/xilinx_hwicap/buffer_icap.c
> > +++ b/drivers/char/xilinx_hwicap/buffer_icap.c
> > @@ -270,7 +270,7 @@ int buffer_icap_set_configuration(struct hwicap_drvdata 
> > *drvdata, u32 *data,
> > int status;
> > s32 buffer_count = 0;
> > s32 num_writes = 0;
> > -   bool dirty = 0;
> > +   bool dirty = false;
> > u32 i;
> > void __iomem *base_address = drvdata->base_address;
> >  
> > @@ -279,7 +279,7 @@ int buffer_icap_set_configuration(struct hwicap_drvdata 
> > *drvdata, u32 *data,
> >  
> > /* Copy data to bram */
> > buffer_icap_set_bram(base_address, buffer_count, data[i]);
> > -   dirty = 1;
> > +   dirty = true;
> >  
> > if (buffer_count < XHI_MAX_BUFFER_INTS - 1) {
> > buffer_count++;
> > @@ -299,7 +299,7 @@ int buffer_icap_set_configuration(struct hwicap_drvdata 
> > *drvdata, u32 *data,
> >  
> > buffer_count = 0;
> > num_writes++;
> > -   dirty = 0;
> > +   dirty = false;
> > }
> >  
> > /* Write unwritten data to ICAP */
> > 
> 
> Tested-by: Michal Simek 

Hm, I don't have the original, can you resend it with your tested-by?

thanks,

greg k-h
--
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/3] Drivers: hv: vmbus: Use the vp_index map even for channels bound to CPU 0

2015-05-30 Thread gre...@linuxfoundation.org
On Fri, May 29, 2015 at 05:41:34PM +, KY Srinivasan wrote:
> 
> 
> > -Original Message-
> > From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
> > Sent: Friday, May 29, 2015 10:00 AM
> > To: KY Srinivasan
> > Cc: gre...@linuxfoundation.org; linux-kernel@vger.kernel.org;
> > de...@linuxdriverproject.org; o...@aepfle.de; a...@canonical.com;
> > vkuzn...@redhat.com; jasow...@redhat.com
> > Subject: Re: [PATCH 1/3] Drivers: hv: vmbus: Use the vp_index map even for
> > channels bound to CPU 0
> > 
> > On Fri, May 29, 2015 at 11:09:02AM -0700, K. Y. Srinivasan wrote:
> > > Map target_cpu to target_vcpu using the mapping table.
> > >
> > 
> > It's really hard to tell from this changelog what the user visible
> > effects of this patch are.
> 
> We should use the map to transform guest CPU ID to VP Index as is done
> For the non-performance critical channels. While the value CPU 0 is special 
> and will
> map to VP index 0, it is good to be consistent.

Then put that in the changelog!

Please fix up and resend the series.

thanks,

greg k-h
--
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: [PATCHv3 00/16] vme DMA and user space driver improvements

2015-05-30 Thread Greg Kroah-Hartman
On Thu, May 28, 2015 at 03:06:57PM +0300, Dmitry Kalinkin wrote:
> The first item in this submission documents previously introduced
> vme_master_mmap() call. Following, there are three fixes for the tsi148
> driver's DMA.  There was one bug that rendered it imposible to use DMA
> lists with more than one item. The other was related to the place where
> dma_map_single was called on the first DMA descriptor in the DMA list. The
>  
> last bug was about DMA transfer not stopping at interruption by signal,   
>  
> which is a possible DoS attack vector. I also made an attempt to fix the
> same issue in the ca91cx42 driver. I don't have access to this hardware to
> test, so this is based only on my understanding of the datasheet (checked 
>  
> ca91c042's errata as well).
> 
> A new /sys/bus/vme/dma0 device with a new ioctl for making DMA transfers
> was introduced in vme_user driver. The logic of the function is similar to
>  
> the one found in existing drivers.
> 
> One question that I had while implementing this feature was whether we
>  
> should keep vme_dma_attr objects until vme_dma_list_exec() call. API
> doesn't specify this, the existing vme bridge drivers copy all information
> from attributes during vme_dma_list_add(). So for simplicity this 
>  
> implementation frees vme_dma_attr's before vme_dma_list_exec() is done.   
>  
> 
> A simple test against AVM16 board displays speeds around 45 MiB/s for
> A32/D32 reads for both BLT and MBLT (with MBLT being slightly faster).
>  
>  
> Changes in v2 [patches 1-6, now 1-5 and 8]:
>  * vme_addr check for vme_user DMA
>  
>  * limit on DMA operation length in vme_user
>  * reorder dma_op ioctl struct to omit __packed attribute 
>  * change dma_op->write into dma_op->dir  
>  
>  * use vme_check_window assure DMA operation correctness  
>  
> 
> New changes include vme_user code cleanup, a couple of ca91cx42 fixes
> (again, tested for compilation only).
> 
> I also propose a change to export some of VME subsytem related constants
> to the user space. These can be useful if vme_user is to go into the kernel.
> Also, email
> http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2012-July/029084.html
> mentions that we probably can now get rid of this comment:
> > /* XXX  We do not want to push aspace, cycle and width
> >  *  to userspace as they are
> >  */
> 
> v3 adresses code style problems

I need an ack from the VME maintainer before I can take these...

thanks,

greg k-h
--
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 v4 00/35] staging: rtl8192e: Fix more checkpatch.pl warnings

2015-05-30 Thread Greg KH
On Thu, May 21, 2015 at 05:53:13PM +0200, Mateusz Kulikowski wrote:
> Updated series of patches for rtl8192.
> 
> Rebased to latest staging-next (936a0cd52aa). Built and target tested 
> (tests like for v3 + download of 1Mb file over http).
> Side note: quality/performance of this driver is still poor - it drops
> a lot of packets (at least when talking to 802.11N/ 2.4G / WPA2 network).

Please resend a v5 with the updated changes.

thanks,

greg k-h
--
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] staging: Replace kzalloc and memcpy by kmemdup

2015-05-30 Thread gre...@linuxfoundation.org
On Wed, May 20, 2015 at 07:04:27AM +, Dumbre, Nitesh Dilip (N.) wrote:
> This patch was generated by coccicheck and replaces kzalloc followed
> by memcpy with kmemdup
> 
> Signed-off-by: Nitesh Dumbre 

Name doesn't match the From: line, please fix your broken email client.

WHat is up with this company's email, there is a bunch of patches from
different people, all of them broken like this.

greg k-h
--
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] Staging: lustre: Replace kzalloc followed by memcpy with kmemdup

2015-05-30 Thread gre...@linuxfoundation.org
On Sat, May 30, 2015 at 10:22:17AM +, Dighe, Niranjan (N.) wrote:
> Replace kzalloc followed by memcpy by kmemdup. This patch was generated
> by 'make coccicheck'
> 
> Signed-off-by: Niranjan Dighe 

Your name here doesn't match the name in the From: line of your email.

Please fix up your email client for all of the patches you sent me and
resend.

thanks,

greg k-h
--
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 v1] staging: lustre: libcfs: add __user annotation in libcfs_ioctl_data

2015-05-30 Thread Greg Kroah-Hartman
On Mon, May 25, 2015 at 09:40:04PM -0700, David Decotigny wrote:
> This fixes the following sparse warnings:
>drivers/staging/lustre/lnet/lnet/api-ni.c:1926:38: warning: incorrect type 
> in argument 1 (different address spaces)
>drivers/staging/lustre/lnet/lnet/api-ni.c:1926:38:expected void 
> [noderef] *to
>drivers/staging/lustre/lnet/lnet/api-ni.c:1926:38:got struct 
> lnet_process_id_t [usertype] *
>drivers/staging/lustre/lnet/selftest/conctl.c:833:37: warning: incorrect 
> type in argument 2 (different address spaces)
>drivers/staging/lustre/lnet/selftest/conctl.c:833:37:expected void 
> const [noderef] *from
>drivers/staging/lustre/lnet/selftest/conctl.c:833:37:got char 
> *ioc_pbuf1
>drivers/staging/lustre/lnet/selftest/conctl.c:918:30: warning: incorrect 
> type in argument 1 (different address spaces)
>drivers/staging/lustre/lnet/selftest/conctl.c:918:30:expected void 
> [noderef] *to
>drivers/staging/lustre/lnet/selftest/conctl.c:918:30:got char 
> *ioc_pbuf2
> 
> Signed-off-by: David Decotigny 
> ---
>  drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h | 4 ++--
>  drivers/staging/lustre/include/linux/lnet/lib-lnet.h   | 2 +-
>  drivers/staging/lustre/lnet/lnet/api-ni.c  | 5 +++--
>  3 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h 
> b/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h
> index 3ee3878..aa687b7 100644
> --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h
> +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h
> @@ -61,9 +61,9 @@ struct libcfs_ioctl_data {
>   char *ioc_inlbuf2;
>  
>   __u32 ioc_plen1; /* buffers in userspace */
> - char *ioc_pbuf1;
> + char __user *ioc_pbuf1;
>   __u32 ioc_plen2; /* buffers in userspace */
> - char *ioc_pbuf2;
> + char __user *ioc_pbuf2;
>  
>   char ioc_bulk[0];
>  };
> diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h 
> b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
> index 0038d29..7f06b9f7 100644
> --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
> +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
> @@ -858,7 +858,7 @@ void lnet_swap_pinginfo(lnet_ping_info_t *info);
>  int lnet_ping_target_init(void);
>  void lnet_ping_target_fini(void);
>  int lnet_ping(lnet_process_id_t id, int timeout_ms,
> -   lnet_process_id_t *ids, int n_ids);
> +   lnet_process_id_t __user *ids, int n_ids);
>  
>  int lnet_parse_ip2nets(char **networksp, char *ip2nets);
>  int lnet_parse_routes(char *route_str, int *im_a_router);
> diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c 
> b/drivers/staging/lustre/lnet/lnet/api-ni.c
> index 4a14e51..1a0cd57 100644
> --- a/drivers/staging/lustre/lnet/lnet/api-ni.c
> +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c
> @@ -1470,7 +1470,7 @@ LNetCtl(unsigned int cmd, void *arg)
>   id.nid = data->ioc_nid;
>   id.pid = data->ioc_u32[0];
>   rc = lnet_ping(id, data->ioc_u32[1], /* timeout */
> -(lnet_process_id_t *)data->ioc_pbuf1,
> +(lnet_process_id_t __user *)data->ioc_pbuf1,

Why is this marking needed?  If so, something must be wrong as isn't
this variable already __user now due to the other part of this patch?

thanks,

greg k-h
--
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 v4 00/13] staging: lustre: lnet: code cleanups

2015-05-30 Thread Greg KH
A: No.
Q: Should I include quotations after my reply?

http://daringfireball.net/2007/07/on_top

On Sat, May 23, 2015 at 10:05:27AM -0400, Michael Shuey wrote:
> Ah - that explains it.  I added additional files to the series, but
> simply re-applied the original round of patches.  They would've not
> been tagged as v4, while the patches pertaining to the newly-modified
> files had v4 in the subject.

The way you sent these is a mess, I can't sort by subject and apply them
properly.

Either put the v4 at the front, for all patches, like this:
[PATCH v4 01/13]
or at the end of the number:
[PATCH 01/13 v4]
so I can sort them.

Please fix up and resend this series, I've dropped it from my queue.

thanks,

greg k-h
--
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] staging: lustre: osc: clean up whitespace and align function parameters

2015-05-30 Thread Greg KH
On Fri, May 22, 2015 at 02:50:47PM -0400, Chris Hanna wrote:
> Minor changes to remove excessive whitespace and improve
> readability of functions.
> 
> Signed-off-by: Chris Hanna 
> ---
>  drivers/staging/lustre/lustre/osc/lproc_osc.c   |   56 +++---
>  drivers/staging/lustre/lustre/osc/osc_cache.c   |  112 ++--
>  drivers/staging/lustre/lustre/osc/osc_io.c  |  116 +++---
>  drivers/staging/lustre/lustre/osc/osc_lock.c|  134 
>  drivers/staging/lustre/lustre/osc/osc_object.c  |   18 +-
>  drivers/staging/lustre/lustre/osc/osc_page.c|   44 +++---
>  drivers/staging/lustre/lustre/osc/osc_quota.c   |   14 +-
>  drivers/staging/lustre/lustre/osc/osc_request.c |  205 
> +++
>  8 files changed, 349 insertions(+), 350 deletions(-)

Doesn't apply to my tree :(
--
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 2/3 v4] Staging: rtl8192u: Remove two useless lines at ieee80211_wep_null

2015-05-30 Thread Greg KH
On Thu, May 21, 2015 at 02:25:18AM +0200, Pedro Marzo Perez wrote:
> Remove two lines at ieee80211_wep_null which checkpatch.pl reported as errors.
> The first one because it has a C99 comment style and the second one because 
> it is a void
> return which is useless.
> 
> Signed-off-by: Pedro Marzo Perez 
> ---
>  drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c 
> b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c
> index bd789d1..94622cc 100644
> --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c
> +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c
> @@ -279,6 +279,4 @@ void __exit ieee80211_crypto_wep_exit(void)
>  
>  void ieee80211_wep_null(void)
>  {
> -//   printk(">%s()\n", __func__);
> - return;
>  }

Please just delete the function.
--
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] staging: rtl8192u: ieee80211: Fix sparse endianness warnings

2015-05-30 Thread Greg KH
On Tue, May 26, 2015 at 06:47:14PM -0300, Gaston Gonzalez wrote:
> Fix the following sparse warnings:
> 
> drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c:663:32: warning: 
> incorrect type in assignment (different base types)
> drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c:663:32:expected 
> restricted __le16 [usertype] frame_ctl
> drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c:663:32:got int
> drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c:664:50: warning: 
> invalid assignment: |=
> drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c:664:50:left side 
> has type restricted __le16
> drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c:664:50:right side 
> has type int
> 
> 
> Signed-off-by: Gaston Gonzalez 
> ---
>  drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c 
> b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
> index d2e8b12..0477ba1 100644
> --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
> +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
> @@ -660,2 +660,2 @@ inline struct sk_buff 
> *ieee80211_authentication_req(struct ieee80211_network *be
>   auth = (struct ieee80211_authentication *)
>   skb_put(skb, sizeof(struct ieee80211_authentication));
> 
> - auth->header.frame_ctl = IEEE80211_STYPE_AUTH;
> - if (challengelen) auth->header.frame_ctl |= IEEE80211_FCTL_WEP;
> + auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
> + if (challengelen)
> + auth->header.frame_ctl |= cpu_to_le16(IEEE80211_FCTL_WEP);
> 
>   auth->header.duration_id = 0x013a; //FIXME
> 

This patch doesn't apply properly for some reason, can you fix it up and
resend?

thanks,

greg k-h
--
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 2/3 v3] Staging: rtl8192u: Remove two useless lines at ieee80211_wep_null

2015-05-30 Thread Greg KH
On Tue, May 19, 2015 at 01:32:23AM +0200, Pedro Marzo Perez wrote:
> Removed two lines at ieee80211_wep_null which checkpatch.pl reported as 
> errors.
> The first one because it has a C99 comment style and the second one because 
> it is a void
> return which is useless.
> 
> Signed-off-by: Pedro Marzo Perez 
> ---
>  drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c 
> b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c
> index 388ed3c..2ce7b54 100644
> --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c
> +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c
> @@ -289,6 +289,4 @@ void __exit ieee80211_crypto_wep_exit(void)
>  
>  void ieee80211_wep_null(void)
>  {
> -//   printk(">%s()\n", __func__);
> - return;
>  }

You now have a function that does nothing, why not just delete it
entirely?
--
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: FW: [PATCH] Staging: vt6655: Remove unnecessary equality checks in rxtx.c

2015-05-30 Thread gre...@linuxfoundation.org
On Fri, May 29, 2015 at 03:54:27PM +, Harisangam, Sharvari (S.) wrote:
> Modified the if-else statements to remove unnecessary comparisons in rxtx.c.
> This change was detected with the help of coccinelle tool
> 
> Signed-off-by: Harisangam Sharvari 
> ---
>  drivers/staging/vt6655/rxtx.c |8 
>  1 file changed, 4 insertions(+), 4 deletions(-)

Why did you resend this with a forward?

Which one should I take?

I'm going to drop both as I don't know what to do, please resend the one
you wish to have applied.

thanks,

greg k-h
--
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] staging: rtl8192u: Patch to modify if, else conditions

2015-05-30 Thread gre...@linuxfoundation.org
On Tue, May 19, 2015 at 04:55:57PM +, Dhere, Chaitanya (C.) wrote:
> In this patch:
> 1. the if condition is modified to remove
> the unnecessary equality check.
> 2. The else if condition is replaced by an else condition
> since the variable checked in the if statement is a bool
> making the else if unnecessary.
> 3. Fixed indentation problem on line 1369.
> These changes were detected with help of coccinelle tool.

3 different things means you need to send 3 different patches.  Please
only do one logical thing per patch.

thanks,

greg k-h
--
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/3 v3] Staging: rtl8192u: Simplify error check code at prism2_wep_init

2015-05-30 Thread Greg KH
On Tue, May 19, 2015 at 01:32:22AM +0200, Pedro Marzo Perez wrote:
> Merge two pr_debug lines with literal strings splitted across several lines
> into one single line, simplifying prism2_wep_init error check code.
> 
> Signed-off-by: Pedro Marzo Perez 
> ---
>  .../rtl8192u/ieee80211/ieee80211_crypt_wep.c   | 22 
> +-
>  1 file changed, 9 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c 
> b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c
> index 0a17f84..388ed3c 100644
> --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c
> +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c
> @@ -9,6 +9,8 @@
>   * more details.
>   */
>  
> +#define pr_fmt(fmt) "ieee80211_crypt_wep: " fmt

Like Dan said, don't do this in a driver.  It's a driver, you almost
always have access to the device being operated on, so use the dev_*
functions.

This is a network driver, so use the netdev_* functions, which are even
better.  But never the pr_* functions, that's not ok.

Please fix up and resend.

thanks,

greg k-h
--
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] Staging: vt6655: Remove unnecessary equality checks for a bool variable

2015-05-30 Thread gre...@linuxfoundation.org
On Thu, May 28, 2015 at 06:10:26AM +, Harisangam, Sharvari (S.) wrote:
> Modified the if-else statements to remove unnecessary comparisons.
> This change was detected with the help of coccinelle tool
> 
> Signed-off-by: Harisangam Sharvari 

Name doesn't match...


--
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] cpuidle: powernv/pseries: Decrease the snooze residency

2015-05-30 Thread Benjamin Herrenschmidt
On Sat, 2015-05-30 at 11:31 +0530, Vaidyanathan Srinivasan wrote:
> In shared lpar case, spinning in guest context may potentially take
> away cycles from other lpars waiting to run on the same physical cpu.
> 
> So the policy in shared lpar case is to let PowerVM hypervisor know
> immediately that the guest cpu is idle which will allow the hypervisor
> to use the cycles for other tasks/lpars.

But that will have negative side effects under KVM no ?

Suresh mentioned something with his new directed interrupts code that we
had many cases where the interrupts ended up arriving shortly after we
exited to host for NAP'ing ...

Snooze might fix it...

Ben.


--
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: kernel bug(VM_BUG_ON_PAGE) with 3.18.13 in mm/migrate.c

2015-05-30 Thread Jovi Zhangwei
On Thu, May 28, 2015 at 11:38 AM, Jovi Zhangwei  wrote:
> Hi Mel,
>
> On Thu, May 28, 2015 at 5:00 AM, Mel Gorman  wrote:
>> On Wed, May 27, 2015 at 11:05:33AM -0700, Jovi Zhangwei wrote:
>>> Hi,
>>>
>>> I got below kernel bug error in our 3.18.13 stable kernel.
>>> "kernel BUG at mm/migrate.c:1661!"
>>>
>>> Source code:
>>>
>>> 1657static int numamigrate_isolate_page(pg_data_t *pgdat, struct page 
>>> *page)
>>> 1658   {
>>> 1659int page_lru;
>>> 1660
>>> 1661   VM_BUG_ON_PAGE(compound_order(page) &&
>>> !PageTransHuge(page), page);
>>>
>>> It's easy to trigger the error by run tcpdump in our system.(not sure
>>> it will easily be reproduced in another system)
>>> "sudo tcpdump -i bond0.100 'tcp port 4242' -c 1000 -w 4242.pcap"
>>>
>>> Any comments for this bug would be great appreciated. thanks.
>>>
>>
>> What sort of compound page is it? What sort of VMA is it in? hugetlbfs
>> pages should never be tagged for NUMA migrate and never enter this
>> path. Transparent huge pages are handled properly so I'm wondering
>> exactly what type of compound page this is and what mapped it into
>> userspace.
>>
> Thanks for your reply.
>
> After reading net/packet/af_packet.c:alloc_one_pg_vec_page, I found
> there indeed have compound page maped into userspace.
>
> I sent a patch for this issue(you may received it), but not sure it's
> right to fix,
> feel free to update it or use your own patch.
>
ping?
--
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] staging: me_daq: use schedule_timeout_interruptible()

2015-05-30 Thread Greg Kroah-Hartman
On Fri, May 29, 2015 at 06:47:28PM +0200, Nicholas Mc Guire wrote:
> On Fri, 29 May 2015, Ian Abbott wrote:
> 
> > On 29/05/15 16:58, Nicholas Mc Guire wrote:
> >> API consolidation with coccinelle found:
> >> ./drivers/staging/comedi/drivers/me_daq.c:177:1-17:
> >>  consolidation with schedule_timeout_*() recommended
> >>
> >> This is a 1:1 conversion of the current calls to an available helper
> >> only - so only an API consolidation to improve readability.
> >>
> >> Patch was compile tested with x86_64_defconfig + CONFIG_STAGING=y,
> >> CONFIG_COMEDI=y, CONFIG_COMEDI_PCI_DRIVERS=y CONFIG_COMEDI_ME_DAQ=m
> >>
> >> Patch is against 4.1-rc5 (localversion-next is -next-20150529)
> >
> > Minor niggle: you don't really need to say what version the patch is  
> > against in the commit message, as the version will have changed by the  
> > time the patch is committed.  It can be mentioned after the "---" marker  
> > line if relevant, as the stuff after the "---" line does not end up in  
> > the commit message.
> >
> makes sense - will move that down for the other cleanups.

Please fix up and resend so I don't have to hand-edit the patch.

thanks,

greg k-h
--
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] staging: dgnc: use schedule_timeout_interruptible()

2015-05-30 Thread Greg Kroah-Hartman
On Fri, May 29, 2015 at 06:41:27PM +0200, Nicholas Mc Guire wrote:
> API consolidation with coccinelle found:
> ./drivers/staging/dgnc/dgnc_utils.c:16:1-17:
> consolidation with schedule_timeout_*() recommended
> 
> This is a 1:1 conversion with respect to schedule_timeout() to the
> schedule_timeout_interruptible() helper only - so only an API
> consolidation to improve readability. The timeout was being passed
> as (ms * HZ) / 1000 but that is not reliable as it allows the timeout
> to become 0 for small values of ms. As this cut-off is HZ dependent
> this is most likely not intended, so the timeout is converted with 
> msecs_to_jiffies which handles all corener-cases correctly.
> 
> Patch was compile tested with x86_64_defconfig + CONFIG_STAGING=y,
> CONFIG_DGNC=m
> 
> Patch is against 4.1-rc5 (localversion-next is -next-20150529)

Can you resend this without these two sentances?  They are not needed
and are just "implied" as you should have done this for every patch
submitted.

thanks,

greg k-h
--
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] staging: unisys: use schedule_timeout_interruptible()

2015-05-30 Thread Greg Kroah-Hartman
On Fri, May 29, 2015 at 05:31:16PM +0200, Nicholas Mc Guire wrote:
> API consolidation with coccinelle found:
> ./drivers/staging/unisys/visorbus/periodic_work.c:196:3-19:
> consolidation with schedule_timeout_*() recommended
> 
> This is a 1:1 conversion with respect to schedule_timeout() to the 
> schedule_timeout_interruptible() helper only - so only an API 
> consolidation to improve readability. The hard coded timeout of 10
> jiffies is HZ dependent which it should not be, so it is converted
> with msecs_to_jiffies.
> 
> Patch was compile tested with x86_64_defconfig + CONFIG_STAGING=y,
> CONFIG_UNISYSSPAR=y, CONFIG_UNISYS_VISORBUS=m
> 
> Patch is against 4.1-rc5 (localversion-next is -next-20150529)
> 
> Signed-off-by: Nicholas Mc Guire 
> ---
> 
> As the actually intended timeout is not documented and msecs_to_jiffies
> timeouts can be a factor 10 different from the current effective timeout
> this needs to be checked by someone who knows the details of this driver
> in any case it should be passed in a HZ independent manner.

I need an ack from the maintainers before I can take this.

thanks,

greg k-h
--
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] staging: wlan-ng: fix long line

2015-05-30 Thread Greg Kroah-Hartman
On Tue, May 19, 2015 at 01:13:42PM -0300, Douglas Barbonaglia Sathler 
Figueiredo wrote:
> Style (line over 80 chars) in drivers/staging/wlan-ng/prism2fw.c
> 
> Signed-off-by: Douglas Barbonaglia Sathler Figueiredo 
> 
> ---
>  drivers/staging/wlan-ng/prism2fw.c | 8 ++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/wlan-ng/prism2fw.c 
> b/drivers/staging/wlan-ng/prism2fw.c
> index 9408644..f4525f8 100644
> --- a/drivers/staging/wlan-ng/prism2fw.c
> +++ b/drivers/staging/wlan-ng/prism2fw.c
> @@ -708,7 +708,10 @@ static int plugimage(struct imgchunk *fchunk, unsigned 
> int nfchunks,
>   continue;
>   }
>  
> - /* Validate plug address against chunk data and identify chunk 
> */
> + /*
> +  * Validate plug address against
> +  * chunk data and identify chunk
> +  */
>   for (c = 0; c < nfchunks; c++) {
>   cstart = fchunk[c].addr;
>   cend = fchunk[c].addr + fchunk[c].len;
> @@ -923,7 +926,8 @@ static int read_fwfile(const struct ihex_binrec *record)
> rcnt,
> s3info[ns3info].len,
> s3info[ns3info].type);
> - if (((s3info[ns3info].len - 1) * sizeof(u16)) > 
> sizeof(s3info[ns3info].info)) {
> + if (((s3info[ns3info].len - 1) * sizeof(u16)) >
> + sizeof(s3info[ns3info].info)) {

Align this under the ( so it doesn't look like it's the logic in the
next block.

thanks,

greg k-h
--
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/


[RFC 17/24] powerpc, fbdev: Use arch_nvram_ops methods instead of nvram_read_byte() and nvram_write_byte()

2015-05-30 Thread Finn Thain
Make use of arch_nvram_ops in device drivers so that the nvram_*
function exports can be removed.

Since they are no longer global symbols, rename the PPC32 nvram_* functions
appropriately.

Add the missing CONFIG_NVRAM test to imsttfb to avoid a build failure.

Signed-off-by: Finn Thain 

---
 arch/powerpc/kernel/setup_32.c |8 
 drivers/char/generic_nvram.c   |4 ++--
 drivers/video/fbdev/controlfb.c|4 ++--
 drivers/video/fbdev/imsttfb.c  |7 +++
 drivers/video/fbdev/matrox/matroxfb_base.c |2 +-
 drivers/video/fbdev/platinumfb.c   |4 ++--
 drivers/video/fbdev/valkyriefb.c   |4 ++--
 7 files changed, 16 insertions(+), 17 deletions(-)

Index: linux/arch/powerpc/kernel/setup_32.c
===
--- linux.orig/arch/powerpc/kernel/setup_32.c   2015-05-31 11:01:17.0 
+1000
+++ linux/arch/powerpc/kernel/setup_32.c2015-05-31 11:01:19.0 
+1000
@@ -170,20 +170,18 @@ __setup("l3cr=", ppc_setup_l3cr);
 
 #ifdef CONFIG_GENERIC_NVRAM
 
-unsigned char nvram_read_byte(int addr)
+static unsigned char ppc_nvram_read_byte(int addr)
 {
if (ppc_md.nvram_read_val)
return ppc_md.nvram_read_val(addr);
return 0xff;
 }
-EXPORT_SYMBOL(nvram_read_byte);
 
-void nvram_write_byte(unsigned char val, int addr)
+static void ppc_nvram_write_byte(unsigned char val, int addr)
 {
if (ppc_md.nvram_write_val)
ppc_md.nvram_write_val(addr, val);
 }
-EXPORT_SYMBOL(nvram_write_byte);
 
 static ssize_t ppc_nvram_get_size(void)
 {
@@ -200,6 +198,8 @@ static long ppc_nvram_sync(void)
 }
 
 const struct nvram_ops arch_nvram_ops = {
+   .read_byte  = ppc_nvram_read_byte,
+   .write_byte = ppc_nvram_write_byte,
.get_size   = ppc_nvram_get_size,
.sync   = ppc_nvram_sync,
 };
Index: linux/drivers/char/generic_nvram.c
===
--- linux.orig/drivers/char/generic_nvram.c 2015-05-31 11:01:17.0 
+1000
+++ linux/drivers/char/generic_nvram.c  2015-05-31 11:01:19.0 +1000
@@ -64,7 +64,7 @@ static ssize_t read_nvram(struct file *f
if (*ppos >= nvram_len)
return 0;
for (i = *ppos; count > 0 && i < nvram_len; ++i, ++p, --count)
-   if (__put_user(nvram_read_byte(i), p))
+   if (__put_user(arch_nvram_ops.read_byte(i), p))
return -EFAULT;
*ppos = i;
return p - buf;
@@ -84,7 +84,7 @@ static ssize_t write_nvram(struct file *
for (i = *ppos; count > 0 && i < nvram_len; ++i, ++p, --count) {
if (__get_user(c, p))
return -EFAULT;
-   nvram_write_byte(c, i);
+   arch_nvram_ops.write_byte(c, i);
}
*ppos = i;
return p - buf;
Index: linux/drivers/video/fbdev/controlfb.c
===
--- linux.orig/drivers/video/fbdev/controlfb.c  2015-05-31 11:00:59.0 
+1000
+++ linux/drivers/video/fbdev/controlfb.c   2015-05-31 11:01:19.0 
+1000
@@ -415,7 +415,7 @@ static int __init init_control(struct fb
/* Try to pick a video mode out of NVRAM if we have one. */
 #ifdef CONFIG_NVRAM
if (default_cmode == CMODE_NVRAM) {
-   cmode = nvram_read_byte(NV_CMODE);
+   cmode = arch_nvram_ops.read_byte(NV_CMODE);
if(cmode < CMODE_8 || cmode > CMODE_32)
cmode = CMODE_8;
} else
@@ -423,7 +423,7 @@ static int __init init_control(struct fb
cmode=default_cmode;
 #ifdef CONFIG_NVRAM
if (default_vmode == VMODE_NVRAM) {
-   vmode = nvram_read_byte(NV_VMODE);
+   vmode = arch_nvram_ops.read_byte(NV_VMODE);
if (vmode < 1 || vmode > VMODE_MAX ||
control_mac_modes[vmode - 1].m[full] < cmode) {
sense = read_control_sense(p);
Index: linux/drivers/video/fbdev/matrox/matroxfb_base.c
===
--- linux.orig/drivers/video/fbdev/matrox/matroxfb_base.c   2015-05-31 
11:01:13.0 +1000
+++ linux/drivers/video/fbdev/matrox/matroxfb_base.c2015-05-31 
11:01:19.0 +1000
@@ -1888,7 +1888,7 @@ static int initMatrox2(struct matrox_fb_
default_vmode = VMODE_640_480_60;
 #ifdef CONFIG_NVRAM
if (default_cmode == CMODE_NVRAM)
-   default_cmode = nvram_read_byte(NV_CMODE);
+   default_cmode = arch_nvram_ops.read_byte(NV_CMODE);
 #endif
if (default_cmode < CMODE_8 || default_cmode > CMODE_32)
default_cmode = CMODE_8;
Index: linux/drivers/video/fbdev/platinumfb.c
===
--- 

[RFC 06/24] char/nvram: Adopt arch_nvram_ops

2015-05-30 Thread Finn Thain
Different platforms and architectures offer different NVRAM sizes and
access methods. E.g. PPC32 has byte-at-a-time read/write functions whereas
PPC64 has byte-range read/write functions. Adopt the nvram_ops struct so
the nvram module can call such functions as are defined by the various 
platforms and architectures.

Signed-off-by: Finn Thain 

---

The #ifdefs here restrict the procfs and checksumming code to those
architectures with PC-style RTC NVRAM. There may be a better place for
that code but it's an open question. See https://lkml.org/lkml/2015/2/3/22

The procfs code here, if irrelevant to ARM platforms, could be moved to
arch/x86 (like the earlier patch does for m68k code) and the nvram ops
could implemented and exported by the rtc-cmos driver instead. This
would eliminate these #ifdefs.

---
 drivers/char/nvram.c  |   30 +++---
 include/linux/nvram.h |2 ++
 2 files changed, 29 insertions(+), 3 deletions(-)

Index: linux/drivers/char/nvram.c
===
--- linux.orig/drivers/char/nvram.c 2015-05-31 11:01:05.0 +1000
+++ linux/drivers/char/nvram.c  2015-05-31 11:01:06.0 +1000
@@ -51,9 +51,12 @@ static DEFINE_MUTEX(nvram_mutex);
 static DEFINE_SPINLOCK(nvram_state_lock);
 static int nvram_open_cnt; /* #times opened */
 static int nvram_open_mode;/* special open modes */
+static ssize_t nvram_size;
 #define NVRAM_WRITE1 /* opened for writing (exclusive) */
 #define NVRAM_EXCL 2 /* opened with O_EXCL */
 
+#if defined(CONFIG_X86) || defined(CONFIG_ARM)
+
 /*
  * These functions are provided to be called internally or by other parts of
  * the kernel. It's up to the caller to ensure correct checksum before reading
@@ -161,6 +164,20 @@ void nvram_set_checksum(void)
 }
 #endif  /*  0  */
 
+static ssize_t nvram_get_size(void)
+{
+   return NVRAM_BYTES;
+}
+
+const struct nvram_ops arch_nvram_ops = {
+   .read_byte  = nvram_read_byte,
+   .write_byte = nvram_write_byte,
+   .get_size   = nvram_get_size,
+};
+EXPORT_SYMBOL(arch_nvram_ops);
+
+#endif /* CONFIG_X86 || CONFIG_ARM */
+
 /*
  * The are the file operation function for user access to /dev/nvram
  */
@@ -332,7 +349,7 @@ static int nvram_misc_release(struct ino
return 0;
 }
 
-#ifdef CONFIG_PROC_FS
+#if defined(CONFIG_PROC_FS) && (defined(CONFIG_X86) || defined(CONFIG_ARM))
 
 static char *floppy_types[] = {
"none", "5.25'' 360k", "5.25'' 1.2M", "3.5'' 720k", "3.5'' 1.44M",
@@ -459,13 +476,20 @@ static int __init nvram_module_init(void
 {
int ret;
 
+   if (arch_nvram_ops.get_size == NULL)
+   return -ENODEV;
+
+   nvram_size = arch_nvram_ops.get_size();
+   if (nvram_size < 0)
+   return nvram_size;
+
ret = misc_register(_misc);
if (ret) {
pr_err("nvram: can't misc_register on minor=%d\n", NVRAM_MINOR);
return ret;
}
 
-#ifdef CONFIG_PROC_FS
+#if defined(CONFIG_PROC_FS) && (defined(CONFIG_X86) || defined(CONFIG_ARM))
if (!proc_create("driver/nvram", 0, NULL, _proc_fops)) {
pr_err("nvram: can't create /proc/driver/nvram\n");
misc_deregister(_misc);
@@ -479,7 +503,7 @@ static int __init nvram_module_init(void
 
 static void __exit nvram_module_exit(void)
 {
-#ifdef CONFIG_PROC_FS
+#if defined(CONFIG_PROC_FS) && (defined(CONFIG_X86) || defined(CONFIG_ARM))
remove_proc_entry("driver/nvram", NULL);
 #endif
misc_deregister(_misc);
Index: linux/include/linux/nvram.h
===
--- linux.orig/include/linux/nvram.h2015-05-31 11:01:03.0 +1000
+++ linux/include/linux/nvram.h 2015-05-31 11:01:06.0 +1000
@@ -14,6 +14,8 @@ extern int nvram_check_checksum(void);
 struct nvram_ops {
ssize_t (*read)(char *, size_t, loff_t *);
ssize_t (*write)(char *, size_t, loff_t *);
+   unsigned char   (*read_byte)(int);
+   void(*write_byte)(unsigned char, int);
ssize_t (*get_size)(void);
 };
 


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


[RFC 15/24] powerpc: Implement arch_nvram_ops.get_size() and remove old nvram_* exports

2015-05-30 Thread Finn Thain
Implement arch_nvram_ops for PPC32 and make use of it in the generic_nvram
misc device module so that the nvram_* function exports can be removed.

Signed-off-by: Finn Thain 

---
 arch/powerpc/include/asm/nvram.h |3 ---
 arch/powerpc/kernel/setup_32.c   |   10 +++---
 drivers/char/generic_nvram.c |   24 
 3 files changed, 19 insertions(+), 18 deletions(-)

Index: linux/arch/powerpc/include/asm/nvram.h
===
--- linux.orig/arch/powerpc/include/asm/nvram.h 2015-05-31 11:01:13.0 
+1000
+++ linux/arch/powerpc/include/asm/nvram.h  2015-05-31 11:01:16.0 
+1000
@@ -98,7 +98,4 @@ extern int nvram_write_os_partition(stru
unsigned int err_type,
unsigned int error_log_cnt);
 
-/* Determine NVRAM size */
-extern ssize_t nvram_get_size(void);
-
 #endif /* _ASM_POWERPC_NVRAM_H */
Index: linux/arch/powerpc/kernel/setup_32.c
===
--- linux.orig/arch/powerpc/kernel/setup_32.c   2015-05-31 11:01:13.0 
+1000
+++ linux/arch/powerpc/kernel/setup_32.c2015-05-31 11:01:16.0 
+1000
@@ -186,13 +186,12 @@ void nvram_write_byte(unsigned char val,
 }
 EXPORT_SYMBOL(nvram_write_byte);
 
-ssize_t nvram_get_size(void)
+static ssize_t ppc_nvram_get_size(void)
 {
if (ppc_md.nvram_size)
return ppc_md.nvram_size();
-   return -1;
+   return -ENODEV;
 }
-EXPORT_SYMBOL(nvram_get_size);
 
 void nvram_sync(void)
 {
@@ -201,6 +200,11 @@ void nvram_sync(void)
 }
 EXPORT_SYMBOL(nvram_sync);
 
+const struct nvram_ops arch_nvram_ops = {
+   .get_size   = ppc_nvram_get_size,
+};
+EXPORT_SYMBOL(arch_nvram_ops);
+
 #endif /* CONFIG_NVRAM */
 
 int __init ppc_init(void)
Index: linux/drivers/char/generic_nvram.c
===
--- linux.orig/drivers/char/generic_nvram.c 2015-05-31 11:01:13.0 
+1000
+++ linux/drivers/char/generic_nvram.c  2015-05-31 11:01:16.0 +1000
@@ -28,8 +28,6 @@
 #include 
 #endif
 
-#define NVRAM_SIZE 8192
-
 static DEFINE_MUTEX(nvram_mutex);
 static ssize_t nvram_len;
 
@@ -150,20 +148,22 @@ static struct miscdevice nvram_dev = {
 
 int __init nvram_init(void)
 {
-   int ret = 0;
+   int ret;
 
-   printk(KERN_INFO "Generic non-volatile memory driver v%s\n",
-   NVRAM_VERSION);
-   ret = misc_register(_dev);
-   if (ret != 0)
-   goto out;
+   if (arch_nvram_ops.get_size == NULL)
+   return -ENODEV;
 
-   nvram_len = nvram_get_size();
+   nvram_len = arch_nvram_ops.get_size();
if (nvram_len < 0)
-   nvram_len = NVRAM_SIZE;
+   return nvram_len;
 
-out:
-   return ret;
+   ret = misc_register(_dev);
+   if (ret)
+   return ret;
+
+   pr_info("Generic non-volatile memory driver v%s\n", NVRAM_VERSION);
+
+   return 0;
 }
 
 void __exit nvram_cleanup(void)


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


[RFC 24/24] m68k: Dispatch nvram_ops calls to Atari or Mac functions

2015-05-30 Thread Finn Thain
A multi-platform kernel binary needs to decide at run-time how to dispatch
the arch_nvram_ops calls. Add platform-independent arch_nvram_ops, for use
when multiple platform-specific NVRAM ops implementations are needed.

Signed-off-by: Finn Thain 

---
 arch/m68k/Kconfig |2 
 arch/m68k/atari/nvram.c   |   22 +
 arch/m68k/include/asm/atarihw.h   |6 ++
 arch/m68k/include/asm/macintosh.h |4 +
 arch/m68k/kernel/setup_mm.c   |   89 ++
 arch/m68k/mac/misc.c  |8 ++-
 6 files changed, 117 insertions(+), 14 deletions(-)

Index: linux/arch/m68k/atari/nvram.c
===
--- linux.orig/arch/m68k/atari/nvram.c  2015-05-31 11:01:21.0 +1000
+++ linux/arch/m68k/atari/nvram.c   2015-05-31 11:01:29.0 +1000
@@ -73,7 +73,7 @@ static void __nvram_set_checksum(void)
__nvram_write_byte(sum, ATARI_CKS_LOC + 1);
 }
 
-static long nvram_set_checksum(void)
+long atari_nvram_set_checksum(void)
 {
spin_lock_irq(_lock);
__nvram_set_checksum();
@@ -81,7 +81,7 @@ static long nvram_set_checksum(void)
return 0;
 }
 
-static long nvram_initialize(void)
+long atari_nvram_initialize(void)
 {
loff_t i;
 
@@ -93,7 +93,7 @@ static long nvram_initialize(void)
return 0;
 }
 
-static ssize_t nvram_read(char *buf, size_t count, loff_t *ppos)
+ssize_t atari_nvram_read(char *buf, size_t count, loff_t *ppos)
 {
char *p = buf;
loff_t i;
@@ -114,7 +114,7 @@ static ssize_t nvram_read(char *buf, siz
return p - buf;
 }
 
-static ssize_t nvram_write(char *buf, size_t count, loff_t *ppos)
+ssize_t atari_nvram_write(char *buf, size_t count, loff_t *ppos)
 {
char *p = buf;
loff_t i;
@@ -137,21 +137,23 @@ static ssize_t nvram_write(char *buf, si
return p - buf;
 }
 
-static ssize_t nvram_get_size(void)
+ssize_t atari_nvram_get_size(void)
 {
if (!MACH_IS_ATARI)
return -ENODEV;
return NVRAM_BYTES;
 }
 
+#ifndef CONFIG_MAC
 const struct nvram_ops arch_nvram_ops = {
-   .read   = nvram_read,
-   .write  = nvram_write,
-   .get_size   = nvram_get_size,
-   .set_checksum   = nvram_set_checksum,
-   .initialize = nvram_initialize,
+   .read   = atari_nvram_read,
+   .write  = atari_nvram_write,
+   .get_size   = atari_nvram_get_size,
+   .set_checksum   = atari_nvram_set_checksum,
+   .initialize = atari_nvram_initialize,
 };
 EXPORT_SYMBOL(arch_nvram_ops);
+#endif
 
 #ifdef CONFIG_PROC_FS
 static struct {
Index: linux/arch/m68k/mac/misc.c
===
--- linux.orig/arch/m68k/mac/misc.c 2015-05-31 11:01:28.0 +1000
+++ linux/arch/m68k/mac/misc.c  2015-05-31 11:01:29.0 +1000
@@ -489,7 +489,7 @@ void pmu_shutdown(void)
  */
 
 #if IS_ENABLED(CONFIG_NVRAM)
-static unsigned char mac_pram_read_byte(int addr)
+unsigned char mac_pram_read_byte(int addr)
 {
unsigned char (*func)(int);
 
@@ -513,7 +513,7 @@ static unsigned char mac_pram_read_byte(
return 0xff;
 }
 
-static void mac_pram_write_byte(unsigned char val, int addr)
+void mac_pram_write_byte(unsigned char val, int addr)
 {
void (*func)(unsigned char, int);
 
@@ -536,19 +536,21 @@ static void mac_pram_write_byte(unsigned
(*func)(val, addr);
 }
 
-static ssize_t mac_pram_get_size(void)
+ssize_t mac_pram_get_size(void)
 {
if (!MACH_IS_MAC)
return -ENODEV;
return 256;
 }
 
+#ifndef CONFIG_ATARI
 const struct nvram_ops arch_nvram_ops = {
.read_byte  = mac_pram_read_byte,
.write_byte = mac_pram_write_byte,
.get_size   = mac_pram_get_size,
 };
 EXPORT_SYMBOL(arch_nvram_ops);
+#endif
 #endif /* CONFIG_NVRAM */
 
 
Index: linux/arch/m68k/kernel/setup_mm.c
===
--- linux.orig/arch/m68k/kernel/setup_mm.c  2015-05-31 11:00:59.0 
+1000
+++ linux/arch/m68k/kernel/setup_mm.c   2015-05-31 11:01:29.0 +1000
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -40,6 +41,9 @@
 #include 
 #include 
 #endif
+#ifdef CONFIG_MAC
+#include 
+#endif
 #ifdef CONFIG_SUN3X
 #include 
 #endif
@@ -568,3 +572,88 @@ static int __init adb_probe_sync_enable
 
 __setup("adb_sync", adb_probe_sync_enable);
 #endif /* CONFIG_ADB */
+
+#if IS_ENABLED(CONFIG_NVRAM) && defined(CONFIG_ATARI) && defined(CONFIG_MAC)
+static ssize_t m68k_nvram_read(char *buf, size_t count, loff_t *ppos)
+{
+   if (MACH_IS_ATARI)
+   return atari_nvram_read(buf, count, ppos);
+   else if (MACH_IS_MAC) {
+   ssize_t size = mac_pram_get_size();
+   char *p = buf;
+   loff_t i;
+
+   for (i = *ppos; count > 0 && i < size; --count, ++i, 

[RFC 04/24] m68k/atari: Replace nvram_{read,write}_byte with arch_nvram_ops

2015-05-30 Thread Finn Thain
By implementing an arch_nvram_ops struct, any platform can re-use the
drivers/char/nvram module without needing any arch-specific code
in that module. Atari does so here.

Atari has one user of nvram_check_checksum() whereas the other platforms
(i.e. x86 and ARM platforms) have none at all. Replace this
validate-checksum-and-read-byte sequence with the equivalent
rtc_nvram_ops.read() call and remove the now unused functions.

Signed-off-by: Finn Thain 

---

The advantage of the new ops struct over the old global nvram_* functions
is that the misc device module can be shared by different platforms
without requiring every platform to implement every nvram_* function.
E.g. only RTC "CMOS" NVRAMs have a checksum and only PowerPC platforms
have a "sync" ioctl.

---
 arch/m68k/atari/nvram.c   |   89 --
 drivers/scsi/atari_scsi.c |8 ++--
 include/linux/nvram.h |9 
 3 files changed, 70 insertions(+), 36 deletions(-)

Index: linux/arch/m68k/atari/nvram.c
===
--- linux.orig/arch/m68k/atari/nvram.c  2015-05-31 11:01:01.0 +1000
+++ linux/arch/m68k/atari/nvram.c   2015-05-31 11:01:03.0 +1000
@@ -38,33 +38,12 @@ unsigned char __nvram_read_byte(int i)
return CMOS_READ(NVRAM_FIRST_BYTE + i);
 }
 
-unsigned char nvram_read_byte(int i)
-{
-   unsigned long flags;
-   unsigned char c;
-
-   spin_lock_irqsave(_lock, flags);
-   c = __nvram_read_byte(i);
-   spin_unlock_irqrestore(_lock, flags);
-   return c;
-}
-EXPORT_SYMBOL(nvram_read_byte);
-
 /* This races nicely with trying to read with checksum checking */
 void __nvram_write_byte(unsigned char c, int i)
 {
CMOS_WRITE(c, NVRAM_FIRST_BYTE + i);
 }
 
-void nvram_write_byte(unsigned char c, int i)
-{
-   unsigned long flags;
-
-   spin_lock_irqsave(_lock, flags);
-   __nvram_write_byte(c, i);
-   spin_unlock_irqrestore(_lock, flags);
-}
-
 /* On Ataris, the checksum is over all bytes except the checksum bytes
  * themselves; these are at the very end.
  */
@@ -83,18 +62,6 @@ int __nvram_check_checksum(void)
   (__nvram_read_byte(ATARI_CKS_LOC + 1) == (sum & 0xff));
 }
 
-int nvram_check_checksum(void)
-{
-   unsigned long flags;
-   int rv;
-
-   spin_lock_irqsave(_lock, flags);
-   rv = __nvram_check_checksum();
-   spin_unlock_irqrestore(_lock, flags);
-   return rv;
-}
-EXPORT_SYMBOL(nvram_check_checksum);
-
 static void __nvram_set_checksum(void)
 {
int i;
@@ -106,6 +73,62 @@ static void __nvram_set_checksum(void)
__nvram_write_byte(sum, ATARI_CKS_LOC + 1);
 }
 
+static ssize_t nvram_read(char *buf, size_t count, loff_t *ppos)
+{
+   char *p = buf;
+   loff_t i;
+
+   spin_lock_irq(_lock);
+
+   if (!__nvram_check_checksum()) {
+   spin_unlock_irq(_lock);
+   return -EIO;
+   }
+
+   for (i = *ppos; count > 0 && i < NVRAM_BYTES; --count, ++i, ++p)
+   *p = __nvram_read_byte(i);
+
+   spin_unlock_irq(_lock);
+
+   *ppos = i;
+   return p - buf;
+}
+
+static ssize_t nvram_write(char *buf, size_t count, loff_t *ppos)
+{
+   char *p = buf;
+   loff_t i;
+
+   spin_lock_irq(_lock);
+
+   if (!__nvram_check_checksum()) {
+   spin_unlock_irq(_lock);
+   return -EIO;
+   }
+
+   for (i = *ppos; count > 0 && i < NVRAM_BYTES; --count, ++i, ++p)
+   __nvram_write_byte(*p, i);
+
+   __nvram_set_checksum();
+
+   spin_unlock_irq(_lock);
+
+   *ppos = i;
+   return p - buf;
+}
+
+static ssize_t nvram_get_size(void)
+{
+   return NVRAM_BYTES;
+}
+
+const struct nvram_ops arch_nvram_ops = {
+   .read   = nvram_read,
+   .write  = nvram_write,
+   .get_size   = nvram_get_size,
+};
+EXPORT_SYMBOL(arch_nvram_ops);
+
 #ifdef CONFIG_PROC_FS
 static struct {
unsigned char val;
Index: linux/drivers/scsi/atari_scsi.c
===
--- linux.orig/drivers/scsi/atari_scsi.c2015-05-31 11:01:00.0 
+1000
+++ linux/drivers/scsi/atari_scsi.c 2015-05-31 11:01:03.0 +1000
@@ -880,13 +880,15 @@ static int __init atari_scsi_probe(struc
 #ifdef CONFIG_NVRAM
else
/* Test if a host id is set in the NVRam */
-   if (ATARIHW_PRESENT(TT_CLK) && nvram_check_checksum()) {
-   unsigned char b = nvram_read_byte(14);
+   if (ATARIHW_PRESENT(TT_CLK)) {
+   unsigned char b;
+   loff_t offset = 14;
+   ssize_t count = arch_nvram_ops.read(, 1, );
 
/* Arbitration enabled? (for TOS)
 * If yes, use configured host ID
 */
-   if (b & 0x80)
+   if ((count == 1) && (b & 

[RFC 13/24] powerpc: Cleanup nvram includes

2015-05-30 Thread Finn Thain
The nvram_read_byte() and nvram_write_byte() definitions in asm/nvram.h
duplicate those in linux/nvram.h. Get rid of the former to prepare for
adoption of struct arch_nvram_ops (which is defined in linux/nvram.h for
general use).

Signed-off-by: Finn Thain 

---
 arch/powerpc/include/asm/nvram.h   |3 ---
 arch/powerpc/kernel/setup_32.c |1 +
 drivers/char/generic_nvram.c   |4 +++-
 drivers/video/fbdev/matrox/matroxfb_base.c |2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

Index: linux/arch/powerpc/include/asm/nvram.h
===
--- linux.orig/arch/powerpc/include/asm/nvram.h 2015-05-31 11:00:59.0 
+1000
+++ linux/arch/powerpc/include/asm/nvram.h  2015-05-31 11:01:13.0 
+1000
@@ -101,7 +101,4 @@ extern int nvram_write_os_partition(stru
 /* Determine NVRAM size */
 extern ssize_t nvram_get_size(void);
 
-/* Normal access to NVRAM */
-extern unsigned char nvram_read_byte(int i);
-extern void nvram_write_byte(unsigned char c, int i);
 #endif /* _ASM_POWERPC_NVRAM_H */
Index: linux/arch/powerpc/kernel/setup_32.c
===
--- linux.orig/arch/powerpc/kernel/setup_32.c   2015-05-31 11:00:59.0 
+1000
+++ linux/arch/powerpc/kernel/setup_32.c2015-05-31 11:01:13.0 
+1000
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
Index: linux/drivers/char/generic_nvram.c
===
--- linux.orig/drivers/char/generic_nvram.c 2015-05-31 11:00:59.0 
+1000
+++ linux/drivers/char/generic_nvram.c  2015-05-31 11:01:13.0 +1000
@@ -20,9 +20,11 @@
 #include 
 #include 
 #include 
+#include 
 #include 
-#include 
+
 #ifdef CONFIG_PPC_PMAC
+#include 
 #include 
 #endif
 
Index: linux/drivers/video/fbdev/matrox/matroxfb_base.c
===
--- linux.orig/drivers/video/fbdev/matrox/matroxfb_base.c   2015-05-31 
11:00:59.0 +1000
+++ linux/drivers/video/fbdev/matrox/matroxfb_base.c2015-05-31 
11:01:13.0 +1000
@@ -111,12 +111,12 @@
 #include "matroxfb_g450.h"
 #include 
 #include 
+#include 
 #include 
 #include 
 
 #ifdef CONFIG_PPC_PMAC
 #include 
-unsigned char nvram_read_byte(int);
 static int default_vmode = VMODE_NVRAM;
 static int default_cmode = CMODE_NVRAM;
 #endif


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


[RFC 08/24] char/nvram: Allow the set_checksum and initialize ioctls to be omitted

2015-05-30 Thread Finn Thain
The drivers/char/nvram module has previously only supported RTC "CMOS"
NVRAM, for which it provides appropriate checksum ioctls. Make these
ioctls optional so the module can be re-used with other kinds of NVRAM.

The ops struct methods that implement the ioctls now return error
codes so that a multi-platform kernel binary can do the right thing when
running on hardware without suitable NVRAM.

Signed-off-by: Finn Thain 

---
 drivers/char/nvram.c  |   61 --
 include/linux/nvram.h |2 +
 2 files changed, 37 insertions(+), 26 deletions(-)

Index: linux/drivers/char/nvram.c
===
--- linux.orig/drivers/char/nvram.c 2015-05-31 11:01:06.0 +1000
+++ linux/drivers/char/nvram.c  2015-05-31 11:01:08.0 +1000
@@ -153,16 +153,25 @@ static void __nvram_set_checksum(void)
__nvram_write_byte(sum & 0xff, PC_CKS_LOC + 1);
 }
 
-#if 0
-void nvram_set_checksum(void)
+static long nvram_set_checksum(void)
 {
-   unsigned long flags;
+   spin_lock_irq(_lock);
+   __nvram_set_checksum();
+   spin_unlock_irq(_lock);
+   return 0;
+}
+
+static long nvram_initialize(void)
+{
+   ssize_t i;
 
-   spin_lock_irqsave(_lock, flags);
+   spin_lock_irq(_lock);
+   for (i = 0; i < NVRAM_BYTES; ++i)
+   __nvram_write_byte(0, i);
__nvram_set_checksum();
-   spin_unlock_irqrestore(_lock, flags);
+   spin_unlock_irq(_lock);
+   return 0;
 }
-#endif  /*  0  */
 
 static ssize_t nvram_get_size(void)
 {
@@ -173,6 +182,8 @@ const struct nvram_ops arch_nvram_ops =
.read_byte  = nvram_read_byte,
.write_byte = nvram_write_byte,
.get_size   = nvram_get_size,
+   .set_checksum   = nvram_set_checksum,
+   .initialize = nvram_initialize,
 };
 EXPORT_SYMBOL(arch_nvram_ops);
 
@@ -272,26 +283,19 @@ checksum_err:
 static long nvram_misc_ioctl(struct file *file, unsigned int cmd,
  unsigned long arg)
 {
-   int i;
+   long ret = -ENOTTY;
 
switch (cmd) {
-
case NVRAM_INIT:
/* initialize NVRAM contents and checksum */
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
 
mutex_lock(_mutex);
-   spin_lock_irq(_lock);
-
-   for (i = 0; i < NVRAM_BYTES; ++i)
-   __nvram_write_byte(0, i);
-   __nvram_set_checksum();
-
-   spin_unlock_irq(_lock);
+   if (arch_nvram_ops.initialize != NULL)
+   ret = arch_nvram_ops.initialize();
mutex_unlock(_mutex);
-   return 0;
-
+   break;
case NVRAM_SETCKS:
/* just set checksum, contents unchanged (maybe useful after
 * checksum garbaged somehow...) */
@@ -299,24 +303,29 @@ static long nvram_misc_ioctl(struct file
return -EACCES;
 
mutex_lock(_mutex);
-   spin_lock_irq(_lock);
-   __nvram_set_checksum();
-   spin_unlock_irq(_lock);
+   if (arch_nvram_ops.set_checksum != NULL)
+   ret = arch_nvram_ops.set_checksum();
mutex_unlock(_mutex);
-   return 0;
-
-   default:
-   return -ENOTTY;
+   break;
}
+   return ret;
 }
 
 static int nvram_misc_open(struct inode *inode, struct file *file)
 {
spin_lock(_state_lock);
 
+   /* Prevent multiple readers/writers if desired. */
if ((nvram_open_cnt && (file->f_flags & O_EXCL)) ||
-   (nvram_open_mode & NVRAM_EXCL) ||
-   ((file->f_mode & FMODE_WRITE) && (nvram_open_mode & NVRAM_WRITE))) {
+   (nvram_open_mode & NVRAM_EXCL)) {
+   spin_unlock(_state_lock);
+   return -EBUSY;
+   }
+
+   /* Prevent multiple writers if the set_checksum ioctl is implemented. */
+   if ((arch_nvram_ops.set_checksum != NULL) &&
+   (file->f_mode & FMODE_WRITE) &&
+   (nvram_open_mode & NVRAM_WRITE)) {
spin_unlock(_state_lock);
return -EBUSY;
}
Index: linux/include/linux/nvram.h
===
--- linux.orig/include/linux/nvram.h2015-05-31 11:01:06.0 +1000
+++ linux/include/linux/nvram.h 2015-05-31 11:01:08.0 +1000
@@ -17,6 +17,8 @@ struct nvram_ops {
unsigned char   (*read_byte)(int);
void(*write_byte)(unsigned char, int);
ssize_t (*get_size)(void);
+   long(*set_checksum)(void);
+   long(*initialize)(void);
 };
 
 extern const struct nvram_ops arch_nvram_ops;


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

[RFC 01/24] macintosh/nvram: Remove as unused

2015-05-30 Thread Finn Thain
Signed-off-by: Finn Thain 

---
 drivers/macintosh/nvram.c |  130 --
 1 file changed, 130 deletions(-)

Index: linux/drivers/macintosh/nvram.c
===
--- linux.orig/drivers/macintosh/nvram.c2015-05-31 11:00:59.0 
+1000
+++ /dev/null   1970-01-01 00:00:00.0 +
@@ -1,130 +0,0 @@
-/*
- * /dev/nvram driver for Power Macintosh.
- */
-
-#define NVRAM_VERSION "1.0"
-
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#define NVRAM_SIZE 8192
-
-static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
-{
-   switch (origin) {
-   case 0:
-   break;
-   case 1:
-   offset += file->f_pos;
-   break;
-   case 2:
-   offset += NVRAM_SIZE;
-   break;
-   default:
-   offset = -1;
-   }
-   if (offset < 0)
-   return -EINVAL;
-
-   file->f_pos = offset;
-   return file->f_pos;
-}
-
-static ssize_t read_nvram(struct file *file, char __user *buf,
- size_t count, loff_t *ppos)
-{
-   unsigned int i;
-   char __user *p = buf;
-
-   if (!access_ok(VERIFY_WRITE, buf, count))
-   return -EFAULT;
-   if (*ppos >= NVRAM_SIZE)
-   return 0;
-   for (i = *ppos; count > 0 && i < NVRAM_SIZE; ++i, ++p, --count)
-   if (__put_user(nvram_read_byte(i), p))
-   return -EFAULT;
-   *ppos = i;
-   return p - buf;
-}
-
-static ssize_t write_nvram(struct file *file, const char __user *buf,
-  size_t count, loff_t *ppos)
-{
-   unsigned int i;
-   const char __user *p = buf;
-   char c;
-
-   if (!access_ok(VERIFY_READ, buf, count))
-   return -EFAULT;
-   if (*ppos >= NVRAM_SIZE)
-   return 0;
-   for (i = *ppos; count > 0 && i < NVRAM_SIZE; ++i, ++p, --count) {
-   if (__get_user(c, p))
-   return -EFAULT;
-   nvram_write_byte(c, i);
-   }
-   *ppos = i;
-   return p - buf;
-}
-
-static long nvram_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
-{
-   switch(cmd) {
-   case PMAC_NVRAM_GET_OFFSET:
-   {
-   int part, offset;
-   if (copy_from_user(, (void __user*)arg, 
sizeof(part)) != 0)
-   return -EFAULT;
-   if (part < pmac_nvram_OF || part > pmac_nvram_NR)
-   return -EINVAL;
-   offset = pmac_get_partition(part);
-   if (copy_to_user((void __user*)arg, , 
sizeof(offset)) != 0)
-   return -EFAULT;
-   break;
-   }
-
-   default:
-   return -EINVAL;
-   }
-
-   return 0;
-}
-
-const struct file_operations nvram_fops = {
-   .owner  = THIS_MODULE,
-   .llseek = nvram_llseek,
-   .read   = read_nvram,
-   .write  = write_nvram,
-   .unlocked_ioctl = nvram_ioctl,
-};
-
-static struct miscdevice nvram_dev = {
-   NVRAM_MINOR,
-   "nvram",
-   _fops
-};
-
-int __init nvram_init(void)
-{
-   printk(KERN_INFO "Macintosh non-volatile memory driver v%s\n",
-   NVRAM_VERSION);
-   return misc_register(_dev);
-}
-
-void __exit nvram_cleanup(void)
-{
-misc_deregister( _dev );
-}
-
-module_init(nvram_init);
-module_exit(nvram_cleanup);
-MODULE_LICENSE("GPL");


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


[RFC 18/24] nvram: Drop nvram_* symbol exports and prototypes

2015-05-30 Thread Finn Thain
Drivers now use the arch_nvram_ops calls so remove the function exports and
prototypes. nvram_check_checksum() is unused so remove it.

Signed-off-by: Finn Thain 

---
 arch/m68k/atari/nvram.c |6 +++---
 drivers/char/nvram.c|   27 +--
 include/linux/nvram.h   |8 
 3 files changed, 8 insertions(+), 33 deletions(-)

Index: linux/drivers/char/nvram.c
===
--- linux.orig/drivers/char/nvram.c 2015-05-31 11:01:17.0 +1000
+++ linux/drivers/char/nvram.c  2015-05-31 11:01:21.0 +1000
@@ -82,13 +82,12 @@ static ssize_t nvram_size;
  * periodic 11 min sync from kernel/time/ntp.c vs. this driver.)
  */
 
-unsigned char __nvram_read_byte(int i)
+static unsigned char __nvram_read_byte(int i)
 {
return CMOS_READ(NVRAM_FIRST_BYTE + i);
 }
-EXPORT_SYMBOL(__nvram_read_byte);
 
-unsigned char nvram_read_byte(int i)
+static unsigned char nvram_read_byte(int i)
 {
unsigned long flags;
unsigned char c;
@@ -98,16 +97,14 @@ unsigned char nvram_read_byte(int i)
spin_unlock_irqrestore(_lock, flags);
return c;
 }
-EXPORT_SYMBOL(nvram_read_byte);
 
 /* This races nicely with trying to read with checksum checking (nvram_read) */
-void __nvram_write_byte(unsigned char c, int i)
+static void __nvram_write_byte(unsigned char c, int i)
 {
CMOS_WRITE(c, NVRAM_FIRST_BYTE + i);
 }
-EXPORT_SYMBOL(__nvram_write_byte);
 
-void nvram_write_byte(unsigned char c, int i)
+static void nvram_write_byte(unsigned char c, int i)
 {
unsigned long flags;
 
@@ -115,14 +112,13 @@ void nvram_write_byte(unsigned char c, i
__nvram_write_byte(c, i);
spin_unlock_irqrestore(_lock, flags);
 }
-EXPORT_SYMBOL(nvram_write_byte);
 
 /* On PCs, the checksum is built only over bytes 2..31 */
 #define PC_CKS_RANGE_START 2
 #define PC_CKS_RANGE_END   31
 #define PC_CKS_LOC 32
 
-int __nvram_check_checksum(void)
+static int __nvram_check_checksum(void)
 {
int i;
unsigned short sum = 0;
@@ -134,19 +130,6 @@ int __nvram_check_checksum(void)
__nvram_read_byte(PC_CKS_LOC+1);
return (sum & 0x) == expect;
 }
-EXPORT_SYMBOL(__nvram_check_checksum);
-
-int nvram_check_checksum(void)
-{
-   unsigned long flags;
-   int rv;
-
-   spin_lock_irqsave(_lock, flags);
-   rv = __nvram_check_checksum();
-   spin_unlock_irqrestore(_lock, flags);
-   return rv;
-}
-EXPORT_SYMBOL(nvram_check_checksum);
 
 static void __nvram_set_checksum(void)
 {
Index: linux/include/linux/nvram.h
===
--- linux.orig/include/linux/nvram.h2015-05-31 11:01:17.0 +1000
+++ linux/include/linux/nvram.h 2015-05-31 11:01:21.0 +1000
@@ -3,14 +3,6 @@
 
 #include 
 
-/* __foo is foo without grabbing the rtc_lock - get it yourself */
-extern unsigned char __nvram_read_byte(int i);
-extern unsigned char nvram_read_byte(int i);
-extern void __nvram_write_byte(unsigned char c, int i);
-extern void nvram_write_byte(unsigned char c, int i);
-extern int __nvram_check_checksum(void);
-extern int nvram_check_checksum(void);
-
 struct nvram_ops {
ssize_t (*read)(char *, size_t, loff_t *);
ssize_t (*write)(char *, size_t, loff_t *);
Index: linux/arch/m68k/atari/nvram.c
===
--- linux.orig/arch/m68k/atari/nvram.c  2015-05-31 11:01:11.0 +1000
+++ linux/arch/m68k/atari/nvram.c   2015-05-31 11:01:21.0 +1000
@@ -33,13 +33,13 @@
  * periodic 11 min sync from kernel/time/ntp.c vs. this driver.)
  */
 
-unsigned char __nvram_read_byte(int i)
+static unsigned char __nvram_read_byte(int i)
 {
return CMOS_READ(NVRAM_FIRST_BYTE + i);
 }
 
 /* This races nicely with trying to read with checksum checking */
-void __nvram_write_byte(unsigned char c, int i)
+static void __nvram_write_byte(unsigned char c, int i)
 {
CMOS_WRITE(c, NVRAM_FIRST_BYTE + i);
 }
@@ -51,7 +51,7 @@ void __nvram_write_byte(unsigned char c,
 #define ATARI_CKS_RANGE_END47
 #define ATARI_CKS_LOC  48
 
-int __nvram_check_checksum(void)
+static int __nvram_check_checksum(void)
 {
int i;
unsigned char sum = 0;


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


[RFC 14/24] powerpc: Add missing ppc_md.nvram_size for CHRP and PowerMac

2015-05-30 Thread Finn Thain
Add the nvram_size() function to those PowerPC platforms that don't already
have one: CHRP and PowerMac. This means that the ppc_md.nvram_size()
function can be used to implement arch_nvram_ops.get_size()

Since we are addressing inconsistencies here, also rename chrp_nvram_read
and chrp_nvram_write, which break the naming convention used across
PowerPC platforms for NVRAM accessor functions.

Signed-off-by: Finn Thain 

---
 arch/powerpc/platforms/chrp/nvram.c |   14 ++
 arch/powerpc/platforms/powermac/nvram.c |9 +
 2 files changed, 19 insertions(+), 4 deletions(-)

Index: linux/arch/powerpc/platforms/chrp/nvram.c
===
--- linux.orig/arch/powerpc/platforms/chrp/nvram.c  2015-05-31 
11:00:59.0 +1000
+++ linux/arch/powerpc/platforms/chrp/nvram.c   2015-05-31 11:01:15.0 
+1000
@@ -23,7 +23,7 @@ static unsigned int nvram_size;
 static unsigned char nvram_buf[4];
 static DEFINE_SPINLOCK(nvram_lock);
 
-static unsigned char chrp_nvram_read(int addr)
+static unsigned char chrp_nvram_read_byte(int addr)
 {
unsigned int done;
unsigned long flags;
@@ -45,7 +45,7 @@ static unsigned char chrp_nvram_read(int
return ret;
 }
 
-static void chrp_nvram_write(int addr, unsigned char val)
+static void chrp_nvram_write_byte(int addr, unsigned char val)
 {
unsigned int done;
unsigned long flags;
@@ -63,6 +63,11 @@ static void chrp_nvram_write(int addr, u
spin_unlock_irqrestore(_lock, flags);
 }
 
+static ssize_t chrp_nvram_size(void)
+{
+   return nvram_size;
+}
+
 void __init chrp_nvram_init(void)
 {
struct device_node *nvram;
@@ -84,8 +89,9 @@ void __init chrp_nvram_init(void)
printk(KERN_INFO "CHRP nvram contains %u bytes\n", nvram_size);
of_node_put(nvram);
 
-   ppc_md.nvram_read_val = chrp_nvram_read;
-   ppc_md.nvram_write_val = chrp_nvram_write;
+   ppc_md.nvram_read_val  = chrp_nvram_read_byte;
+   ppc_md.nvram_write_val = chrp_nvram_write_byte;
+   ppc_md.nvram_size  = chrp_nvram_size;
 
return;
 }
Index: linux/arch/powerpc/platforms/powermac/nvram.c
===
--- linux.orig/arch/powerpc/platforms/powermac/nvram.c  2015-05-31 
11:00:59.0 +1000
+++ linux/arch/powerpc/platforms/powermac/nvram.c   2015-05-31 
11:01:15.0 +1000
@@ -147,6 +147,11 @@ static ssize_t core99_nvram_size(void)
 static volatile unsigned char __iomem *nvram_addr;
 static int nvram_mult;
 
+static ssize_t ppc32_nvram_size(void)
+{
+   return NVRAM_SIZE;
+}
+
 static unsigned char direct_nvram_read_byte(int addr)
 {
return in_8(_data[(addr & (NVRAM_SIZE - 1)) * nvram_mult]);
@@ -590,21 +595,25 @@ int __init pmac_nvram_init(void)
nvram_mult = 1;
ppc_md.nvram_read_val   = direct_nvram_read_byte;
ppc_md.nvram_write_val  = direct_nvram_write_byte;
+   ppc_md.nvram_size   = ppc32_nvram_size;
} else if (nvram_naddrs == 1) {
nvram_data = ioremap(r1.start, s1);
nvram_mult = (s1 + NVRAM_SIZE - 1) / NVRAM_SIZE;
ppc_md.nvram_read_val   = direct_nvram_read_byte;
ppc_md.nvram_write_val  = direct_nvram_write_byte;
+   ppc_md.nvram_size   = ppc32_nvram_size;
} else if (nvram_naddrs == 2) {
nvram_addr = ioremap(r1.start, s1);
nvram_data = ioremap(r2.start, s2);
ppc_md.nvram_read_val   = indirect_nvram_read_byte;
ppc_md.nvram_write_val  = indirect_nvram_write_byte;
+   ppc_md.nvram_size   = ppc32_nvram_size;
} else if (nvram_naddrs == 0 && sys_ctrler == SYS_CTRLER_PMU) {
 #ifdef CONFIG_ADB_PMU
nvram_naddrs = -1;
ppc_md.nvram_read_val   = pmu_nvram_read_byte;
ppc_md.nvram_write_val  = pmu_nvram_write_byte;
+   ppc_md.nvram_size   = ppc32_nvram_size;
 #endif /* CONFIG_ADB_PMU */
} else {
printk(KERN_ERR "Incompatible type of NVRAM\n");


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


[RFC 23/24] m68k/mac: Fix PRAM accessors

2015-05-30 Thread Finn Thain
Signed-off-by: Finn Thain 

---

Tested on a PowerBook 520 and Quadra 650.

---
 arch/m68k/mac/misc.c |   35 +--
 include/uapi/linux/pmu.h |2 ++
 2 files changed, 31 insertions(+), 6 deletions(-)

Index: linux/arch/m68k/mac/misc.c
===
--- linux.orig/arch/m68k/mac/misc.c 2015-05-31 11:01:26.0 +1000
+++ linux/arch/m68k/mac/misc.c  2015-05-31 11:01:28.0 +1000
@@ -124,19 +124,22 @@ static void pmu_write_time(long data)
 static unsigned char pmu_pram_read_byte(int offset)
 {
struct adb_request req;
-   if (pmu_request(, NULL, 3, PMU_READ_NVRAM,
-   (offset >> 8) & 0xFF, offset & 0xFF) < 0)
+
+   if (pmu_request(, NULL, 3, PMU_READ_XPRAM,
+   offset & 0xFF, 1) < 0)
return 0;
while (!req.complete)
pmu_poll();
-   return req.reply[3];
+
+   return req.reply[1];
 }
 
 static void pmu_pram_write_byte(unsigned char data, int offset)
 {
struct adb_request req;
-   if (pmu_request(, NULL, 4, PMU_WRITE_NVRAM,
-   (offset >> 8) & 0xFF, offset & 0xFF, data) < 0)
+
+   if (pmu_request(, NULL, 4, PMU_WRITE_XPRAM,
+   offset & 0xFF, 1, data) < 0)
return;
while (!req.complete)
pmu_poll();
@@ -295,11 +298,31 @@ static void via_pram_command(int command
 #if IS_ENABLED(CONFIG_NVRAM)
 static unsigned char via_pram_read_byte(int offset)
 {
-   return 0;
+   unsigned char temp;
+   int addr = ((offset & 0xE0) << 3) | ((offset & 0x1F) << 2);
+
+   /* Use RTC command 0x38 for XPRAM access, as per MESS source code */
+   via_pram_command(addr | 0x3800 | 0x8001, );
+
+   return temp;
 }
 
 static void via_pram_write_byte(unsigned char data, int offset)
 {
+   unsigned char temp;
+   int addr = ((offset & 0xE0) << 3) | ((offset & 0x1F) << 2);
+
+   /* Clear the write protect bit */
+   temp = 0x55;
+   via_pram_command(0x34 | 0x01, );
+
+   /* Write the byte to XPRAM */
+   temp = data;
+   via_pram_command(0x3800 | 0x0001 | addr, );
+
+   /* Set the write protect bit */
+   temp = 0xD5;
+   via_pram_command(0x34 | 0x01, );
 }
 #endif /* CONFIG_NVRAM */
 
Index: linux/include/uapi/linux/pmu.h
===
--- linux.orig/include/uapi/linux/pmu.h 2015-05-31 11:00:59.0 +1000
+++ linux/include/uapi/linux/pmu.h  2015-05-31 11:01:28.0 +1000
@@ -18,7 +18,9 @@
 #define PMU_POWER_CTRL 0x11/* control power of some devices */
 #define PMU_ADB_CMD0x20/* send ADB packet */
 #define PMU_ADB_POLL_OFF   0x21/* disable ADB auto-poll */
+#define PMU_WRITE_XPRAM0x32/* write eXtended Parameter RAM 
*/
 #define PMU_WRITE_NVRAM0x33/* write non-volatile RAM */
+#define PMU_READ_XPRAM 0x3a/* read eXtended Parameter RAM */
 #define PMU_READ_NVRAM 0x3b/* read non-volatile RAM */
 #define PMU_SET_RTC0x30/* set real-time clock */
 #define PMU_READ_RTC   0x38/* read real-time clock */


--
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 v11 6/12] x86, mm, asm-gen: Add ioremap_wt() for WT

2015-05-30 Thread Toshi Kani
On Sat, 2015-05-30 at 11:18 +0200, Geert Uytterhoeven wrote:
> On Sat, May 30, 2015 at 12:59 AM, Toshi Kani  wrote:
> > --- a/include/asm-generic/io.h
> > +++ b/include/asm-generic/io.h
> > @@ -785,8 +785,17 @@ static inline void __iomem *ioremap_wc(phys_addr_t 
> > offset, size_t size)
> >  }
> >  #endif
> >
> > +#ifndef ioremap_wt
> > +#define ioremap_wt ioremap_wt
> > +static inline void __iomem *ioremap_wt(phys_addr_t offset, size_t size)
> > +{
> > +   return ioremap_nocache(offset, size);
> > +}
> > +#endif
> > +
> >  #ifndef iounmap
> >  #define iounmap iounmap
> > +
> >  static inline void iounmap(void __iomem *addr)
> >  {
> >  }
> > diff --git a/include/asm-generic/iomap.h b/include/asm-generic/iomap.h
> > index 1b41011..d8f8622 100644
> > --- a/include/asm-generic/iomap.h
> > +++ b/include/asm-generic/iomap.h
> > @@ -66,6 +66,10 @@ extern void ioport_unmap(void __iomem *);
> >  #define ioremap_wc ioremap_nocache
> >  #endif
> >
> > +#ifndef ARCH_HAS_IOREMAP_WT
> > +#define ioremap_wt ioremap_nocache
> > +#endif
> 
> Defining ioremap_wt in two different places in asm-generic looks fishy to me.
> 
> If  already provides it (either through asm-generic/io.h or
> arch//include/asm/io.h), why does asm-generic/iomap.h need to define
> its own version?
> 
> I see this pattern already exists for ioremap_wc...

Yes, this patchset follows the model of ioremap_wc.  This duplication
was introduced by 9216efafc52 "asm-generic/io.h: Reconcile I/O accessor
overrides", while the original ioremap_wc support changed
asm-generic/iomap.h (1526a756fba).  As described in patch 07, some
architectures define ioremap_xxx() locally as well.

It is too risky to do everything in one short.  I will look into the
duplication issue as a separate item after this patchset is settled.

Thanks,
-Toshi

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


[RFC 07/24] x86/thinkpad_acpi: Use arch_nvram_ops methods instead of nvram_read_byte() and nvram_write_byte()

2015-05-30 Thread Finn Thain
Make use of arch_nvram_ops in the thinkpad_acpi driver so that the
nvram_* function exports can be removed.

This patch series was tested on a ThinkPad T43.

Signed-off-by: Finn Thain 

---
 drivers/platform/x86/thinkpad_acpi.c |   20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

Index: linux/drivers/platform/x86/thinkpad_acpi.c
===
--- linux.orig/drivers/platform/x86/thinkpad_acpi.c 2015-05-31 
11:00:59.0 +1000
+++ linux/drivers/platform/x86/thinkpad_acpi.c  2015-05-31 11:01:07.0 
+1000
@@ -2311,30 +2311,30 @@ static void hotkey_read_nvram(struct tp_
u8 d;
 
if (m & TP_NVRAM_HKEY_GROUP_HK2) {
-   d = nvram_read_byte(TP_NVRAM_ADDR_HK2);
+   d = arch_nvram_ops.read_byte(TP_NVRAM_ADDR_HK2);
n->thinkpad_toggle = !!(d & TP_NVRAM_MASK_HKT_THINKPAD);
n->zoom_toggle = !!(d & TP_NVRAM_MASK_HKT_ZOOM);
n->display_toggle = !!(d & TP_NVRAM_MASK_HKT_DISPLAY);
n->hibernate_toggle = !!(d & TP_NVRAM_MASK_HKT_HIBERNATE);
}
if (m & TP_ACPI_HKEY_THNKLGHT_MASK) {
-   d = nvram_read_byte(TP_NVRAM_ADDR_THINKLIGHT);
+   d = arch_nvram_ops.read_byte(TP_NVRAM_ADDR_THINKLIGHT);
n->thinklight_toggle = !!(d & TP_NVRAM_MASK_THINKLIGHT);
}
if (m & TP_ACPI_HKEY_DISPXPAND_MASK) {
-   d = nvram_read_byte(TP_NVRAM_ADDR_VIDEO);
+   d = arch_nvram_ops.read_byte(TP_NVRAM_ADDR_VIDEO);
n->displayexp_toggle =
!!(d & TP_NVRAM_MASK_HKT_DISPEXPND);
}
if (m & TP_NVRAM_HKEY_GROUP_BRIGHTNESS) {
-   d = nvram_read_byte(TP_NVRAM_ADDR_BRIGHTNESS);
+   d = arch_nvram_ops.read_byte(TP_NVRAM_ADDR_BRIGHTNESS);
n->brightness_level = (d & TP_NVRAM_MASK_LEVEL_BRIGHTNESS)
>> TP_NVRAM_POS_LEVEL_BRIGHTNESS;
n->brightness_toggle =
!!(d & TP_NVRAM_MASK_HKT_BRIGHTNESS);
}
if (m & TP_NVRAM_HKEY_GROUP_VOLUME) {
-   d = nvram_read_byte(TP_NVRAM_ADDR_MIXER);
+   d = arch_nvram_ops.read_byte(TP_NVRAM_ADDR_MIXER);
n->volume_level = (d & TP_NVRAM_MASK_LEVEL_VOLUME)
>> TP_NVRAM_POS_LEVEL_VOLUME;
n->mute = !!(d & TP_NVRAM_MASK_MUTE);
@@ -6153,7 +6153,7 @@ static unsigned int tpacpi_brightness_nv
 {
u8 lnvram;
 
-   lnvram = (nvram_read_byte(TP_NVRAM_ADDR_BRIGHTNESS)
+   lnvram = (arch_nvram_ops.read_byte(TP_NVRAM_ADDR_BRIGHTNESS)
  & TP_NVRAM_MASK_LEVEL_BRIGHTNESS)
  >> TP_NVRAM_POS_LEVEL_BRIGHTNESS;
lnvram &= bright_maxlvl;
@@ -6178,7 +6178,7 @@ static void tpacpi_brightness_checkpoint
if (unlikely(!acpi_ec_read(TP_EC_BACKLIGHT, )))
goto unlock;
lec &= TP_EC_BACKLIGHT_LVLMSK;
-   b_nvram = nvram_read_byte(TP_NVRAM_ADDR_BRIGHTNESS);
+   b_nvram = arch_nvram_ops.read_byte(TP_NVRAM_ADDR_BRIGHTNESS);
 
if (lec != ((b_nvram & TP_NVRAM_MASK_LEVEL_BRIGHTNESS)
 >> TP_NVRAM_POS_LEVEL_BRIGHTNESS)) {
@@ -6186,7 +6186,7 @@ static void tpacpi_brightness_checkpoint
b_nvram &= ~(TP_NVRAM_MASK_LEVEL_BRIGHTNESS <<
TP_NVRAM_POS_LEVEL_BRIGHTNESS);
b_nvram |= lec;
-   nvram_write_byte(b_nvram, TP_NVRAM_ADDR_BRIGHTNESS);
+   arch_nvram_ops.write_byte(b_nvram, TP_NVRAM_ADDR_BRIGHTNESS);
dbg_printk(TPACPI_DBG_BRGHT,
   "updated NVRAM backlight level to %u (0x%02x)\n",
   (unsigned int) lec, (unsigned int) b_nvram);
@@ -6794,13 +6794,13 @@ static void tpacpi_volume_checkpoint_nvr
if (unlikely(!acpi_ec_read(TP_EC_AUDIO, )))
goto unlock;
lec &= ec_mask;
-   b_nvram = nvram_read_byte(TP_NVRAM_ADDR_MIXER);
+   b_nvram = arch_nvram_ops.read_byte(TP_NVRAM_ADDR_MIXER);
 
if (lec != (b_nvram & ec_mask)) {
/* NVRAM needs update */
b_nvram &= ~ec_mask;
b_nvram |= lec;
-   nvram_write_byte(b_nvram, TP_NVRAM_ADDR_MIXER);
+   arch_nvram_ops.write_byte(b_nvram, TP_NVRAM_ADDR_MIXER);
dbg_printk(TPACPI_DBG_MIXER,
   "updated NVRAM mixer status to 0x%02x (0x%02x)\n",
   (unsigned int) lec, (unsigned int) b_nvram);


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


[RFC 19/24] powerpc: Remove CONFIG_GENERIC_NVRAM and adopt CONFIG_HAVE_ARCH_NVRAM_OPS

2015-05-30 Thread Finn Thain
Switch PPC32 kernels from the generic_nvram module to the nvram module.

Also fix a theoretical bug where CHRP omits the chrp_nvram_init()
call when CONFIG_NVRAM_MODULE=m.

As before, when CONFIG_PPC && !CONFIG_PPC_PMAC, the IOC_NVRAM_GET_OFFSET
ioctl is unimplemented. For the nvram module, unimplemented ioctls return
-ENOTTY. Whereas, for the superseded generic_nvram module they would
return -EINVAL.

Signed-off-by: Finn Thain 

---

This ioctl change is visible to userspace code but only in an error path.
I didn't find any userspace code that uses the IOC_NVRAM_GET_OFFSET ioctl.

The change in the name of the module is also visible. The module that
implements /dev/nvram on PowerPC now has suitable aliases, i.e.
MODULE_ALIAS_MISCDEV(NVRAM_MINOR);
MODULE_ALIAS("devname:nvram"); 
so that the device special file can be automatically created and the
module automatically loaded when needed. Previously this was not the case.

---
 arch/powerpc/Kconfig|2 +-
 arch/powerpc/kernel/setup_32.c  |2 +-
 arch/powerpc/platforms/chrp/Makefile|2 +-
 arch/powerpc/platforms/chrp/setup.c |2 +-
 arch/powerpc/platforms/powermac/setup.c |3 +--
 drivers/char/Kconfig|   10 ++
 6 files changed, 11 insertions(+), 10 deletions(-)

Index: linux/arch/powerpc/Kconfig
===
--- linux.orig/arch/powerpc/Kconfig 2015-05-31 11:00:59.0 +1000
+++ linux/arch/powerpc/Kconfig  2015-05-31 11:01:22.0 +1000
@@ -178,7 +178,7 @@ config SYSVIPC_COMPAT
default y
 
 # All PPC32s use generic nvram driver through ppc_md
-config GENERIC_NVRAM
+config HAVE_ARCH_NVRAM_OPS
bool
default y if PPC32
 
Index: linux/arch/powerpc/kernel/setup_32.c
===
--- linux.orig/arch/powerpc/kernel/setup_32.c   2015-05-31 11:01:19.0 
+1000
+++ linux/arch/powerpc/kernel/setup_32.c2015-05-31 11:01:22.0 
+1000
@@ -168,7 +168,7 @@ int __init ppc_setup_l3cr(char *str)
 }
 __setup("l3cr=", ppc_setup_l3cr);
 
-#ifdef CONFIG_GENERIC_NVRAM
+#if IS_ENABLED(CONFIG_NVRAM)
 
 static unsigned char ppc_nvram_read_byte(int addr)
 {
Index: linux/arch/powerpc/platforms/chrp/Makefile
===
--- linux.orig/arch/powerpc/platforms/chrp/Makefile 2015-05-31 
11:00:59.0 +1000
+++ linux/arch/powerpc/platforms/chrp/Makefile  2015-05-31 11:01:22.0 
+1000
@@ -1,3 +1,3 @@
 obj-y  += setup.o time.o pegasos_eth.o pci.o
 obj-$(CONFIG_SMP)  += smp.o
-obj-$(CONFIG_NVRAM)+= nvram.o
+obj-$(CONFIG_NVRAM:m=y)+= nvram.o
Index: linux/arch/powerpc/platforms/chrp/setup.c
===
--- linux.orig/arch/powerpc/platforms/chrp/setup.c  2015-05-31 
11:00:59.0 +1000
+++ linux/arch/powerpc/platforms/chrp/setup.c   2015-05-31 11:01:22.0 
+1000
@@ -557,7 +557,7 @@ void __init chrp_init_IRQ(void)
 void __init
 chrp_init2(void)
 {
-#ifdef CONFIG_NVRAM
+#if IS_ENABLED(CONFIG_NVRAM)
chrp_nvram_init();
 #endif
 
Index: linux/arch/powerpc/platforms/powermac/setup.c
===
--- linux.orig/arch/powerpc/platforms/powermac/setup.c  2015-05-31 
11:00:59.0 +1000
+++ linux/arch/powerpc/platforms/powermac/setup.c   2015-05-31 
11:01:22.0 +1000
@@ -321,8 +321,7 @@ static void __init pmac_setup_arch(void)
find_via_pmu();
smu_init();
 
-#if defined(CONFIG_NVRAM) || defined(CONFIG_NVRAM_MODULE) || \
-defined(CONFIG_PPC64)
+#if IS_ENABLED(CONFIG_NVRAM) || defined(CONFIG_PPC64)
pmac_nvram_init();
 #endif
 
Index: linux/drivers/char/Kconfig
===
--- linux.orig/drivers/char/Kconfig 2015-05-31 11:01:11.0 +1000
+++ linux/drivers/char/Kconfig  2015-05-31 11:01:22.0 +1000
@@ -247,7 +247,7 @@ source "drivers/char/hw_random/Kconfig"
 
 config NVRAM
tristate "/dev/nvram support"
-   depends on X86 || (ARM && RTC_DRV_CMOS) || GENERIC_NVRAM || 
HAVE_ARCH_NVRAM_OPS
+   depends on X86 || (ARM && RTC_DRV_CMOS) || HAVE_ARCH_NVRAM_OPS
---help---
  If you say Y here and create a character special file /dev/nvram
  with major number 10 and minor number 144 using mknod ("man mknod"),
@@ -256,9 +256,11 @@ config NVRAM
  and most Ataris.  The actual number of bytes varies, depending on the
  nvram in the system, but is usually 114 (128-14 for the RTC).
 
- This memory is conventionally called "CMOS RAM" on PCs and "NVRAM"
- on Ataris. /dev/nvram may be used to view settings there, or to
- change them (with some utility). It could also be used to frequently
+ This memory is conventionally called "CMOS 

[RFC 09/24] char/nvram: Implement NVRAM read/write methods

2015-05-30 Thread Finn Thain
Refactor the RTC "CMOS" NVRAM functions so that they can be used as
arch_nvram_ops methods. Checksumming logic is moved from the misc device
operations to the nvram read/write operations.

This makes the misc device implementation more generic. This also
preserves the locking semantics such that "read if checksum valid" and
"write and update checksum" remain atomic operations.

PPC64 implements byte-range read/write methods which are similar to
file_operations struct methods. Other platforms provide only
byte-at-a-time functions. So the misc device prefers the former but
will fall back on the latter.

Signed-off-by: Finn Thain 

---
 drivers/char/nvram.c |  162 +++
 1 file changed, 114 insertions(+), 48 deletions(-)

Index: linux/drivers/char/nvram.c
===
--- linux.orig/drivers/char/nvram.c 2015-05-31 11:01:08.0 +1000
+++ linux/drivers/char/nvram.c  2015-05-31 11:01:09.0 +1000
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -178,9 +179,48 @@ static ssize_t nvram_get_size(void)
return NVRAM_BYTES;
 }
 
+static ssize_t nvram_read(char *buf, size_t count, loff_t *ppos)
+{
+   char *p = buf;
+   loff_t i;
+
+   spin_lock_irq(_lock);
+   if (!__nvram_check_checksum()) {
+   spin_unlock_irq(_lock);
+   return -EIO;
+   }
+   for (i = *ppos; count > 0 && i < NVRAM_BYTES; --count, ++i, ++p)
+   *p = __nvram_read_byte(i);
+   spin_unlock_irq(_lock);
+
+   *ppos = i;
+   return p - buf;
+}
+
+static ssize_t nvram_write(char *buf, size_t count, loff_t *ppos)
+{
+   char *p = buf;
+   loff_t i;
+
+   spin_lock_irq(_lock);
+   if (!__nvram_check_checksum()) {
+   spin_unlock_irq(_lock);
+   return -EIO;
+   }
+   for (i = *ppos; count > 0 && i < NVRAM_BYTES; --count, ++i, ++p)
+   __nvram_write_byte(*p, i);
+   __nvram_set_checksum();
+   spin_unlock_irq(_lock);
+
+   *ppos = i;
+   return p - buf;
+}
+
 const struct nvram_ops arch_nvram_ops = {
.read_byte  = nvram_read_byte,
.write_byte = nvram_write_byte,
+   .read   = nvram_read,
+   .write  = nvram_write,
.get_size   = nvram_get_size,
.set_checksum   = nvram_set_checksum,
.initialize = nvram_initialize,
@@ -215,69 +255,95 @@ static loff_t nvram_misc_llseek(struct f
 static ssize_t nvram_misc_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
 {
-   unsigned char contents[NVRAM_BYTES];
-   unsigned i = *ppos;
-   unsigned char *tmp;
-
-   spin_lock_irq(_lock);
+   loff_t i;
+   char __user *p = buf;
 
-   if (!__nvram_check_checksum())
-   goto checksum_err;
-
-   for (tmp = contents; count-- > 0 && i < NVRAM_BYTES; ++i, ++tmp)
-   *tmp = __nvram_read_byte(i);
-
-   spin_unlock_irq(_lock);
-
-   if (copy_to_user(buf, contents, tmp - contents))
+   if (!access_ok(VERIFY_WRITE, buf, count))
return -EFAULT;
+   if (*ppos >= nvram_size)
+   return 0;
 
-   *ppos = i;
-
-   return tmp - contents;
+   /* If the arch provided a byte range read op, use it. Otherwise
+* fall back on the byte-at-a-time accessor.
+*/
+   if (arch_nvram_ops.read != NULL) {
+   char *tmp;
+   ssize_t ret;
+
+   count = min_t(size_t, count, nvram_size - *ppos);
+   count = min_t(size_t, count, PAGE_SIZE);
+
+   tmp = kmalloc(count, GFP_KERNEL);
+   if (!tmp)
+   return -ENOMEM;
+
+   ret = arch_nvram_ops.read(tmp, count, ppos);
+   if (ret <= 0)
+   goto out;
+
+   if (copy_to_user(buf, tmp, ret)) {
+   *ppos -= ret;
+   ret = -EFAULT;
+   }
+
+out:
+   kfree(tmp);
+   return ret;
+   }
 
-checksum_err:
-   spin_unlock_irq(_lock);
-   return -EIO;
+   for (i = *ppos; count > 0 && i < nvram_size; ++i, ++p, --count)
+   if (__put_user(arch_nvram_ops.read_byte(i), p))
+   return -EFAULT;
+   *ppos = i;
+   return p - buf;
 }
 
 static ssize_t nvram_misc_write(struct file *file, const char __user *buf,
 size_t count, loff_t *ppos)
 {
-   unsigned char contents[NVRAM_BYTES];
-   unsigned i = *ppos;
-   unsigned char *tmp;
-
-   if (i >= NVRAM_BYTES)
-   return 0;   /* Past EOF */
-
-   if (count > NVRAM_BYTES - i)
-   count = NVRAM_BYTES - i;
-   if (count > NVRAM_BYTES)
-   return -EFAULT; /* Can't happen, but prove it to gcc */
+   

[RFC 02/24] scsi/atari_scsi: Dont select CONFIG_NVRAM

2015-05-30 Thread Finn Thain
On powerpc, setting CONFIG_NVRAM=n builds a kernel with no NVRAM support.
Setting CONFIG_NVRAM=m enables the /dev/nvram misc device module without
enabling NVRAM support in drivers. Setting CONFIG_NVRAM=y enables the
misc device (built-in) and also enables NVRAM support in drivers.

m68k shares the valkyriefb driver with powerpc, and since that driver uses
NVRAM, it is affected by CONFIG_ATARI_SCSI, because of the use of
"select NVRAM".

Adopt the powerpc convention on m68k to avoid surprises.

Signed-off-by: Finn Thain 

---

This patch temporarily disables CONFIG_NVRAM on Atari, to prevent build
failures when bisecting the rest of this patch series. It gets enabled
again with the introduction of CONFIG_HAVE_ARCH_NVRAM_OPS, once the
nvram_* global functions have been moved to an ops struct.

The removal of "select NVRAM" may mean that some kernel configs (such
as Debian/m68k) may need tweaking.

---
 drivers/char/Kconfig  |5 +
 drivers/scsi/Kconfig  |6 +++---
 drivers/scsi/atari_scsi.c |8 
 3 files changed, 8 insertions(+), 11 deletions(-)

Index: linux/drivers/char/Kconfig
===
--- linux.orig/drivers/char/Kconfig 2015-05-31 11:00:59.0 +1000
+++ linux/drivers/char/Kconfig  2015-05-31 11:01:00.0 +1000
@@ -247,7 +247,7 @@ source "drivers/char/hw_random/Kconfig"
 
 config NVRAM
tristate "/dev/nvram support"
-   depends on ATARI || X86 || (ARM && RTC_DRV_CMOS) || GENERIC_NVRAM
+   depends on X86 || (ARM && RTC_DRV_CMOS) || GENERIC_NVRAM
---help---
  If you say Y here and create a character special file /dev/nvram
  with major number 10 and minor number 144 using mknod ("man mknod"),
@@ -265,9 +265,6 @@ config NVRAM
  should NEVER idly tamper with it. See Ralf Brown's interrupt list
  for a guide to the use of CMOS bytes by your BIOS.
 
- On Atari machines, /dev/nvram is always configured and does not need
- to be selected.
-
  To compile this driver as a module, choose M here: the
  module will be called nvram.
 
Index: linux/drivers/scsi/Kconfig
===
--- linux.orig/drivers/scsi/Kconfig 2015-05-31 11:00:59.0 +1000
+++ linux/drivers/scsi/Kconfig  2015-05-31 11:01:00.0 +1000
@@ -1592,14 +1592,14 @@ config ATARI_SCSI
tristate "Atari native SCSI support"
depends on ATARI && SCSI
select SCSI_SPI_ATTRS
-   select NVRAM
---help---
  If you have an Atari with built-in NCR5380 SCSI controller (TT,
  Falcon, ...) say Y to get it supported. Of course also, if you have
  a compatible SCSI controller (e.g. for Medusa).
 
- To compile this driver as a module, choose M here: the
- module will be called atari_scsi.
+ To compile this driver as a module, choose M here: the module will
+ be called atari_scsi. If you also enable NVRAM support, the SCSI
+ host's ID is taken from the setting in TT RTC NVRAM.
 
  This driver supports both styles of NCR integration into the
  system: the TT style (separate DMA), and the Falcon style (via
Index: linux/drivers/scsi/atari_scsi.c
===
--- linux.orig/drivers/scsi/atari_scsi.c2015-05-31 11:00:59.0 
+1000
+++ linux/drivers/scsi/atari_scsi.c 2015-05-31 11:01:00.0 +1000
@@ -875,9 +875,10 @@ static int __init atari_scsi_probe(struc
if (ATARIHW_PRESENT(TT_SCSI) && setup_sg_tablesize >= 0)
atari_scsi_template.sg_tablesize = setup_sg_tablesize;
 
-   if (setup_hostid >= 0) {
+   if (setup_hostid >= 0)
atari_scsi_template.this_id = setup_hostid & 7;
-   } else {
+#ifdef CONFIG_NVRAM
+   else
/* Test if a host id is set in the NVRam */
if (ATARIHW_PRESENT(TT_CLK) && nvram_check_checksum()) {
unsigned char b = nvram_read_byte(14);
@@ -888,8 +889,7 @@ static int __init atari_scsi_probe(struc
if (b & 0x80)
atari_scsi_template.this_id = b & 7;
}
-   }
-
+#endif
 
 #ifdef REAL_DMA
/* If running on a Falcon and if there's TT-Ram (i.e., more than one


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


[RFC 03/24] m68k/atari: Move Atari-specific code out of drivers/char/nvram.c

2015-05-30 Thread Finn Thain
Move the m68k-specific code elsewhere to make the driver generic.

Change the vmode calculation from logical OR to bitwise OR, since it is
obviously wrong.

Signed-off-by: Finn Thain 

---

BTW, I didn't change the SCSI ID location in NVRAM. This code says 16
whereas atari_scsi says 14. Which one is correct?

---
 arch/m68k/atari/Makefile |2 
 arch/m68k/atari/nvram.c  |  255 ++
 drivers/char/nvram.c |  280 +--
 3 files changed, 292 insertions(+), 245 deletions(-)

Index: linux/arch/m68k/atari/nvram.c
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ linux/arch/m68k/atari/nvram.c   2015-05-31 11:01:01.0 +1000
@@ -0,0 +1,255 @@
+/*
+ * CMOS/NV-RAM driver for Atari. Adapted from drivers/char/nvram.c.
+ * Copyright (C) 1997 Roman Hodek 
+ * idea by and with help from Richard Jelinek 
+ * Portions copyright (c) 2001,2002 Sun Microsystems (thoc...@sun.com)
+ * Further contributions from Cesar Barros, Erik Gilling, Tim Hockin and
+ * Wim Van Sebroeck.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define NVRAM_BYTES50
+
+/* It is worth noting that these functions all access bytes of general
+ * purpose memory in the NVRAM - that is to say, they all add the
+ * NVRAM_FIRST_BYTE offset. Pass them offsets into NVRAM as if you did not
+ * know about the RTC cruft.
+ */
+
+/* Note that *all* calls to CMOS_READ and CMOS_WRITE must be done with
+ * rtc_lock held. Due to the index-port/data-port design of the RTC, we
+ * don't want two different things trying to get to it at once. (e.g. the
+ * periodic 11 min sync from kernel/time/ntp.c vs. this driver.)
+ */
+
+unsigned char __nvram_read_byte(int i)
+{
+   return CMOS_READ(NVRAM_FIRST_BYTE + i);
+}
+
+unsigned char nvram_read_byte(int i)
+{
+   unsigned long flags;
+   unsigned char c;
+
+   spin_lock_irqsave(_lock, flags);
+   c = __nvram_read_byte(i);
+   spin_unlock_irqrestore(_lock, flags);
+   return c;
+}
+EXPORT_SYMBOL(nvram_read_byte);
+
+/* This races nicely with trying to read with checksum checking */
+void __nvram_write_byte(unsigned char c, int i)
+{
+   CMOS_WRITE(c, NVRAM_FIRST_BYTE + i);
+}
+
+void nvram_write_byte(unsigned char c, int i)
+{
+   unsigned long flags;
+
+   spin_lock_irqsave(_lock, flags);
+   __nvram_write_byte(c, i);
+   spin_unlock_irqrestore(_lock, flags);
+}
+
+/* On Ataris, the checksum is over all bytes except the checksum bytes
+ * themselves; these are at the very end.
+ */
+#define ATARI_CKS_RANGE_START  0
+#define ATARI_CKS_RANGE_END47
+#define ATARI_CKS_LOC  48
+
+int __nvram_check_checksum(void)
+{
+   int i;
+   unsigned char sum = 0;
+
+   for (i = ATARI_CKS_RANGE_START; i <= ATARI_CKS_RANGE_END; ++i)
+   sum += __nvram_read_byte(i);
+   return (__nvram_read_byte(ATARI_CKS_LOC) == (~sum & 0xff)) &&
+  (__nvram_read_byte(ATARI_CKS_LOC + 1) == (sum & 0xff));
+}
+
+int nvram_check_checksum(void)
+{
+   unsigned long flags;
+   int rv;
+
+   spin_lock_irqsave(_lock, flags);
+   rv = __nvram_check_checksum();
+   spin_unlock_irqrestore(_lock, flags);
+   return rv;
+}
+EXPORT_SYMBOL(nvram_check_checksum);
+
+static void __nvram_set_checksum(void)
+{
+   int i;
+   unsigned char sum = 0;
+
+   for (i = ATARI_CKS_RANGE_START; i <= ATARI_CKS_RANGE_END; ++i)
+   sum += __nvram_read_byte(i);
+   __nvram_write_byte(~sum, ATARI_CKS_LOC);
+   __nvram_write_byte(sum, ATARI_CKS_LOC + 1);
+}
+
+#ifdef CONFIG_PROC_FS
+static struct {
+   unsigned char val;
+   char *name;
+} boot_prefs[] = {
+   { 0x80, "TOS" },
+   { 0x40, "ASV" },
+   { 0x20, "NetBSD (?)" },
+   { 0x10, "Linux" },
+   { 0x00, "unspecified" },
+};
+
+static char *languages[] = {
+   "English (US)",
+   "German",
+   "French",
+   "English (UK)",
+   "Spanish",
+   "Italian",
+   "6 (undefined)",
+   "Swiss (French)",
+   "Swiss (German)",
+};
+
+static char *dateformat[] = {
+   "MM%cDD%cYY",
+   "DD%cMM%cYY",
+   "YY%cMM%cDD",
+   "YY%cDD%cMM",
+   "4 (undefined)",
+   "5 (undefined)",
+   "6 (undefined)",
+   "7 (undefined)",
+};
+
+static char *colors[] = {
+   "2", "4", "16", "256", "65536", "??", "??", "??"
+};
+
+static void atari_nvram_proc_read(unsigned char *nvram, struct seq_file *seq,
+  void *offset)
+{
+   int checksum;
+   int i;
+   unsigned vmode;
+
+   spin_lock_irq(_lock);
+   checksum = __nvram_check_checksum();
+   spin_unlock_irq(_lock);
+
+   seq_printf(seq, "Checksum status  : %svalid\n", checksum ? "" : "not ");
+
+   seq_puts(seq, "Boot preference  : ");
+   

[RFC 21/24] powerpc: Adopt nvram module for PPC64

2015-05-30 Thread Finn Thain
Adopt nvram module to reduce code duplication.

The IOC_NVRAM_GET_OFFSET ioctl as implemented on PPC64 validates the offset
returned by pmac_get_partition(). Add this test to the nvram module.

Note that the old PPC32 generic_nvram module lacked this test.
So when CONFIG_PPC32 && CONFIG_PPC_PMAC, the IOC_NVRAM_GET_OFFSET ioctl
would have returned 0 (always). But when CONFIG_PPC64 && CONFIG_PPC_PMAC,
the IOC_NVRAM_GET_OFFSET ioctl would have returned -1 (which is -EPERM)
when the requested partition was not found.

With this patch, the result is now -ENOENT on both PPC32 and PPC64 when
the requested PowerMac NVRAM partition is not found.

This is a userspace-visible change, in the non-existent partition case,
which would be in an error path for an IOC_NVRAM_GET_OFFSET ioctl syscall.

Signed-off-by: Finn Thain 

---

BTW, the IOC_NVRAM_SYNC ioctl call returns -EINVAL on PPC64. This patch
retains this behaviour though it might be better to actually perform a sync.
Both PPC64 and PPC32 kernels implement ppc_md.nvram_sync() for Core99,
but on PPC64 the ioctl is unimplemented (unlike PPC32).

---
 arch/powerpc/Kconfig |3 
 arch/powerpc/kernel/nvram_64.c   |  203 ---
 arch/powerpc/platforms/powermac/Makefile |5 
 arch/powerpc/platforms/powermac/nvram.c  |2 
 arch/powerpc/platforms/powermac/setup.c  |2 
 drivers/char/nvram.c |2 
 6 files changed, 38 insertions(+), 179 deletions(-)

Index: linux/arch/powerpc/Kconfig
===
--- linux.orig/arch/powerpc/Kconfig 2015-05-31 11:01:22.0 +1000
+++ linux/arch/powerpc/Kconfig  2015-05-31 11:01:24.0 +1000
@@ -177,10 +177,9 @@ config SYSVIPC_COMPAT
depends on COMPAT && SYSVIPC
default y
 
-# All PPC32s use generic nvram driver through ppc_md
 config HAVE_ARCH_NVRAM_OPS
bool
-   default y if PPC32
+   default y
 
 config SCHED_OMIT_FRAME_POINTER
bool
Index: linux/arch/powerpc/kernel/nvram_64.c
===
--- linux.orig/arch/powerpc/kernel/nvram_64.c   2015-05-31 11:00:59.0 
+1000
+++ linux/arch/powerpc/kernel/nvram_64.c2015-05-31 11:01:25.0 
+1000
@@ -7,12 +7,6 @@
  *  2 of the License, or (at your option) any later version.
  *
  * /dev/nvram driver for PPC64
- *
- * This perhaps should live in drivers/char
- *
- * TODO: Split the /dev/nvram part (that one can use
- *   drivers/char/generic_nvram.c) from the arch & partition
- *   parsing code.
  */
 
 #include 
@@ -731,153 +725,6 @@ static void oops_to_nvram(struct kmsg_du
spin_unlock_irqrestore(, flags);
 }
 
-static loff_t dev_nvram_llseek(struct file *file, loff_t offset, int origin)
-{
-   int size;
-
-   if (ppc_md.nvram_size == NULL)
-   return -ENODEV;
-   size = ppc_md.nvram_size();
-
-   switch (origin) {
-   case 1:
-   offset += file->f_pos;
-   break;
-   case 2:
-   offset += size;
-   break;
-   }
-   if (offset < 0)
-   return -EINVAL;
-   file->f_pos = offset;
-   return file->f_pos;
-}
-
-
-static ssize_t dev_nvram_read(struct file *file, char __user *buf,
- size_t count, loff_t *ppos)
-{
-   ssize_t ret;
-   char *tmp = NULL;
-   ssize_t size;
-
-   if (!ppc_md.nvram_size) {
-   ret = -ENODEV;
-   goto out;
-   }
-
-   size = ppc_md.nvram_size();
-   if (size < 0) {
-   ret = size;
-   goto out;
-   }
-
-   if (*ppos >= size) {
-   ret = 0;
-   goto out;
-   }
-
-   count = min_t(size_t, count, size - *ppos);
-   count = min(count, PAGE_SIZE);
-
-   tmp = kmalloc(count, GFP_KERNEL);
-   if (!tmp) {
-   ret = -ENOMEM;
-   goto out;
-   }
-
-   ret = ppc_md.nvram_read(tmp, count, ppos);
-   if (ret <= 0)
-   goto out;
-
-   if (copy_to_user(buf, tmp, ret))
-   ret = -EFAULT;
-
-out:
-   kfree(tmp);
-   return ret;
-
-}
-
-static ssize_t dev_nvram_write(struct file *file, const char __user *buf,
- size_t count, loff_t *ppos)
-{
-   ssize_t ret;
-   char *tmp = NULL;
-   ssize_t size;
-
-   ret = -ENODEV;
-   if (!ppc_md.nvram_size)
-   goto out;
-
-   ret = 0;
-   size = ppc_md.nvram_size();
-   if (*ppos >= size || size < 0)
-   goto out;
-
-   count = min_t(size_t, count, size - *ppos);
-   count = min(count, PAGE_SIZE);
-
-   ret = -ENOMEM;
-   tmp = kmalloc(count, GFP_KERNEL);
-   if (!tmp)
-   goto out;
-
-   ret = -EFAULT;
-   if (copy_from_user(tmp, buf, count))
-   goto out;
-
-   ret = ppc_md.nvram_write(tmp, count, ppos);
-

[RFC 10/24] char/nvram: Use generic fixed_size_llseek()

2015-05-30 Thread Finn Thain
Signed-off-by: Finn Thain 

---
 drivers/char/nvram.c |   16 +---
 1 file changed, 1 insertion(+), 15 deletions(-)

Index: linux/drivers/char/nvram.c
===
--- linux.orig/drivers/char/nvram.c 2015-05-31 11:01:09.0 +1000
+++ linux/drivers/char/nvram.c  2015-05-31 11:01:11.0 +1000
@@ -235,21 +235,7 @@ EXPORT_SYMBOL(arch_nvram_ops);
 
 static loff_t nvram_misc_llseek(struct file *file, loff_t offset, int origin)
 {
-   switch (origin) {
-   case 0:
-   /* nothing to do */
-   break;
-   case 1:
-   offset += file->f_pos;
-   break;
-   case 2:
-   offset += NVRAM_BYTES;
-   break;
-   default:
-   return -EINVAL;
-   }
-
-   return (offset >= 0) ? (file->f_pos = offset) : -EINVAL;
+   return fixed_size_llseek(file, offset, origin, nvram_size);
 }
 
 static ssize_t nvram_misc_read(struct file *file, char __user *buf,


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


[RFC 11/24] m68k/atari: Implement arch_nvram_ops methods and enable CONFIG_HAVE_ARCH_NVRAM_OPS

2015-05-30 Thread Finn Thain
Atari RTC NVRAM has a checksum so implement the remaining arch_nvram_ops
methods for the set_checksum and initialize ioctls. Enable
CONFIG_HAVE_ARCH_NVRAM_OPS.

Signed-off-by: Finn Thain 

---

This re-enables the nvram module for Atari.

---
 arch/m68k/Kconfig   |3 +++
 arch/m68k/atari/nvram.c |   24 
 drivers/char/Kconfig|2 +-
 3 files changed, 28 insertions(+), 1 deletion(-)

Index: linux/arch/m68k/atari/nvram.c
===
--- linux.orig/arch/m68k/atari/nvram.c  2015-05-31 11:01:03.0 +1000
+++ linux/arch/m68k/atari/nvram.c   2015-05-31 11:01:11.0 +1000
@@ -73,6 +73,26 @@ static void __nvram_set_checksum(void)
__nvram_write_byte(sum, ATARI_CKS_LOC + 1);
 }
 
+static long nvram_set_checksum(void)
+{
+   spin_lock_irq(_lock);
+   __nvram_set_checksum();
+   spin_unlock_irq(_lock);
+   return 0;
+}
+
+static long nvram_initialize(void)
+{
+   loff_t i;
+
+   spin_lock_irq(_lock);
+   for (i = 0; i < NVRAM_BYTES; ++i)
+   __nvram_write_byte(0, i);
+   __nvram_set_checksum();
+   spin_unlock_irq(_lock);
+   return 0;
+}
+
 static ssize_t nvram_read(char *buf, size_t count, loff_t *ppos)
 {
char *p = buf;
@@ -119,6 +139,8 @@ static ssize_t nvram_write(char *buf, si
 
 static ssize_t nvram_get_size(void)
 {
+   if (!MACH_IS_ATARI)
+   return -ENODEV;
return NVRAM_BYTES;
 }
 
@@ -126,6 +148,8 @@ const struct nvram_ops arch_nvram_ops =
.read   = nvram_read,
.write  = nvram_write,
.get_size   = nvram_get_size,
+   .set_checksum   = nvram_set_checksum,
+   .initialize = nvram_initialize,
 };
 EXPORT_SYMBOL(arch_nvram_ops);
 
Index: linux/drivers/char/Kconfig
===
--- linux.orig/drivers/char/Kconfig 2015-05-31 11:01:00.0 +1000
+++ linux/drivers/char/Kconfig  2015-05-31 11:01:11.0 +1000
@@ -247,7 +247,7 @@ source "drivers/char/hw_random/Kconfig"
 
 config NVRAM
tristate "/dev/nvram support"
-   depends on X86 || (ARM && RTC_DRV_CMOS) || GENERIC_NVRAM
+   depends on X86 || (ARM && RTC_DRV_CMOS) || GENERIC_NVRAM || 
HAVE_ARCH_NVRAM_OPS
---help---
  If you say Y here and create a character special file /dev/nvram
  with major number 10 and minor number 144 using mknod ("man mknod"),
Index: linux/arch/m68k/Kconfig
===
--- linux.orig/arch/m68k/Kconfig2015-05-31 11:00:59.0 +1000
+++ linux/arch/m68k/Kconfig 2015-05-31 11:01:11.0 +1000
@@ -71,6 +71,9 @@ config PGTABLE_LEVELS
default 2 if SUN3 || COLDFIRE
default 3
 
+config HAVE_ARCH_NVRAM_OPS
+   def_bool ATARI
+
 source "init/Kconfig"
 
 source "kernel/Kconfig.freezer"


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


[RFC 16/24] powerpc: Implement nvram sync ioctl

2015-05-30 Thread Finn Thain
Add the powerpc-specific sync() method to struct nvram_ops and implement
the corresponding ioctl in the nvram module. This allows the nvram module
to replace the generic_nvram module.

Signed-off-by: Finn Thain 

---

On PPC32, the IOC_NVRAM_SYNC ioctl call always returns 0, even for those
platforms that don't implement ppc_md.nvram_sync. This patch retains
that quirk. It might be better to return failure (which is what PPC64 does).

---
 arch/powerpc/include/asm/nvram.h |3 ---
 arch/powerpc/kernel/setup_32.c   |6 +++---
 drivers/char/generic_nvram.c |2 +-
 drivers/char/nvram.c |   38 ++
 include/linux/nvram.h|4 
 5 files changed, 46 insertions(+), 7 deletions(-)

Index: linux/drivers/char/nvram.c
===
--- linux.orig/drivers/char/nvram.c 2015-05-31 11:01:13.0 +1000
+++ linux/drivers/char/nvram.c  2015-05-31 11:01:17.0 +1000
@@ -48,6 +48,11 @@
 #include 
 
 
+#ifdef CONFIG_PPC
+#include 
+#include 
+#endif
+
 static DEFINE_MUTEX(nvram_mutex);
 static DEFINE_SPINLOCK(nvram_state_lock);
 static int nvram_open_cnt; /* #times opened */
@@ -338,6 +343,36 @@ static long nvram_misc_ioctl(struct file
long ret = -ENOTTY;
 
switch (cmd) {
+#ifdef CONFIG_PPC
+#ifdef CONFIG_PPC_PMAC
+   case OBSOLETE_PMAC_NVRAM_GET_OFFSET:
+   pr_warn("nvram: Using obsolete PMAC_NVRAM_GET_OFFSET ioctl\n");
+   /* fall through */
+   case IOC_NVRAM_GET_OFFSET: {
+   int part, offset;
+
+   if (!machine_is(powermac))
+   return -EINVAL;
+   if (copy_from_user(,
+  (void __user *)arg, sizeof(part)) != 0)
+   return -EFAULT;
+   if (part < pmac_nvram_OF || part > pmac_nvram_NR)
+   return -EINVAL;
+   offset = pmac_get_partition(part);
+   if (copy_to_user((void __user *)arg,
+, sizeof(offset)) != 0)
+   return -EFAULT;
+   ret = 0;
+   break;
+   }
+#endif
+   case IOC_NVRAM_SYNC:
+   mutex_lock(_mutex);
+   if (arch_nvram_ops.sync != NULL)
+   ret = arch_nvram_ops.sync();
+   mutex_unlock(_mutex);
+   break;
+#else /* !CONFIG_PPC */
case NVRAM_INIT:
/* initialize NVRAM contents and checksum */
if (!capable(CAP_SYS_ADMIN))
@@ -359,6 +394,7 @@ static long nvram_misc_ioctl(struct file
ret = arch_nvram_ops.set_checksum();
mutex_unlock(_mutex);
break;
+#endif /* CONFIG_PPC */
}
return ret;
 }
@@ -374,6 +410,7 @@ static int nvram_misc_open(struct inode
return -EBUSY;
}
 
+#ifndef CONFIG_PPC
/* Prevent multiple writers if the set_checksum ioctl is implemented. */
if ((arch_nvram_ops.set_checksum != NULL) &&
(file->f_mode & FMODE_WRITE) &&
@@ -381,6 +418,7 @@ static int nvram_misc_open(struct inode
spin_unlock(_state_lock);
return -EBUSY;
}
+#endif
 
if (file->f_flags & O_EXCL)
nvram_open_mode |= NVRAM_EXCL;
Index: linux/include/linux/nvram.h
===
--- linux.orig/include/linux/nvram.h2015-05-31 11:01:08.0 +1000
+++ linux/include/linux/nvram.h 2015-05-31 11:01:17.0 +1000
@@ -17,8 +17,12 @@ struct nvram_ops {
unsigned char   (*read_byte)(int);
void(*write_byte)(unsigned char, int);
ssize_t (*get_size)(void);
+#ifdef CONFIG_PPC
+   long(*sync)(void);
+#else
long(*set_checksum)(void);
long(*initialize)(void);
+#endif
 };
 
 extern const struct nvram_ops arch_nvram_ops;
Index: linux/arch/powerpc/include/asm/nvram.h
===
--- linux.orig/arch/powerpc/include/asm/nvram.h 2015-05-31 11:01:16.0 
+1000
+++ linux/arch/powerpc/include/asm/nvram.h  2015-05-31 11:01:17.0 
+1000
@@ -78,9 +78,6 @@ extern intpmac_get_partition(int partit
 extern u8  pmac_xpram_read(int xpaddr);
 extern voidpmac_xpram_write(int xpaddr, u8 data);
 
-/* Synchronize NVRAM */
-extern voidnvram_sync(void);
-
 /* Initialize NVRAM OS partition */
 extern int __init nvram_init_os_partition(struct nvram_os_partition *part);
 
Index: linux/arch/powerpc/kernel/setup_32.c
===
--- linux.orig/arch/powerpc/kernel/setup_32.c   2015-05-31 11:01:16.0 
+1000
+++ linux/arch/powerpc/kernel/setup_32.c2015-05-31 11:01:17.0 
+1000
@@ -170,7 +170,6 @@ __setup("l3cr=", ppc_setup_l3cr);
 
 #ifdef 

[RFC 00/24] Re-use nvram module

2015-05-30 Thread Finn Thain

The generic NVRAM module, drivers/char/generic_nvram, implements a
/dev/nvram misc device. It is used only by 32-bit PowerPC platforms and
isn't generic enough to be more widely used.

The RTC NVRAM module, drivers/char/nvram, also implements a /dev/nvram
misc device. It is used by x86, ARM and m68k.

The former module cannot be used on x86, ARM or m68k because it
cannot co-exist with the latter module, partly due to the Kconfig logic.

It is possible to modify the modules so that one kernel binary could
have either, neither or both. However, automatically loading the
appropriate module is then impossible; if both provide the
char-major-10-144 alias then the wrong module will end up being loaded.
Hence a multi-platform kernel binary needs a single generic nvram module
with alias char-major-10-144.

Therefore, drivers/char/nvram.c should be made more generic and the
arch-specific code therein should be moved to a more appropriate
place under arch/. Also, drivers/char/generic_nvram.c should be removed
to reduce code duplication.

In this patch series, Atari-specific code is moved from the nvram module
to arch/m68k/atari. More arch-specific code in the nvram module could
be moved, probably to arch/x86, but it is difficult to determine just
what code is relevant to ARM platforms and what code is x86-only.

In addressing code duplication, this patch series removes three
inconsistent /dev/nvram misc device implementations. One of these,
drivers/macintosh/nvram.c is entirely unused already. The other two,
drivers/char/generic_nvram.c and the misc device implementation in
arch/powerpc/kernel/nvram_64.c, are replaced by drivers/char/nvram.c.

A benefit of this work is better consistency -- between PPC32 and PPC64
as well as between PPC_PMAC and MAC. This new uniformity does have
implications for userspace, that is, some error codes for some ioctl calls
become consistent on all PowerPC platforms.

The drivers/char/nvram module becomes sufficiently generic to be useful
to other platforms and architectures, besides those with "CMOS" RTC. At the
end of this patch series the module is adopted by the m68k Mac port, which
already has PRAM access functions but lacks the /dev/nvram misc device.

This patch series has been compile-tested for arm, m68k, powerpc and x86.
The nvram and thinkpad_acpi modules were regression tested on a ThinkPad T43.
The /dev/nvram functionality was also regression tested on a G3 PowerMac.
The nvram module was also tested on a PowerBook 520 and Quadra 650.
Note that my testing doesn't cover PPC64 or Atari.

---
 arch/m68k/Kconfig  |3 
 arch/m68k/atari/Makefile   |2 
 arch/m68k/atari/nvram.c|  304 
 arch/m68k/include/asm/atarihw.h|6 
 arch/m68k/include/asm/macintosh.h  |4 
 arch/m68k/kernel/setup_mm.c|   89 +++
 arch/m68k/mac/misc.c   |  157 --
 arch/powerpc/Kconfig   |5 
 arch/powerpc/include/asm/nvram.h   |9 
 arch/powerpc/kernel/nvram_64.c |  203 +---
 arch/powerpc/kernel/setup_32.c |   27 -
 arch/powerpc/platforms/chrp/Makefile   |2 
 arch/powerpc/platforms/chrp/nvram.c|   14 
 arch/powerpc/platforms/chrp/setup.c|2 
 arch/powerpc/platforms/powermac/Makefile   |5 
 arch/powerpc/platforms/powermac/nvram.c|   11 
 arch/powerpc/platforms/powermac/setup.c|3 
 drivers/char/Kconfig   |   13 
 drivers/char/Makefile  |6 
 drivers/char/generic_nvram.c   |  174 --
 drivers/char/nvram.c   |  731 -
 drivers/macintosh/nvram.c  |  130 -
 drivers/platform/x86/thinkpad_acpi.c   |   20 
 drivers/scsi/Kconfig   |6 
 drivers/scsi/atari_scsi.c  |   16 
 drivers/video/fbdev/controlfb.c|4 
 drivers/video/fbdev/imsttfb.c  |7 
 drivers/video/fbdev/matrox/matroxfb_base.c |4 
 drivers/video/fbdev/platinumfb.c   |4 
 drivers/video/fbdev/valkyriefb.c   |4 
 include/linux/nvram.h  |   23 
 include/uapi/linux/pmu.h   |2 
 32 files changed, 950 insertions(+), 1040 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/


[RFC 22/24] m68k/mac: Adopt nvram module

2015-05-30 Thread Finn Thain
Implement arch_nvram_ops and adjust calling conventions of mac_pram_*
functions to match the ops struct methods. Rename via_pram_readbyte and
via_pram_writebyte to avoid confusion and follow the existing
nvram_*_read_byte and nvram_*_write_byte naming convention.

Enable CONFIG_HAVE_ARCH_NVRAM_OPS on Macs.

Signed-off-by: Finn Thain 

---

The arch_nvram_ops struct can only be defined once, of course, so the
Mac and Atari ops structs are mutually exclusive. The final patch will
allow the two implementations to co-exist in a multi-platform kernel binary.

---
 arch/m68k/Kconfig|2 
 arch/m68k/mac/misc.c |  120 +++
 2 files changed, 76 insertions(+), 46 deletions(-)

Index: linux/arch/m68k/Kconfig
===
--- linux.orig/arch/m68k/Kconfig2015-05-31 11:01:11.0 +1000
+++ linux/arch/m68k/Kconfig 2015-05-31 11:01:26.0 +1000
@@ -72,7 +72,7 @@ config PGTABLE_LEVELS
default 3
 
 config HAVE_ARCH_NVRAM_OPS
-   def_bool ATARI
+   def_bool (ATARI && !MAC) || (MAC && !ATARI)
 
 source "init/Kconfig"
 
Index: linux/arch/m68k/mac/misc.c
===
--- linux.orig/arch/m68k/mac/misc.c 2015-05-31 11:00:59.0 +1000
+++ linux/arch/m68k/mac/misc.c  2015-05-31 11:01:26.0 +1000
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -61,7 +62,8 @@ static void cuda_write_time(long data)
cuda_poll();
 }
 
-static __u8 cuda_read_pram(int offset)
+#if IS_ENABLED(CONFIG_NVRAM)
+static unsigned char cuda_pram_read_byte(int offset)
 {
struct adb_request req;
if (cuda_request(, NULL, 4, CUDA_PACKET, CUDA_GET_PRAM,
@@ -72,7 +74,7 @@ static __u8 cuda_read_pram(int offset)
return req.reply[3];
 }
 
-static void cuda_write_pram(int offset, __u8 data)
+static void cuda_pram_write_byte(unsigned char data, int offset)
 {
struct adb_request req;
if (cuda_request(, NULL, 5, CUDA_PACKET, CUDA_SET_PRAM,
@@ -81,11 +83,13 @@ static void cuda_write_pram(int offset,
while (!req.complete)
cuda_poll();
 }
+#endif /* CONFIG_NVRAM */
+
 #else
 #define cuda_read_time() 0
 #define cuda_write_time(n)
-#define cuda_read_pram NULL
-#define cuda_write_pram NULL
+#define cuda_pram_read_byte NULL
+#define cuda_pram_write_byte NULL
 #endif
 
 #ifdef CONFIG_ADB_PMU68K
@@ -116,7 +120,8 @@ static void pmu_write_time(long data)
pmu_poll();
 }
 
-static __u8 pmu_read_pram(int offset)
+#if IS_ENABLED(CONFIG_NVRAM)
+static unsigned char pmu_pram_read_byte(int offset)
 {
struct adb_request req;
if (pmu_request(, NULL, 3, PMU_READ_NVRAM,
@@ -127,7 +132,7 @@ static __u8 pmu_read_pram(int offset)
return req.reply[3];
 }
 
-static void pmu_write_pram(int offset, __u8 data)
+static void pmu_pram_write_byte(unsigned char data, int offset)
 {
struct adb_request req;
if (pmu_request(, NULL, 4, PMU_WRITE_NVRAM,
@@ -136,11 +141,13 @@ static void pmu_write_pram(int offset, _
while (!req.complete)
pmu_poll();
 }
+#endif /* CONFIG_NVRAM */
+
 #else
 #define pmu_read_time() 0
 #define pmu_write_time(n)
-#define pmu_read_pram NULL
-#define pmu_write_pram NULL
+#define pmu_pram_read_byte NULL
+#define pmu_pram_write_byte NULL
 #endif
 
 #if 0 /* def CONFIG_ADB_MACIISI */
@@ -169,7 +176,8 @@ static void maciisi_write_time(long data
(data >> 8) & 0xFF, data & 0xFF);
 }
 
-static __u8 maciisi_read_pram(int offset)
+#if IS_ENABLED(CONFIG_NVRAM)
+static unsigned char maciisi_pram_read_byte(int offset)
 {
struct adb_request req;
if (maciisi_request(, NULL, 4, CUDA_PACKET, CUDA_GET_PRAM,
@@ -178,17 +186,19 @@ static __u8 maciisi_read_pram(int offset
return req.reply[3];
 }
 
-static void maciisi_write_pram(int offset, __u8 data)
+static void maciisi_pram_write_byte(unsigned char data, int offset)
 {
struct adb_request req;
maciisi_request(, NULL, 5, CUDA_PACKET, CUDA_SET_PRAM,
(offset >> 8) & 0xFF, offset & 0xFF, data);
 }
+#endif /* CONFIG_NVRAM */
+
 #else
 #define maciisi_read_time() 0
 #define maciisi_write_time(n)
-#define maciisi_read_pram NULL
-#define maciisi_write_pram NULL
+#define maciisi_pram_read_byte NULL
+#define maciisi_pram_write_byte NULL
 #endif
 
 /*
@@ -198,7 +208,7 @@ static void maciisi_write_pram(int offse
  * the RTC should be enabled.
  */
 
-static __u8 via_pram_readbyte(void)
+static __u8 via_pram_recv(void)
 {
int i,reg;
__u8data;
@@ -225,7 +235,7 @@ static __u8 via_pram_readbyte(void)
return data;
 }
 
-static void via_pram_writebyte(__u8 data)
+static void via_pram_send(__u8 data)
 {
int i,reg,bit;
 
@@ -262,17 +272,17 @@ static void via_pram_command(int command
via1[vBufB] = (via1[vBufB] | VIA1B_vRTCClk) & 

[RFC 05/24] char/nvram: Re-order functions to remove forward declarations and #ifdefs

2015-05-30 Thread Finn Thain
Also give functions more sensible names: nvram_misc_* for misc device ops,
nvram_proc_* for proc file ops and nvram_module_* for init and exit
functions. This makes them distict from nvram_ops members.

Signed-off-by: Finn Thain 

---
 drivers/char/nvram.c |  194 ++-
 1 file changed, 86 insertions(+), 108 deletions(-)

Index: linux/drivers/char/nvram.c
===
--- linux.orig/drivers/char/nvram.c 2015-05-31 11:01:01.0 +1000
+++ linux/drivers/char/nvram.c  2015-05-31 11:01:05.0 +1000
@@ -54,11 +54,6 @@ static int nvram_open_mode;  /* special o
 #define NVRAM_WRITE1 /* opened for writing (exclusive) */
 #define NVRAM_EXCL 2 /* opened with O_EXCL */
 
-#ifdef CONFIG_PROC_FS
-static void pc_nvram_proc_read(unsigned char *contents, struct seq_file *seq,
-   void *offset);
-#endif
-
 /*
  * These functions are provided to be called internally or by other parts of
  * the kernel. It's up to the caller to ensure correct checksum before reading
@@ -170,7 +165,7 @@ void nvram_set_checksum(void)
  * The are the file operation function for user access to /dev/nvram
  */
 
-static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
+static loff_t nvram_misc_llseek(struct file *file, loff_t offset, int origin)
 {
switch (origin) {
case 0:
@@ -189,8 +184,8 @@ static loff_t nvram_llseek(struct file *
return (offset >= 0) ? (file->f_pos = offset) : -EINVAL;
 }
 
-static ssize_t nvram_read(struct file *file, char __user *buf,
-   size_t count, loff_t *ppos)
+static ssize_t nvram_misc_read(struct file *file, char __user *buf,
+   size_t count, loff_t *ppos)
 {
unsigned char contents[NVRAM_BYTES];
unsigned i = *ppos;
@@ -218,8 +213,8 @@ checksum_err:
return -EIO;
 }
 
-static ssize_t nvram_write(struct file *file, const char __user *buf,
-   size_t count, loff_t *ppos)
+static ssize_t nvram_misc_write(struct file *file, const char __user *buf,
+size_t count, loff_t *ppos)
 {
unsigned char contents[NVRAM_BYTES];
unsigned i = *ppos;
@@ -257,8 +252,8 @@ checksum_err:
return -EIO;
 }
 
-static long nvram_ioctl(struct file *file, unsigned int cmd,
-   unsigned long arg)
+static long nvram_misc_ioctl(struct file *file, unsigned int cmd,
+ unsigned long arg)
 {
int i;
 
@@ -298,7 +293,7 @@ static long nvram_ioctl(struct file *fil
}
 }
 
-static int nvram_open(struct inode *inode, struct file *file)
+static int nvram_misc_open(struct inode *inode, struct file *file)
 {
spin_lock(_state_lock);
 
@@ -320,7 +315,7 @@ static int nvram_open(struct inode *inod
return 0;
 }
 
-static int nvram_release(struct inode *inode, struct file *file)
+static int nvram_misc_release(struct inode *inode, struct file *file)
 {
spin_lock(_state_lock);
 
@@ -337,100 +332,6 @@ static int nvram_release(struct inode *i
return 0;
 }
 
-#ifndef CONFIG_PROC_FS
-static int nvram_add_proc_fs(void)
-{
-   return 0;
-}
-
-#else
-
-static int nvram_proc_read(struct seq_file *seq, void *offset)
-{
-   unsigned char contents[NVRAM_BYTES];
-   int i = 0;
-
-   spin_lock_irq(_lock);
-   for (i = 0; i < NVRAM_BYTES; ++i)
-   contents[i] = __nvram_read_byte(i);
-   spin_unlock_irq(_lock);
-
-   pc_nvram_proc_read(contents, seq, offset);
-
-   return 0;
-}
-
-static int nvram_proc_open(struct inode *inode, struct file *file)
-{
-   return single_open(file, nvram_proc_read, NULL);
-}
-
-static const struct file_operations nvram_proc_fops = {
-   .owner  = THIS_MODULE,
-   .open   = nvram_proc_open,
-   .read   = seq_read,
-   .llseek = seq_lseek,
-   .release= single_release,
-};
-
-static int nvram_add_proc_fs(void)
-{
-   if (!proc_create("driver/nvram", 0, NULL, _proc_fops))
-   return -ENOMEM;
-   return 0;
-}
-
-#endif /* CONFIG_PROC_FS */
-
-static const struct file_operations nvram_fops = {
-   .owner  = THIS_MODULE,
-   .llseek = nvram_llseek,
-   .read   = nvram_read,
-   .write  = nvram_write,
-   .unlocked_ioctl = nvram_ioctl,
-   .open   = nvram_open,
-   .release= nvram_release,
-};
-
-static struct miscdevice nvram_dev = {
-   NVRAM_MINOR,
-   "nvram",
-   _fops
-};
-
-static int __init nvram_init(void)
-{
-   int ret;
-
-   ret = misc_register(_dev);
-   if (ret) {
-   printk(KERN_ERR "nvram: can't misc_register on minor=%d\n",
-   NVRAM_MINOR);
-   goto out;
-   }
-   ret = 

[RFC 20/24] char/generic_nvram: Remove as unused

2015-05-30 Thread Finn Thain
And thus eliminate some twisted CONFIG_GENERIC_NVRAM logic.

Signed-off-by: Finn Thain 

---
 drivers/char/Makefile|6 -
 drivers/char/generic_nvram.c |  176 ---
 2 files changed, 1 insertion(+), 181 deletions(-)

Index: linux/drivers/char/Makefile
===
--- linux.orig/drivers/char/Makefile2015-05-31 11:00:59.0 +1000
+++ linux/drivers/char/Makefile 2015-05-31 11:01:23.0 +1000
@@ -30,11 +30,7 @@ obj-$(CONFIG_GEN_RTC)+= genrtc.o
 obj-$(CONFIG_EFI_RTC)  += efirtc.o
 obj-$(CONFIG_DS1302)   += ds1302.o
 obj-$(CONFIG_XILINX_HWICAP)+= xilinx_hwicap/
-ifeq ($(CONFIG_GENERIC_NVRAM),y)
-  obj-$(CONFIG_NVRAM)  += generic_nvram.o
-else
-  obj-$(CONFIG_NVRAM)  += nvram.o
-endif
+obj-$(CONFIG_NVRAM)+= nvram.o
 obj-$(CONFIG_TOSHIBA)  += toshiba.o
 obj-$(CONFIG_I8K)  += i8k.o
 obj-$(CONFIG_DS1620)   += ds1620.o
Index: linux/drivers/char/generic_nvram.c
===
--- linux.orig/drivers/char/generic_nvram.c 2015-05-31 11:01:19.0 
+1000
+++ /dev/null   1970-01-01 00:00:00.0 +
@@ -1,176 +0,0 @@
-/*
- * Generic /dev/nvram driver for architectures providing some
- * "generic" hooks, that is :
- *
- * nvram_read_byte, nvram_write_byte, nvram_sync, nvram_get_size
- *
- * Note that an additional hook is supported for PowerMac only
- * for getting the nvram "partition" informations
- *
- */
-
-#define NVRAM_VERSION "1.1"
-
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#ifdef CONFIG_PPC_PMAC
-#include 
-#include 
-#endif
-
-static DEFINE_MUTEX(nvram_mutex);
-static ssize_t nvram_len;
-
-static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
-{
-   switch (origin) {
-   case 0:
-   break;
-   case 1:
-   offset += file->f_pos;
-   break;
-   case 2:
-   offset += nvram_len;
-   break;
-   default:
-   offset = -1;
-   }
-   if (offset < 0)
-   return -EINVAL;
-
-   file->f_pos = offset;
-
-   return file->f_pos;
-}
-
-static ssize_t read_nvram(struct file *file, char __user *buf,
- size_t count, loff_t *ppos)
-{
-   unsigned int i;
-   char __user *p = buf;
-
-   if (!access_ok(VERIFY_WRITE, buf, count))
-   return -EFAULT;
-   if (*ppos >= nvram_len)
-   return 0;
-   for (i = *ppos; count > 0 && i < nvram_len; ++i, ++p, --count)
-   if (__put_user(arch_nvram_ops.read_byte(i), p))
-   return -EFAULT;
-   *ppos = i;
-   return p - buf;
-}
-
-static ssize_t write_nvram(struct file *file, const char __user *buf,
-  size_t count, loff_t *ppos)
-{
-   unsigned int i;
-   const char __user *p = buf;
-   char c;
-
-   if (!access_ok(VERIFY_READ, buf, count))
-   return -EFAULT;
-   if (*ppos >= nvram_len)
-   return 0;
-   for (i = *ppos; count > 0 && i < nvram_len; ++i, ++p, --count) {
-   if (__get_user(c, p))
-   return -EFAULT;
-   arch_nvram_ops.write_byte(c, i);
-   }
-   *ppos = i;
-   return p - buf;
-}
-
-static int nvram_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
-{
-   switch(cmd) {
-#ifdef CONFIG_PPC_PMAC
-   case OBSOLETE_PMAC_NVRAM_GET_OFFSET:
-   printk(KERN_WARNING "nvram: Using obsolete 
PMAC_NVRAM_GET_OFFSET ioctl\n");
-   case IOC_NVRAM_GET_OFFSET: {
-   int part, offset;
-
-   if (!machine_is(powermac))
-   return -EINVAL;
-   if (copy_from_user(, (void __user*)arg, sizeof(part)) != 0)
-   return -EFAULT;
-   if (part < pmac_nvram_OF || part > pmac_nvram_NR)
-   return -EINVAL;
-   offset = pmac_get_partition(part);
-   if (copy_to_user((void __user*)arg, , sizeof(offset)) != 
0)
-   return -EFAULT;
-   break;
-   }
-#endif /* CONFIG_PPC_PMAC */
-   case IOC_NVRAM_SYNC:
-   arch_nvram_ops.sync();
-   break;
-   default:
-   return -EINVAL;
-   }
-
-   return 0;
-}
-
-static long nvram_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned 
long arg)
-{
-   int ret;
-
-   mutex_lock(_mutex);
-   ret = nvram_ioctl(file, cmd, arg);
-   mutex_unlock(_mutex);
-
-   return ret;
-}
-
-const struct file_operations nvram_fops = {
-   .owner  = THIS_MODULE,
-   .llseek = nvram_llseek,
-   .read   = read_nvram,
-   .write  = write_nvram,
-   .unlocked_ioctl = 

[RFC 12/24] char/nvram: Add "devname:nvram" module alias

2015-05-30 Thread Finn Thain
Signed-off-by: Finn Thain 

---
 drivers/char/nvram.c |1 +
 1 file changed, 1 insertion(+)

Index: linux/drivers/char/nvram.c
===
--- linux.orig/drivers/char/nvram.c 2015-05-31 11:01:11.0 +1000
+++ linux/drivers/char/nvram.c  2015-05-31 11:01:13.0 +1000
@@ -575,3 +575,4 @@ module_exit(nvram_module_exit);
 
 MODULE_LICENSE("GPL");
 MODULE_ALIAS_MISCDEV(NVRAM_MINOR);
+MODULE_ALIAS("devname:nvram");


--
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 2/3] kconfig: Wrap long "make help" text lines

2015-05-30 Thread Diego Viola
Hello,

Can you please include a minor change in your patch?

At line 89, there's this:

# on its behavior(sets new symbols to their default value but not 'n') with the

Please change this line to this:

# on its behavior (sets new symbols to their default value but not 'n') with the

There should be a space between "behavior" and the parentheses/bracket.

Thanks,

Diego

On Tue, May 26, 2015 at 8:39 AM, Geert Uytterhoeven
 wrote:
> Some "make help" text lines extend beyond 80 characters. Wrap them at 79
> characters.
>
> Signed-off-by: Geert Uytterhoeven 
> ---
>  scripts/kconfig/Makefile | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
> index d9b1fef0c67e3cb4..d19de3665bfbe984 100644
> --- a/scripts/kconfig/Makefile
> +++ b/scripts/kconfig/Makefile
> @@ -122,7 +122,8 @@ tinyconfig:
>  # Help text used by make help
>  help:
> @echo  '  config  - Update current config utilising a 
> line-oriented program'
> -   @echo  '  nconfig - Update current config utilising a ncurses 
> menu based program'
> +   @echo  '  nconfig - Update current config utilising a ncurses 
> menu based'
> +   @echo  'program'
> @echo  '  menuconfig  - Update current config utilising a menu 
> based program'
> @echo  '  xconfig - Update current config utilising a QT 
> based front-end'
> @echo  '  gconfig - Update current config utilising a GTK 
> based front-end'
> @@ -138,7 +139,8 @@ help:
> @echo  '  alldefconfig- New config with all symbols set to 
> default'
> @echo  '  randconfig  - New config with random answer to all 
> options'
> @echo  '  listnewconfig   - List new options'
> -   @echo  '  olddefconfig- Same as silentoldconfig but sets new 
> symbols to their default value'
> +   @echo  '  olddefconfig- Same as silentoldconfig but sets new 
> symbols to their'
> +   @echo  'default value'
> @echo  '  kvmconfig   - Enable additional options for guest 
> kernel support'
> @echo  '  tinyconfig  - Configure the tiniest possible kernel'
>
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
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] if_vlan: fix vlaue -> value typo

2015-05-30 Thread David Miller
From: Vivien Didelot 
Date: Wed, 27 May 2015 21:07:26 -0400

> Fixes "vlaue" for "value" in include/linux/if_vlan.h.
> 
> Signed-off-by: Vivien Didelot 

Applied, 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 1/1] drivers: staging: rtl8192e: rtllib_softmac.c: auth parse error code byte order fix

2015-05-30 Thread Greg Kroah-Hartman
On Tue, May 12, 2015 at 08:43:10PM -0700, Tolga Ceylan wrote:
> Error code returned from auth_parse() should in cpu byte order. Issue
> caught by sparse warning: cast from restricted __le16.
> 
> Signed-off-by: Tolga Ceylan 
> ---
>  drivers/staging/rtl8192e/rtllib_softmac.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c 
> b/drivers/staging/rtl8192e/rtllib_softmac.c
> index 8f5e88b..98afd3b 100644
> --- a/drivers/staging/rtl8192e/rtllib_softmac.c
> +++ b/drivers/staging/rtl8192e/rtllib_softmac.c
> @@ -1814,7 +1814,7 @@ static inline u16 auth_parse(struct sk_buff *skb, u8 
> **challenge, int *chlen)
>   return -ENOMEM;
>   }
>   }
> - return cpu_to_le16(a->status);
> + return le16_to_cpu(a->status);

Doesn't apply to my tree :(
--
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] Staging: rtl8192e: Timer setup using macro rather assignment

2015-05-30 Thread gre...@linuxfoundation.org
On Mon, May 18, 2015 at 10:12:42PM +0530, Sudip Mukherjee wrote:
> On Mon, May 18, 2015 at 09:26:03AM -0700, Joe Perches wrote:
> > On Mon, 2015-05-18 at 21:35 +0530, Sudip Mukherjee wrote:
> > > On Mon, May 18, 2015 at 02:44:15PM +, DHANAPAL, GNANACHANDRAN (G.) 
> > > wrote:
> > > > setup_timer is used for timer parameter setup rather than direct
> > > > assignment
> > > > 
> > > > Signed-off-by: Gnanachandran Dhanapal 
> > > 
> > > your From: name and Signed-off-by: names are not matching. They should
> > > be same.
> > 
> > If there's a specific "From: " in the _body_ of the email,
> > that's true, but the sender email "From: " header and the
> > Signed-off-by: line do not have to match.
> But Greg usually rejects these patches where the sender "From:" header
> and Signed-off-by: doesnot match. Just for example:
> 
> https://lkml.org/lkml/2014/11/25/924

Yes, I can't take it where it doesn't match up.

Sometimes I miss it, but when it's pointed out, I will not accept it.

thanks,

greg k-h
--
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 1/2] staging: ion: Add generic ion-physmem driver

2015-05-30 Thread Greg Kroah-Hartman
On Sat, Apr 11, 2015 at 12:12:59AM +0300, Andrew Andrianov wrote:
> Signed-off-by: Andrew Andrianov 

You need something here in the changelog entry, you just added a whole
new driver.  Please give some information as to what it does, why we
need it, and how to use it.

> ---
>  drivers/staging/android/ion/Kconfig   |7 +
>  drivers/staging/android/ion/Makefile  |5 +-
>  drivers/staging/android/ion/ion_physmem.c |  226 
> +
>  include/dt-bindings/ion,physmem.h |   17 +++
>  4 files changed, 253 insertions(+), 2 deletions(-)
>  create mode 100644 drivers/staging/android/ion/ion_physmem.c
>  create mode 100644 include/dt-bindings/ion,physmem.h
> 
> diff --git a/drivers/staging/android/ion/Kconfig 
> b/drivers/staging/android/ion/Kconfig
> index 3452346..c558cf8 100644
> --- a/drivers/staging/android/ion/Kconfig
> +++ b/drivers/staging/android/ion/Kconfig
> @@ -33,3 +33,10 @@ config ION_TEGRA
>   help
> Choose this option if you wish to use ion on an nVidia Tegra.
>  
> +config ION_PHYSMEM
> + bool "Generic PhysMem ION driver"
> + depends on ION
> + help
> +   Provides a generic ION driver that registers the
> +   /dev/ion device with heaps from devicetree entries.
> +   This heaps are made of chunks of physical memory
> diff --git a/drivers/staging/android/ion/Makefile 
> b/drivers/staging/android/ion/Makefile
> index b56fd2b..ac9856d 100644
> --- a/drivers/staging/android/ion/Makefile
> +++ b/drivers/staging/android/ion/Makefile
> @@ -5,6 +5,7 @@ ifdef CONFIG_COMPAT
>  obj-$(CONFIG_ION) += compat_ion.o
>  endif
>  
> -obj-$(CONFIG_ION_DUMMY) += ion_dummy_driver.o
> -obj-$(CONFIG_ION_TEGRA) += tegra/
> +obj-$(CONFIG_ION_DUMMY)   += ion_dummy_driver.o
> +obj-$(CONFIG_ION_PHYSMEM) += ion_physmem.o
> +obj-$(CONFIG_ION_TEGRA)   += tegra/
>  
> diff --git a/drivers/staging/android/ion/ion_physmem.c 
> b/drivers/staging/android/ion/ion_physmem.c
> new file mode 100644
> index 000..5ebcd85
> --- /dev/null
> +++ b/drivers/staging/android/ion/ion_physmem.c
> @@ -0,0 +1,226 @@
> +/*
> + * Copyright (C) 2015 RC Module
> + * Andrew Andrianov 
> + *
> + * 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.
> + *
> + * Generic devicetree physmem driver for ION Memory Manager
> + *
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include "ion.h"
> +#include "ion_priv.h"
> +
> +#define DRVNAME "ion-physmem"
> +
> +static struct ion_device *idev;
> +static int num_heaps_registered;
> +static uint32_t claimed_heap_ids;
> +
> +static const struct of_device_id of_match_table[] = {
> + { .compatible = "ion,physmem", },
> + { /* end of list */ }
> +};
> +
> +struct physmem_ion_dev {
> + struct ion_platform_heap  data;
> + struct ion_heap  *heap;
> + int   need_free_coherent;
> + void *freepage_ptr;
> + struct clk   *clk;
> +};
> +
> +static int ion_physmem_probe(struct platform_device *pdev)
> +{
> + int ret;
> + u32 ion_heap_id, ion_heap_align, ion_heap_type;
> + ion_phys_addr_t addr;
> + size_t size = 0;
> + const char *ion_heap_name = NULL;
> + struct resource *res;
> + struct physmem_ion_dev *ipdev;
> +
> + /*
> +Looks like we can only have one ION device in our system.
> +Therefore we call ion_device_create on first probe and only
> +add heaps to it on subsequent probe calls.
> +FixMe:
> +1. Do we need to hold a spinlock here?
> +2. Can several probes race here on SMP?
> + */
> +
> + if (!idev) {
> + idev = ion_device_create(NULL);
> + dev_info(>dev, "ION PhysMem Driver. (c) RC Module 
> 2015\n");
> + if (!idev)
> + return -ENOMEM;
> + }
> +
> + ipdev = kzalloc(sizeof(struct physmem_ion_dev), GFP_KERNEL);
> + if (!ipdev)
> + return -ENOMEM;
> +
> + platform_set_drvdata(pdev, ipdev);
> +
> + /* Read out name first for the sake of sane error-reporting */
> + ret =  of_property_read_string(pdev->dev.of_node, "ion-heap-name",
> +_heap_name);
> + if (ret != 0)
> + goto errfreeipdev;
> +
> + ret =  of_property_read_u32(pdev->dev.of_node, "ion-heap-id",
> + _heap_id);
> + if (ret != 0)
> + goto errfreeipdev;
> +
> + /* Check id to be sane first */
> + if ((ion_heap_id < 0) || (ion_heap_id >= ION_NUM_HEAP_IDS)) {
> + dev_err(>dev, "bad heap id specified: %d\n",
> + ion_heap_id);
> + goto errfreeipdev;
> + }
> +
> + if ((1 << ion_heap_id) & claimed_heap_ids) {
> + dev_err(>dev, "heap id %d 

Re: [PATCH V2 net-next 1/1] hv_netvsc: Properly size the vrss queues

2015-05-30 Thread David Miller
From: "K. Y. Srinivasan" 
Date: Wed, 27 May 2015 13:16:57 -0700

> The current algorithm for deciding on the number of VRSS channels is
> not optimal since we open up the min of number of CPUs online and the
> number of VRSS channels the host is offering. So on a 32 VCPU guest
> we could potentially open 32 VRSS subchannels. Experimentation has
> shown that it is best to limit the number of VRSS channels to the number
> of CPUs within a NUMA node.
> 
> Here is the new algorithm for deciding on the number of sub-channels we
> would open up:
> 1) Pick the minimum of what the host is offering and what the driver
>in the guest is specifying as the default value.
> 2) Pick the minimum of (1) and the numbers of CPUs in the NUMA
>node the primary channel is bound to.
> 
> 
> Signed-off-by: K. Y. Srinivasan 

Applied, 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 2/2] staging: wilc1000: Cleanup to coreconfigurator

2015-05-30 Thread Greg KH
On Sat, May 30, 2015 at 11:44:19PM +0300, Stanislav Kholmanskikh wrote:
> Fixed several syntax/style issues found with checkpatch.pl, plus
> aligned structs/enums to follow a common style per struct/enum.

Again, please only do one thing per patch.

thanks,

greg k-h
--
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] staging: wilc1000: Fix some compile warnings

2015-05-30 Thread Greg KH
On Sat, May 30, 2015 at 11:44:18PM +0300, Stanislav Kholmanskikh wrote:
> This patch reduces (a little bit) the amount of compile time
> warnings.
> 
> The change of WILC_WFI_init_mon_interface() prototype seems to be ok,
> because alloc_netdev() also expects 'const char *name'.

You are doing different types of fixes here, please be explicit about
what you are doing and break this up into logical patches that each only
do one type of thing.

thanks,

greg k-h
--
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 05/16] staging: wilc1000: remove time wrapper

2015-05-30 Thread Greg KH
On Sat, May 30, 2015 at 12:09:23PM +0530, Sudip Mukherjee wrote:
> On Fri, May 29, 2015 at 10:52:16PM +0200, Arnd Bergmann wrote:
> > The abstraction for time in this driver is completely
> > unused, so remove it.
> > 
> > Signed-off-by: Arnd Bergmann 
> > ---
> >  drivers/staging/wilc1000/wilc_osconfig.h  |   1 -
> >  drivers/staging/wilc1000/wilc_oswrapper.h |   5 -
> >  drivers/staging/wilc1000/wilc_platform.h  |  12 --
> >  drivers/staging/wilc1000/wilc_time.c  | 163 
> >  drivers/staging/wilc1000/wilc_time.h  | 205 
> > --
> >  5 files changed, 386 deletions(-)
> >  delete mode 100644 drivers/staging/wilc1000/wilc_time.c
> >  delete mode 100644 drivers/staging/wilc1000/wilc_time.h
> after this patch I am getting:
> "WARNING: could not open drivers/staging/wilc1000/wilc_time.c: No such file 
> or directory"
> 
> wilc_time is mentioned in the Makefile, it should have been removed from
> there also.

Ick, not good.

Arnd, I've applied the first 4 patches, but stopped here, can you respin
the rest and resend?

thanks,

greg k-h
--
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 v3 5/5] sched/core: remove superfluous resetting of dl_throttled flag

2015-05-30 Thread Wanpeng Li
Resetting dl_throttled flag in rt_mutex_setprio (for a task that is going
to be boosted) is superfluous, as the natural place to do so is in
replenish_dl_entity(). If the task was on the runqueue and it is boosted
by a DL task, it will be enqueued back with ENQUEUE_REPLENISH flag set,
which can guarantee that dl_throttled is reset in replenish_dl_entity().

This patch drops the resetting of throttled status in function
rt_mutex_setprio().

Signed-off-by: Wanpeng Li 
---
v1 -> v2:
 * rewrite patch subject and changelog

 kernel/sched/core.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 5140db6..ef2ddd6 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3076,7 +3076,6 @@ void rt_mutex_setprio(struct task_struct *p, int prio)
if (!dl_prio(p->normal_prio) ||
(pi_task && dl_entity_preempt(_task->dl, >dl))) {
p->dl.dl_boosted = 1;
-   p->dl.dl_throttled = 0;
enqueue_flag = ENQUEUE_REPLENISH;
} else
p->dl.dl_boosted = 0;
-- 
1.9.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 v3 4/5] sched/deadline: drop duplicate init_sched_dl_class declaration

2015-05-30 Thread Wanpeng Li
There are two init_sched_dl_class declarations, this patch drop
the duplicated one.

Signed-off-by: Wanpeng Li 
---
v1 -> v2:
 * trim the changelog

 kernel/sched/sched.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index d854555..d62b288 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1290,7 +1290,6 @@ extern void update_max_interval(void);
 extern void init_sched_dl_class(void);
 extern void init_sched_rt_class(void);
 extern void init_sched_fair_class(void);
-extern void init_sched_dl_class(void);
 
 extern void resched_curr(struct rq *rq);
 extern void resched_cpu(int cpu);
-- 
1.9.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 v3 3/5] sched/deadline: reduce rq lock contention by eliminating locking of non-feasible target

2015-05-30 Thread Wanpeng Li
This patch adds check that prevents futile attempts to move dl tasks to
a CPU with active tasks of equal or earlier deadline. The same behavior as
commit 80e3d87b2c55 ("sched/rt: Reduce rq lock contention by eliminating
locking of non-feasible target") for rt class.

Signed-off-by: Wanpeng Li 
---
v1 -> v2:
 * add check in find_lock_later_rq()

 kernel/sched/deadline.c | 15 ++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 4303af2..e49b1e6 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1012,7 +1012,9 @@ select_task_rq_dl(struct task_struct *p, int cpu, int 
sd_flag, int flags)
(p->nr_cpus_allowed > 1)) {
int target = find_later_rq(p);
 
-   if (target != -1)
+   if (target != -1 &&
+   dl_time_before(p->dl.deadline,
+   cpu_rq(target)->dl.earliest_dl.curr))
cpu = target;
}
rcu_read_unlock();
@@ -1360,6 +1362,17 @@ static struct rq *find_lock_later_rq(struct task_struct 
*task, struct rq *rq)
 
later_rq = cpu_rq(cpu);
 
+   if (!dl_time_before(task->dl.deadline,
+   later_rq->dl.earliest_dl.curr)) {
+   /*
+* Target rq has tasks of equal or earlier deadline,
+* retrying does not release any lock and is unlikely
+* to yield a different result.
+*/
+   later_rq = NULL;
+   break;
+   }
+
/* Retry if something changed. */
if (double_lock_balance(rq, later_rq)) {
if (unlikely(task_rq(task) != rq ||
-- 
1.9.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 v3 2/5] sched/deadline: make init_sched_dl_class() __init

2015-05-30 Thread Wanpeng Li
It's a bootstrap function, make init_sched_dl_class() __init.

Signed-off-by: Wanpeng Li 
---
 kernel/sched/deadline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index f09f3ad..4303af2 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1686,7 +1686,7 @@ static void rq_offline_dl(struct rq *rq)
cpudl_clear_freecpu(>rd->cpudl, rq->cpu);
 }
 
-void init_sched_dl_class(void)
+void __init init_sched_dl_class(void)
 {
unsigned int i;
 
-- 
1.9.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 v3 1/5] sched/deadline: fix try to pull pinned dl tasks in pull algorithm

2015-05-30 Thread Wanpeng Li
Function pick_next_earliest_dl_task is used to pick earliest and pushable
dl task from overloaded cpus in pull algorithm, however, it traverses
runqueue rbtree instead of pushable task rbtree which is also ordered by
tasks' deadlines. This will result in getting no candidates from overloaded
cpus if all the dl tasks on the overloaded cpus are pinned. This patch fix
it by traversing pushable task rbtree which is also ordered by tasks'
deadlines.

Signed-off-by: Wanpeng Li 
---
 kernel/sched/deadline.c | 29 -
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 890ce95..f09f3ad 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1230,6 +1230,33 @@ next_node:
return NULL;
 }
 
+/*
+ * Return the earliest pushable rq's task, which is suitable to be executed
+ * on the cpu, NULL otherwse
+ */
+static struct task_struct *pick_earliest_pushable_dl_task(struct rq *rq,
+   int cpu)
+{
+   struct rb_node *next_node = rq->dl.pushable_dl_tasks_leftmost;
+   struct task_struct *p = NULL;
+
+   if (!has_pushable_dl_tasks(rq))
+   return NULL;
+
+next_node:
+   if (next_node) {
+   p = rb_entry(next_node, struct task_struct, pushable_dl_tasks);
+
+   if (pick_dl_task(rq, p, cpu))
+   return p;
+
+   next_node = rb_next(next_node);
+   goto next_node;
+   }
+
+   return NULL;
+}
+
 static DEFINE_PER_CPU(cpumask_var_t, local_cpu_mask_dl);
 
 static int find_later_rq(struct task_struct *task)
@@ -1514,7 +1541,7 @@ static int pull_dl_task(struct rq *this_rq)
if (src_rq->dl.dl_nr_running <= 1)
goto skip;
 
-   p = pick_next_earliest_dl_task(src_rq, this_cpu);
+   p = pick_earliest_pushable_dl_task(src_rq, this_cpu);
 
/*
 * We found a task to be pulled if:
-- 
1.9.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/


Re: [PATCH v4 05/12] devicetree: Add bindings for the ATH79 MISC interrupt controllers

2015-05-30 Thread Sergey Ryazanov
2015-05-31 2:52 GMT+03:00 Alban Bedel :
> +
> +Example:
> +
> +   interrupt-controller@18060010 {
> +   compatible = "qca,ar9132-misc-intc", qca,ar7100-misc-intc";

Sorry for meticulousness, but seems you missed a quote :)

-- 
Sergey
--
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 v4 12/12] MIPS: Add basic support for the TL-WR1043ND version 1

2015-05-30 Thread Alban Bedel
Add a DTS for TL-WR1043ND version 1 and allow to have it built in the
kernel to circumvent the broken u-boot found on these boards.
Currently only the UART, LEDs and buttons are supported.

Signed-off-by: Alban Bedel 
---
v2: * Rebased for the new vendor directory structure
* Merged the 2 separate patch for SoC dtsi and board DTS in a
  single one
* Fixed the node names to use ePAPR standardized names
v3: * Moved adding the Kconfig Builtin devicetree menu to this patch
* Set the Kconfig builtin DTB menu as optional, removed config
  DTB_ATH79_NONE and slightly improved the menu name and help
  message.
v4: * Always build the DTB to improve testing coverage
* Added the SPI controller as the binding has been accepted in
  the SPI tree.
---
 arch/mips/ath79/Kconfig  |  12 ++
 arch/mips/boot/dts/Makefile  |   1 +
 arch/mips/boot/dts/qca/Makefile  |  11 ++
 arch/mips/boot/dts/qca/ar9132.dtsi   | 133 +++
 arch/mips/boot/dts/qca/ar9132_tl_wr1043nd_v1.dts | 112 +++
 5 files changed, 269 insertions(+)
 create mode 100644 arch/mips/boot/dts/qca/Makefile
 create mode 100644 arch/mips/boot/dts/qca/ar9132.dtsi
 create mode 100644 arch/mips/boot/dts/qca/ar9132_tl_wr1043nd_v1.dts

diff --git a/arch/mips/ath79/Kconfig b/arch/mips/ath79/Kconfig
index dfc6020..13c04cf 100644
--- a/arch/mips/ath79/Kconfig
+++ b/arch/mips/ath79/Kconfig
@@ -71,6 +71,18 @@ config ATH79_MACH_UBNT_XM
  Say 'Y' here if you want your kernel to support the
  Ubiquiti Networks XM (rev 1.0) board.
 
+choice
+   prompt "Build a DTB in the kernel"
+   optional
+   help
+ Select a devicetree that should be built into the kernel.
+
+   config DTB_TL_WR1043ND_V1
+   bool "TL-WR1043ND Version 1"
+   select BUILTIN_DTB
+   select SOC_AR913X
+endchoice
+
 endmenu
 
 config SOC_AR71XX
diff --git a/arch/mips/boot/dts/Makefile b/arch/mips/boot/dts/Makefile
index 5d95e4b..9975485 100644
--- a/arch/mips/boot/dts/Makefile
+++ b/arch/mips/boot/dts/Makefile
@@ -3,6 +3,7 @@ dts-dirs+= cavium-octeon
 dts-dirs   += lantiq
 dts-dirs   += mti
 dts-dirs   += netlogic
+dts-dirs   += qca
 dts-dirs   += ralink
 
 obj-y  := $(addsuffix /, $(dts-dirs))
diff --git a/arch/mips/boot/dts/qca/Makefile b/arch/mips/boot/dts/qca/Makefile
new file mode 100644
index 000..2d61455d
--- /dev/null
+++ b/arch/mips/boot/dts/qca/Makefile
@@ -0,0 +1,11 @@
+# All DTBs
+dtb-$(CONFIG_ATH79)+= ar9132_tl_wr1043nd_v1.dtb
+
+# Select a DTB to build in the kernel
+obj-$(CONFIG_DTB_TL_WR1043ND_V1)   += ar9132_tl_wr1043nd_v1.dtb.o
+
+# Force kbuild to make empty built-in.o if necessary
+obj-   += dummy.o
+
+always := $(dtb-y)
+clean-files:= *.dtb *.dtb.S
diff --git a/arch/mips/boot/dts/qca/ar9132.dtsi 
b/arch/mips/boot/dts/qca/ar9132.dtsi
new file mode 100644
index 000..4759cff
--- /dev/null
+++ b/arch/mips/boot/dts/qca/ar9132.dtsi
@@ -0,0 +1,133 @@
+/ {
+   compatible = "qca,ar9132";
+
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   cpus {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   cpu@0 {
+   device_type = "cpu";
+   compatible = "mips,mips24Kc";
+   reg = <0>;
+   };
+   };
+
+   cpuintc: interrupt-controller {
+   compatible = "qca,ar9132-cpu-intc", "qca,ar7100-cpu-intc";
+
+   interrupt-controller;
+   #interrupt-cells = <1>;
+
+   qca,ddr-wb-channel-interrupts = <2>, <3>, <4>, <5>;
+   qca,ddr-wb-channels = <_ctrl 3>, <_ctrl 2>,
+   <_ctrl 0>, <_ctrl 1>;
+   };
+
+   ahb {
+   compatible = "simple-bus";
+   ranges;
+
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   interrupt-parent = <>;
+
+   apb {
+   compatible = "simple-bus";
+   ranges;
+
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   interrupt-parent = <>;
+
+   ddr_ctrl: memory-controller@1800 {
+   compatible = "qca,ar9132-ddr-controller",
+   "qca,ar7240-ddr-controller";
+   reg = <0x1800 0x100>;
+
+   #qca,ddr-wb-channel-cells = <1>;
+   };
+
+   uart@1802 {
+   compatible = "ns8250";
+   reg = <0x1802 0x20>;
+   interrupts = <3>;
+
+   clocks = < 2>;

[PATCH v4 11/12] of: Add vendor prefix for TP-Link Technologies Co. Ltd

2015-05-30 Thread Alban Bedel
Signed-off-by: Alban Bedel 
---
v3: * Put the new entry at the right place
---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt 
b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 8033919..606e110 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -195,6 +195,7 @@ tlm Trusted Logic Mobility
 toradexToradex AG
 toshibaToshiba Corporation
 toumaz Toumaz
+tplink TP-LINK Technologies Co., Ltd.
 truly  Truly Semiconductors Limited
 usiUniversal Scientific Industrial Co., Ltd.
 v3 V3 Semiconductor
-- 
2.0.0

--
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 v4 10/12] MIPS: ath79: Add OF support to the GPIO driver

2015-05-30 Thread Alban Bedel
Replace the simple GPIO chip registration by a platform driver
and make ath79_gpio_init() just register the device.

Signed-off-by: Alban Bedel 
---
v2: * Added an 'ngpios' property instead of the many matches
* Use a platform data struct to store the device config on
  non-DT boards. It make for a cleaner separation of the config
  and driver code.
---
 arch/mips/ath79/dev-common.c | 51 +
 arch/mips/ath79/gpio.c   | 79 +++-
 include/linux/platform_data/gpio-ath79.h | 19 
 3 files changed, 127 insertions(+), 22 deletions(-)
 create mode 100644 include/linux/platform_data/gpio-ath79.h

diff --git a/arch/mips/ath79/dev-common.c b/arch/mips/ath79/dev-common.c
index 516225d..9d0172a 100644
--- a/arch/mips/ath79/dev-common.c
+++ b/arch/mips/ath79/dev-common.c
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -106,3 +107,53 @@ void __init ath79_register_wdt(void)
 
platform_device_register_simple("ath79-wdt", -1, , 1);
 }
+
+static struct ath79_gpio_platform_data ath79_gpio_pdata;
+
+static struct resource ath79_gpio_resources[] = {
+   {
+   .flags = IORESOURCE_MEM,
+   .start = AR71XX_GPIO_BASE,
+   .end = AR71XX_GPIO_BASE + AR71XX_GPIO_SIZE - 1,
+   },
+   {
+   .start  = ATH79_MISC_IRQ(2),
+   .end= ATH79_MISC_IRQ(2),
+   .flags  = IORESOURCE_IRQ,
+   },
+};
+
+static struct platform_device ath79_gpio_device = {
+   .name   = "ath79-gpio",
+   .id = -1,
+   .resource   = ath79_gpio_resources,
+   .num_resources  = ARRAY_SIZE(ath79_gpio_resources),
+   .dev = {
+   .platform_data  = _gpio_pdata
+   },
+};
+
+void __init ath79_gpio_init(void)
+{
+   if (soc_is_ar71xx()) {
+   ath79_gpio_pdata.ngpios = AR71XX_GPIO_COUNT;
+   } else if (soc_is_ar7240()) {
+   ath79_gpio_pdata.ngpios = AR7240_GPIO_COUNT;
+   } else if (soc_is_ar7241() || soc_is_ar7242()) {
+   ath79_gpio_pdata.ngpios = AR7241_GPIO_COUNT;
+   } else if (soc_is_ar913x()) {
+   ath79_gpio_pdata.ngpios = AR913X_GPIO_COUNT;
+   } else if (soc_is_ar933x()) {
+   ath79_gpio_pdata.ngpios = AR933X_GPIO_COUNT;
+   } else if (soc_is_ar934x()) {
+   ath79_gpio_pdata.ngpios = AR934X_GPIO_COUNT;
+   ath79_gpio_pdata.oe_inverted = 1;
+   } else if (soc_is_qca955x()) {
+   ath79_gpio_pdata.ngpios = QCA955X_GPIO_COUNT;
+   ath79_gpio_pdata.oe_inverted = 1;
+   } else {
+   BUG();
+   }
+
+   platform_device_register(_gpio_device);
+}
diff --git a/arch/mips/ath79/gpio.c b/arch/mips/ath79/gpio.c
index 8d025b0..f59ccb2 100644
--- a/arch/mips/ath79/gpio.c
+++ b/arch/mips/ath79/gpio.c
@@ -20,13 +20,15 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
 #include "common.h"
 
 static void __iomem *ath79_gpio_base;
-static unsigned long ath79_gpio_count;
+static u32 ath79_gpio_count;
 static DEFINE_SPINLOCK(ath79_gpio_lock);
 
 static void __ath79_gpio_set_value(unsigned gpio, int value)
@@ -178,39 +180,72 @@ void ath79_gpio_function_disable(u32 mask)
ath79_gpio_function_setup(0, mask);
 }
 
-void __init ath79_gpio_init(void)
+static const struct of_device_id ath79_gpio_of_match[] = {
+   { .compatible = "qca,ar7100-gpio" },
+   { .compatible = "qca,ar9340-gpio" },
+   {},
+};
+
+static int ath79_gpio_probe(struct platform_device *pdev)
 {
+   struct ath79_gpio_platform_data *pdata = pdev->dev.platform_data;
+   struct device_node *np = pdev->dev.of_node;
+   struct resource *res;
+   bool oe_inverted;
int err;
 
-   if (soc_is_ar71xx())
-   ath79_gpio_count = AR71XX_GPIO_COUNT;
-   else if (soc_is_ar7240())
-   ath79_gpio_count = AR7240_GPIO_COUNT;
-   else if (soc_is_ar7241() || soc_is_ar7242())
-   ath79_gpio_count = AR7241_GPIO_COUNT;
-   else if (soc_is_ar913x())
-   ath79_gpio_count = AR913X_GPIO_COUNT;
-   else if (soc_is_ar933x())
-   ath79_gpio_count = AR933X_GPIO_COUNT;
-   else if (soc_is_ar934x())
-   ath79_gpio_count = AR934X_GPIO_COUNT;
-   else if (soc_is_qca955x())
-   ath79_gpio_count = QCA955X_GPIO_COUNT;
-   else
-   BUG();
+   if (np) {
+   err = of_property_read_u32(np, "ngpios", _gpio_count);
+   if (err) {
+   dev_err(>dev, "ngpios property is not valid\n");
+   return err;
+   }
+   if (ath79_gpio_count >= 32) {
+   dev_err(>dev, "ngpios must be less than 32\n");
+   return -EINVAL;
+   }
+   oe_inverted = of_device_is_compatible(np, 

[PATCH v4 09/12] devicetree: Add bindings for the ATH79 GPIO controllers

2015-05-30 Thread Alban Bedel
These bindings support the GPIO controllers found on the Qualcomm
Atheros AR7xxx/AR9XXX SoC.

Signed-off-by: Alban Bedel 
---
v2: * Add the ngpios property to have fewer fallbacks and simpler code
v3: * Fix missing 's' typo
* Fix the example to be valid with the binding
v4: * Fix the double space in the title
---
 .../devicetree/bindings/gpio/gpio-ath79.txt| 38 ++
 1 file changed, 38 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-ath79.txt

diff --git a/Documentation/devicetree/bindings/gpio/gpio-ath79.txt 
b/Documentation/devicetree/bindings/gpio/gpio-ath79.txt
new file mode 100644
index 000..c522851
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/gpio-ath79.txt
@@ -0,0 +1,38 @@
+Binding for Qualcomm Atheros AR7xxx/AR9xxx GPIO controller
+
+Required properties:
+- compatible: has to be "qca,-gpio" and one of the following
+  fallbacks:
+  - "qca,ar7100-gpio"
+  - "qca,ar9340-gpio"
+- reg: Base address and size of the controllers memory area
+- gpio-controller : Marks the device node as a GPIO controller.
+- #gpio-cells : Should be two. The first cell is the pin number and the
+  second cell is used to specify optional parameters.
+- ngpios: Should be set to the number of GPIOs available on the SoC.
+
+Optional properties:
+- interrupt-parent: phandle of the parent interrupt controller.
+- interrupts: Interrupt specifier for the controllers interrupt.
+- interrupt-controller : Identifies the node as an interrupt controller
+- #interrupt-cells : Specifies the number of cells needed to encode interrupt
+source, should be 2
+
+Please refer to interrupts.txt in this directory for details of the common
+Interrupt Controllers bindings used by client devices.
+
+Example:
+
+   gpio@1804 {
+   compatible = "qca,ar9132-gpio", "qca,ar7100-gpio";
+   reg = <0x1804 0x30>;
+   interrupts = <2>;
+
+   ngpios = <22>;
+
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
-- 
2.0.0

--
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 v4 08/12] MIPS: ath79: Add OF support to the clocks

2015-05-30 Thread Alban Bedel
Allow using the SoC clocks in the device tree.

Signed-off-by: Alban Bedel 
---
v3: * Fix the compatible string for qca9550
v4: * Added missing Signed-off-by
---
 arch/mips/ath79/clock.c | 63 ++---
 1 file changed, 44 insertions(+), 19 deletions(-)

diff --git a/arch/mips/ath79/clock.c b/arch/mips/ath79/clock.c
index 1fcb691..eb5117c 100644
--- a/arch/mips/ath79/clock.c
+++ b/arch/mips/ath79/clock.c
@@ -29,7 +29,14 @@
 #define AR724X_BASE_FREQ   500
 #define AR913X_BASE_FREQ   500
 
-static void __init ath79_add_sys_clkdev(const char *id, unsigned long rate)
+static struct clk *clks[3];
+static struct clk_onecell_data clk_data = {
+   .clks = clks,
+   .clk_num = ARRAY_SIZE(clks),
+};
+
+static struct clk *__init ath79_add_sys_clkdev(
+   const char *id, unsigned long rate)
 {
struct clk *clk;
int err;
@@ -41,6 +48,8 @@ static void __init ath79_add_sys_clkdev(const char *id, 
unsigned long rate)
err = clk_register_clkdev(clk, id, NULL);
if (err)
panic("unable to register %s clock device", id);
+
+   return clk;
 }
 
 static void __init ar71xx_clocks_init(void)
@@ -70,9 +79,9 @@ static void __init ar71xx_clocks_init(void)
ahb_rate = cpu_rate / div;
 
ath79_add_sys_clkdev("ref", ref_rate);
-   ath79_add_sys_clkdev("cpu", cpu_rate);
-   ath79_add_sys_clkdev("ddr", ddr_rate);
-   ath79_add_sys_clkdev("ahb", ahb_rate);
+   clks[0] = ath79_add_sys_clkdev("cpu", cpu_rate);
+   clks[1] = ath79_add_sys_clkdev("ddr", ddr_rate);
+   clks[2] = ath79_add_sys_clkdev("ahb", ahb_rate);
 
clk_add_alias("wdt", NULL, "ahb", NULL);
clk_add_alias("uart", NULL, "ahb", NULL);
@@ -106,9 +115,9 @@ static void __init ar724x_clocks_init(void)
ahb_rate = cpu_rate / div;
 
ath79_add_sys_clkdev("ref", ref_rate);
-   ath79_add_sys_clkdev("cpu", cpu_rate);
-   ath79_add_sys_clkdev("ddr", ddr_rate);
-   ath79_add_sys_clkdev("ahb", ahb_rate);
+   clks[0] = ath79_add_sys_clkdev("cpu", cpu_rate);
+   clks[1] = ath79_add_sys_clkdev("ddr", ddr_rate);
+   clks[2] = ath79_add_sys_clkdev("ahb", ahb_rate);
 
clk_add_alias("wdt", NULL, "ahb", NULL);
clk_add_alias("uart", NULL, "ahb", NULL);
@@ -139,9 +148,9 @@ static void __init ar913x_clocks_init(void)
ahb_rate = cpu_rate / div;
 
ath79_add_sys_clkdev("ref", ref_rate);
-   ath79_add_sys_clkdev("cpu", cpu_rate);
-   ath79_add_sys_clkdev("ddr", ddr_rate);
-   ath79_add_sys_clkdev("ahb", ahb_rate);
+   clks[0] = ath79_add_sys_clkdev("cpu", cpu_rate);
+   clks[1] = ath79_add_sys_clkdev("ddr", ddr_rate);
+   clks[2] = ath79_add_sys_clkdev("ahb", ahb_rate);
 
clk_add_alias("wdt", NULL, "ahb", NULL);
clk_add_alias("uart", NULL, "ahb", NULL);
@@ -201,9 +210,9 @@ static void __init ar933x_clocks_init(void)
}
 
ath79_add_sys_clkdev("ref", ref_rate);
-   ath79_add_sys_clkdev("cpu", cpu_rate);
-   ath79_add_sys_clkdev("ddr", ddr_rate);
-   ath79_add_sys_clkdev("ahb", ahb_rate);
+   clks[0] = ath79_add_sys_clkdev("cpu", cpu_rate);
+   clks[1] = ath79_add_sys_clkdev("ddr", ddr_rate);
+   clks[2] = ath79_add_sys_clkdev("ahb", ahb_rate);
 
clk_add_alias("wdt", NULL, "ahb", NULL);
clk_add_alias("uart", NULL, "ref", NULL);
@@ -335,9 +344,9 @@ static void __init ar934x_clocks_init(void)
ahb_rate = cpu_pll / (postdiv + 1);
 
ath79_add_sys_clkdev("ref", ref_rate);
-   ath79_add_sys_clkdev("cpu", cpu_rate);
-   ath79_add_sys_clkdev("ddr", ddr_rate);
-   ath79_add_sys_clkdev("ahb", ahb_rate);
+   clks[0] = ath79_add_sys_clkdev("cpu", cpu_rate);
+   clks[1] = ath79_add_sys_clkdev("ddr", ddr_rate);
+   clks[2] = ath79_add_sys_clkdev("ahb", ahb_rate);
 
clk_add_alias("wdt", NULL, "ref", NULL);
clk_add_alias("uart", NULL, "ref", NULL);
@@ -422,9 +431,9 @@ static void __init qca955x_clocks_init(void)
ahb_rate = cpu_pll / (postdiv + 1);
 
ath79_add_sys_clkdev("ref", ref_rate);
-   ath79_add_sys_clkdev("cpu", cpu_rate);
-   ath79_add_sys_clkdev("ddr", ddr_rate);
-   ath79_add_sys_clkdev("ahb", ahb_rate);
+   clks[0] = ath79_add_sys_clkdev("cpu", cpu_rate);
+   clks[1] = ath79_add_sys_clkdev("ddr", ddr_rate);
+   clks[2] = ath79_add_sys_clkdev("ahb", ahb_rate);
 
clk_add_alias("wdt", NULL, "ref", NULL);
clk_add_alias("uart", NULL, "ref", NULL);
@@ -446,6 +455,8 @@ void __init ath79_clocks_init(void)
qca955x_clocks_init();
else
BUG();
+
+   of_clk_init(NULL);
 }
 
 unsigned long __init
@@ -463,3 +474,17 @@ ath79_get_sys_clk_rate(const char *id)
 
return rate;
 }
+
+#ifdef CONFIG_OF
+static void __init ath79_clocks_init_dt(struct device_node *np)
+{
+   of_clk_add_provider(np, of_clk_src_onecell_get, 

Re: [PATCH v2 7/7] sched/rt: reschedule if stop/dl task slip in after pull operations

2015-05-30 Thread Wanpeng Li


On 5/29/15 10:34 PM, Peter Zijlstra wrote:

On Wed, May 13, 2015 at 02:01:07PM +0800, Wanpeng Li wrote:

pull_rt_task() can drop (and re-acquire) rq->lock, this means a dl
or stop task can slip in, in which case need to reschedule. This
patch add the reschedule when the scenario occurs.

Signed-off-by: Wanpeng Li 
---
  kernel/sched/rt.c | 19 ++-
  1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 560d2fa..8c948bf 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -2136,7 +2136,14 @@ static void switched_from_rt(struct rq *rq, struct 
task_struct *p)
if (!task_on_rq_queued(p) || rq->rt.rt_nr_running)
return;
  
-	if (pull_rt_task(rq))

+   /*
+* pull_rt_task() can drop (and re-acquire) rq->lock; this
+* means a dl or stop task can slip in, in which case we need
+* to reschedule.
+*/
+   if (pull_rt_task(rq) ||
+   (unlikely((rq->stop && task_on_rq_queued(rq->stop)) ||
+   rq->dl.dl_nr_running)))
resched_curr(rq);
  }

Same as before; why is the normal wakeup preemption check not working?


I will drop these two patches and send out v3. :)

Regards,
Wanpeng Li


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


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


Gefeliciteerd !!!

2015-05-30 Thread Facebook Rewards Program



--
Gefeliciteerd !!!

Including we Vieren Onze 10 jaar Van het internet Journey en Global 
Communication we are Blij aan te kondigen aan u DAT Uw Facebook-rekening 
are willekeurig geselecteerd als begunstigde van $ 1,000,000.00usd in de 
2014/2015 Facebook account van het Jaar {Grote Rewards winnaar} .


E-mail ons de informatie hieronder: fb_deliveryserv...@mynet.com

BERICHT VAN identificatie: NW90W0W0-XANSIEW-1015
1) Bedrag gewonnen: $ 1.000.000,00 usd
2) facebook Gebruikersnaam:
3) De dialog Land van Woonplaats:
4) Paspoort / Identity Number:


E-mail: fb_deliveryserv...@mynet.com
George Jones.

Program Coordinator,
Facebook Rewards Program,
www.facebook.com
Alle Rechten voorbehouden 2015.
--
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 4/7] sched/deadline: reschedule if stop task slip in after pull operations

2015-05-30 Thread Wanpeng Li


On 5/29/15 10:16 PM, Peter Zijlstra wrote:

On Wed, May 13, 2015 at 02:01:04PM +0800, Wanpeng Li wrote:

pull_dl_task can drop (and re-acquire) rq->lock, this means a stop task
can slip in, in which case we need to reschedule. This patch add the
reschedule when the scenario occurs.

Signed-off-by: Wanpeng Li 
---
  kernel/sched/deadline.c | 16 +++-
  1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index e49b1e6..7d4c4fc 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1750,7 +1750,13 @@ static void switched_from_dl(struct rq *rq, struct 
task_struct *p)
if (!task_on_rq_queued(p) || rq->dl.dl_nr_running)
return;
  
-	if (pull_dl_task(rq))

+   /*
+* pull_dl_task() can drop (and re-acquire) rq->lock; this
+* means a stop task can slip in, in which case we need to
+* reschedule.
+*/
+   if (pull_dl_task(rq) ||
+   (rq->stop && task_on_rq_queued(rq->stop)))
resched_curr(rq);

But, the waking of the stop task will already have done the preemption
check and won (obviously). So the wakeup should already have done the
resched_curr().


Indeed, thanks for your pointing out. :)



So why?

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


--
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/5] Add support for QCA IPQ806x Ethernet GMAC controller

2015-05-30 Thread David Miller
From: Mathieu Olivari 
Date: Wed, 27 May 2015 11:02:45 -0700

> This patch set adds support for the integrated Ethernet GMAC controller
> on QCA IPQ806x SoC. This controller is based on a Gigabit Synopsys
> DesignWare IP, already supported in the stmmac driver located in
> drivers/net/ethernet/stmicro/stmmac.
> 
> This change is done as a follow-up to the following thread:
> *http://www.spinics.net/lists/netdev/msg311265.html
> While previous attempt was creating a new driver to drive this controller,
> this new post leverages the existing stmmac driver by implementing the
> SoC specific glue to it.
> 
> Aside from the pure stmmac glue layer, we have a couple of related
> patches:
> *IPQ806x NSS clock addition is cherry-picked and refreshed from the
>  following thread: https://lkml.org/lkml/2014/8/6/390
> *phy-handle and fixed-link support are also added in this change set so the
>  driver can be fully functional on platforms using device-trees as well as
>  ethernet switches.
> 
> V2:
>  *Fix MODULE_LICENSE to "Dual BSD/GPL" as the dwmac-ipq806x.c is using
>   ISC license.

Series applied to net-next, 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/


[PATCH v4 07/12] devicetree: Add bindings for the ATH79 PLL controllers

2015-05-30 Thread Alban Bedel
Signed-off-by: Alban Bedel 
---
v2: * Fixed the node names to respect ePAPR
* Fixed the missing 's' in 'fallbacks' and the 'clocks' property
v3: * Fix the compatible string for qca9550
---
 .../devicetree/bindings/clock/qca,ath79-pll.txt| 33 ++
 1 file changed, 33 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/qca,ath79-pll.txt

diff --git a/Documentation/devicetree/bindings/clock/qca,ath79-pll.txt 
b/Documentation/devicetree/bindings/clock/qca,ath79-pll.txt
new file mode 100644
index 000..e0fc2c1
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/qca,ath79-pll.txt
@@ -0,0 +1,33 @@
+Binding for Qualcomm Atheros AR7xxx/AR9XXX PLL controller
+
+The PPL controller provides the 3 main clocks of the SoC: CPU, DDR and AHB.
+
+Required Properties:
+- compatible: has to be "qca,-cpu-intc" and one of the following
+  fallbacks:
+  - "qca,ar7100-pll"
+  - "qca,ar7240-pll"
+  - "qca,ar9130-pll"
+  - "qca,ar9330-pll"
+  - "qca,ar9340-pll"
+  - "qca,qca9550-pll"
+- reg: Base address and size of the controllers memory area
+- clock-names: Name of the input clock, has to be "ref"
+- clocks: phandle of the external reference clock
+- #clock-cells: has to be one
+
+Optional properties:
+- clock-output-names: should be "cpu", "ddr", "ahb"
+
+Example:
+
+   memory-controller@1805 {
+   compatible = "qca,ar9132-ppl", "qca,ar9130-pll";
+   reg = <0x1805 0x20>;
+
+   clock-names = "ref";
+   clocks = <>;
+
+   #clock-cells = <1>;
+   clock-output-names = "cpu", "ddr", "ahb";
+   };
-- 
2.0.0

--
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 v4 06/12] MIPS: ath79: Add OF support to the IRQ controllers

2015-05-30 Thread Alban Bedel
Add OF support for the CPU and MISC interrupt controllers of most
supported ATH79 devices.

Signed-off-by: Alban Bedel 
---
 arch/mips/ath79/irq.c | 87 ++-
 1 file changed, 86 insertions(+), 1 deletion(-)

diff --git a/arch/mips/ath79/irq.c b/arch/mips/ath79/irq.c
index 2c3991a..afb0096 100644
--- a/arch/mips/ath79/irq.c
+++ b/arch/mips/ath79/irq.c
@@ -15,7 +15,9 @@
 #include 
 #include 
 #include 
-#include 
+#include 
+#include 
+#include "../../../drivers/irqchip/irqchip.h"
 
 #include 
 #include 
@@ -23,6 +25,7 @@
 #include 
 #include 
 #include "common.h"
+#include "machtypes.h"
 
 static void ath79_misc_irq_handler(unsigned int irq, struct irq_desc *desc)
 {
@@ -268,8 +271,90 @@ asmlinkage void plat_irq_dispatch(void)
}
 }
 
+#ifdef CONFIG_IRQCHIP
+static int misc_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw)
+{
+   irq_set_chip_and_handler(irq, _misc_irq_chip, handle_level_irq);
+   return 0;
+}
+
+static const struct irq_domain_ops misc_irq_domain_ops = {
+   .xlate = irq_domain_xlate_onecell,
+   .map = misc_map,
+};
+
+static int __init ath79_misc_intc_of_init(
+   struct device_node *node, struct device_node *parent)
+{
+   void __iomem *base = ath79_reset_base;
+   struct irq_domain *domain;
+   int irq;
+
+   irq = irq_of_parse_and_map(node, 0);
+   if (!irq)
+   panic("Failed to get MISC IRQ");
+
+   domain = irq_domain_add_legacy(node, ATH79_MISC_IRQ_COUNT,
+   ATH79_MISC_IRQ_BASE, 0, _irq_domain_ops, NULL);
+   if (!domain)
+   panic("Failed to add MISC irqdomain");
+
+   /* Disable and clear all interrupts */
+   __raw_writel(0, base + AR71XX_RESET_REG_MISC_INT_ENABLE);
+   __raw_writel(0, base + AR71XX_RESET_REG_MISC_INT_STATUS);
+
+
+   irq_set_chained_handler(irq, ath79_misc_irq_handler);
+
+   return 0;
+}
+IRQCHIP_DECLARE(ath79_misc_intc, "qca,ar7100-misc-intc",
+   ath79_misc_intc_of_init);
+
+static int __init ar79_cpu_intc_of_init(
+   struct device_node *node, struct device_node *parent)
+{
+   int err, i, count;
+
+   /* Fill the irq_wb_chan table */
+   count = of_count_phandle_with_args(
+   node, "qca,ddr-wb-channels", "#qca,ddr-wb-channel-cells");
+
+   for (i = 0; i < count; i++) {
+   struct of_phandle_args args;
+   u32 irq = i;
+
+   of_property_read_u32_index(
+   node, "qca,ddr-wb-channel-interrupts", i, );
+   if (irq >= ARRAY_SIZE(irq_wb_chan))
+   continue;
+
+   err = of_parse_phandle_with_args(
+   node, "qca,ddr-wb-channels",
+   "#qca,ddr-wb-channel-cells",
+   i, );
+   if (err)
+   return err;
+
+   irq_wb_chan[irq] = args.args[0];
+   pr_info("IRQ: Set flush channel of IRQ%d to %d\n",
+   irq, args.args[0]);
+   }
+
+   return mips_cpu_irq_of_init(node, parent);
+}
+IRQCHIP_DECLARE(ar79_cpu_intc, "qca,ar7100-cpu-intc",
+   ar79_cpu_intc_of_init);
+
+#endif
+
 void __init arch_init_irq(void)
 {
+   if (mips_machtype == ATH79_MACH_GENERIC_OF) {
+   irqchip_init();
+   return;
+   }
+
if (soc_is_ar71xx() || soc_is_ar724x() ||
soc_is_ar913x() || soc_is_ar933x()) {
irq_wb_chan[2] = 3;
-- 
2.0.0

--
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 v4 05/12] devicetree: Add bindings for the ATH79 MISC interrupt controllers

2015-05-30 Thread Alban Bedel
Signed-off-by: Alban Bedel 
---
v2: * Fixed the node names to respect ePAPR
---
 .../interrupt-controller/qca,ath79-misc-intc.txt   | 30 ++
 1 file changed, 30 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/interrupt-controller/qca,ath79-misc-intc.txt

diff --git 
a/Documentation/devicetree/bindings/interrupt-controller/qca,ath79-misc-intc.txt
 
b/Documentation/devicetree/bindings/interrupt-controller/qca,ath79-misc-intc.txt
new file mode 100644
index 000..391717a
--- /dev/null
+++ 
b/Documentation/devicetree/bindings/interrupt-controller/qca,ath79-misc-intc.txt
@@ -0,0 +1,30 @@
+Binding for Qualcomm Atheros AR7xxx/AR9XXX MISC interrupt controller
+
+The MISC interrupt controller is a secondary controller for lower priority
+interrupt.
+
+Required Properties:
+- compatible: has to be "qca,-cpu-intc", "qca,ar7100-misc-intc"
+  as fallback
+- reg: Base address and size of the controllers memory area
+- interrupt-parent: phandle of the parent interrupt controller.
+- interrupts: Interrupt specifier for the controllers interrupt.
+- interrupt-controller : Identifies the node as an interrupt controller
+- #interrupt-cells : Specifies the number of cells needed to encode interrupt
+source, should be 1
+
+Please refer to interrupts.txt in this directory for details of the common
+Interrupt Controllers bindings used by client devices.
+
+Example:
+
+   interrupt-controller@18060010 {
+   compatible = "qca,ar9132-misc-intc", qca,ar7100-misc-intc";
+   reg = <0x18060010 0x4>;
+
+   interrupt-parent = <>;
+   interrupts = <6>;
+
+   interrupt-controller;
+   #interrupt-cells = <1>;
+   };
-- 
2.0.0

--
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 v4 04/12] devicetree: Add bindings for the ATH79 interrupt controllers

2015-05-30 Thread Alban Bedel
Signed-off-by: Alban Bedel 
---
v2: * Fixed the node names to respect ePAPR
* Removed the unneeded @0 on the node name
---
 .../interrupt-controller/qca,ath79-cpu-intc.txt| 44 ++
 1 file changed, 44 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/interrupt-controller/qca,ath79-cpu-intc.txt

diff --git 
a/Documentation/devicetree/bindings/interrupt-controller/qca,ath79-cpu-intc.txt 
b/Documentation/devicetree/bindings/interrupt-controller/qca,ath79-cpu-intc.txt
new file mode 100644
index 000..aabce78
--- /dev/null
+++ 
b/Documentation/devicetree/bindings/interrupt-controller/qca,ath79-cpu-intc.txt
@@ -0,0 +1,44 @@
+Binding for Qualcomm Atheros AR7xxx/AR9XXX CPU interrupt controller
+
+On most SoC the IRQ controller need to flush the DDR FIFO before running
+the interrupt handler of some devices. This is configured using the
+qca,ddr-wb-channels and qca,ddr-wb-channel-interrupts properties.
+
+Required Properties:
+
+- compatible: has to be "qca,-cpu-intc", "qca,ar7100-cpu-intc"
+  as fallback
+- interrupt-controller : Identifies the node as an interrupt controller
+- #interrupt-cells : Specifies the number of cells needed to encode interrupt
+source, should be 1 for intc
+
+Please refer to interrupts.txt in this directory for details of the common
+Interrupt Controllers bindings used by client devices.
+
+Optional Properties:
+
+- qca,ddr-wb-channel-interrupts: List of the interrupts needing a write
+  buffer flush
+- qca,ddr-wb-channels: List of phandles to the write buffer channels for
+  each interrupt. If qca,ddr-wb-channel-interrupts is not present the interrupt
+  default to the entry's index.
+
+Example:
+
+   interrupt-controller {
+   compatible = "qca,ar9132-cpu-intc", "qca,ar7100-cpu-intc";
+
+   interrupt-controller;
+   #interrupt-cells = <1>;
+
+   qca,ddr-wb-channel-interrupts = <2>, <3>, <4>, <5>;
+   qca,ddr-wb-channels = <_ctrl 3>, <_ctrl 2>,
+   <_ctrl 0>, <_ctrl 1>;
+   };
+
+   ...
+
+   ddr_ctrl: memory-controller@1800 {
+   ...
+   #qca,ddr-wb-channel-cells = <1>;
+   };
-- 
2.0.0

--
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 v4 03/12] devicetree: Add bindings for the ATH79 DDR controllers

2015-05-30 Thread Alban Bedel
The DDR controller of the ARxxx and AR9xxx families provides an
interface to flush the FIFO between various devices and the DDR.
This is mainly used by the IRQ controller to flush the FIFO before
running the interrupt handler of such devices.

Signed-off-by: Alban Bedel 
---
v2: * Fix the node names to respect ePAPR
v3: * Fix some typos
* Really fix the node names this time
---
 .../memory-controllers/ath79-ddr-controller.txt| 35 ++
 1 file changed, 35 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/memory-controllers/ath79-ddr-controller.txt

diff --git 
a/Documentation/devicetree/bindings/memory-controllers/ath79-ddr-controller.txt 
b/Documentation/devicetree/bindings/memory-controllers/ath79-ddr-controller.txt
new file mode 100644
index 000..efe35a06
--- /dev/null
+++ 
b/Documentation/devicetree/bindings/memory-controllers/ath79-ddr-controller.txt
@@ -0,0 +1,35 @@
+Binding for Qualcomm  Atheros AR7xxx/AR9xxx DDR controller
+
+The DDR controller of the ARxxx and AR9xxx families provides an interface
+to flush the FIFO between various devices and the DDR. This is mainly used
+by the IRQ controller to flush the FIFO before running the interrupt handler
+of such devices.
+
+Required properties:
+
+- compatible: has to be "qca,-ddr-controller",
+  "qca,[ar7100|ar7240]-ddr-controller" as fallback.
+  On SoC with PCI support "qca,ar7100-ddr-controller" should be used as
+  fallback, otherwise "qca,ar7240-ddr-controller" should be used.
+- reg: Base address and size of the controllers memory area
+- #qca,ddr-wb-channel-cells: has to be 1, the index of the write buffer
+  channel
+
+Example:
+
+   ddr_ctrl: memory-controller@1800 {
+   compatible = "qca,ar9132-ddr-controller",
+   "qca,ar7240-ddr-controller";
+   reg = <0x1800 0x100>;
+
+   #qca,ddr-wb-channel-cells = <1>;
+   };
+
+   ...
+
+   interrupt-controller {
+   ...
+   qca,ddr-wb-channel-interrupts = <2>, <3>, <4>, <5>;
+   qca,ddr-wb-channels = <_ctrl 3>, <_ctrl 2>,
+   <_ctrl 0>, <_ctrl 1>;
+   };
-- 
2.0.0

--
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 v4 02/12] MIPS: ath79: Add basic device tree support

2015-05-30 Thread Alban Bedel
Add the bare minimum to load a device tree.

Signed-off-by: Alban Bedel 
---
v3: * Removed the empty Builtin devicetree menu
---
 arch/mips/Kconfig   |  1 +
 arch/mips/ath79/machtypes.h |  1 +
 arch/mips/ath79/setup.c | 27 ++-
 3 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 874bbaf..772312d 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -133,6 +133,7 @@ config ATH79
select SYS_SUPPORTS_BIG_ENDIAN
select SYS_SUPPORTS_MIPS16
select SYS_SUPPORTS_ZBOOT
+   select USE_OF
help
  Support for the Atheros AR71XX/AR724X/AR913X SoCs.
 
diff --git a/arch/mips/ath79/machtypes.h b/arch/mips/ath79/machtypes.h
index 2625405..a13db3d 100644
--- a/arch/mips/ath79/machtypes.h
+++ b/arch/mips/ath79/machtypes.h
@@ -15,6 +15,7 @@
 #include 
 
 enum ath79_mach_type {
+   ATH79_MACH_GENERIC_OF = -1, /* Device tree board */
ATH79_MACH_GENERIC = 0,
ATH79_MACH_AP121,   /* Atheros AP121 reference board */
ATH79_MACH_AP136_010,   /* Atheros AP136-010 reference board */
diff --git a/arch/mips/ath79/setup.c b/arch/mips/ath79/setup.c
index 74f1af7..01a644f 100644
--- a/arch/mips/ath79/setup.c
+++ b/arch/mips/ath79/setup.c
@@ -17,12 +17,16 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
 #include   /* for mips_hpt_frequency */
 #include /* for _machine_{restart,halt} */
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -194,8 +198,19 @@ unsigned int get_c0_compare_int(void)
 
 void __init plat_mem_setup(void)
 {
+   unsigned long fdt_start;
+
set_io_port_base(KSEG1);
 
+   /* Get the position of the FDT passed by the bootloader */
+   fdt_start = fw_getenvl("fdt_start");
+   if (fdt_start)
+   __dt_setup_arch((void *)KSEG0ADDR(fdt_start));
+#ifdef CONFIG_BUILTIN_DTB
+   else
+   __dt_setup_arch(__dtb_start);
+#endif
+
ath79_reset_base = ioremap_nocache(AR71XX_RESET_BASE,
   AR71XX_RESET_SIZE);
ath79_pll_base = ioremap_nocache(AR71XX_PLL_BASE,
@@ -203,7 +218,8 @@ void __init plat_mem_setup(void)
ath79_ddr_ctrl_init();
 
ath79_detect_sys_type();
-   detect_memory_region(0, ATH79_MEM_SIZE_MIN, ATH79_MEM_SIZE_MAX);
+   if (mips_machtype != ATH79_MACH_GENERIC_OF)
+   detect_memory_region(0, ATH79_MEM_SIZE_MIN, ATH79_MEM_SIZE_MAX);
 
_machine_restart = ath79_restart;
_machine_halt = ath79_halt;
@@ -235,6 +251,10 @@ void __init plat_time_init(void)
 
 static int __init ath79_setup(void)
 {
+   of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+   if  (mips_machtype == ATH79_MACH_GENERIC_OF)
+   return 0;
+
ath79_gpio_init();
ath79_register_uart();
ath79_register_wdt();
@@ -246,6 +266,11 @@ static int __init ath79_setup(void)
 
 arch_initcall(ath79_setup);
 
+void __init device_tree_init(void)
+{
+   unflatten_and_copy_device_tree();
+}
+
 static void __init ath79_generic_init(void)
 {
/* Nothing to do */
-- 
2.0.0

--
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   3   4   5   6   7   >