Re: [PATCH 3/5] drivers:usb:fsl: Replace macros with enumerated type
On Tue, May 26, 2015 at 05:15:48PM +0530, Nikhil Badola wrote: > Replace macros with enumerated type to represent usb ip > controller version > > Signed-off-by: Nikhil Badola > --- > include/linux/fsl_devices.h | 13 - > 1 file changed, 8 insertions(+), 5 deletions(-) > > diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h > index 2a2f56b..6447b7b 100644 > --- a/include/linux/fsl_devices.h > +++ b/include/linux/fsl_devices.h > @@ -20,11 +20,6 @@ > #define FSL_UTMI_PHY_DLY 10 /*As per P1010RM, delay for UTMI > PHY CLK to become stable - 10ms*/ > #define FSL_USB_PHY_CLK_TIMEOUT 1 /* uSec */ > -#define FSL_USB_VER_OLD 0 > -#define FSL_USB_VER_1_6 1 > -#define FSL_USB_VER_2_2 2 > -#define FSL_USB_VER_2_4 3 > -#define FSL_USB_VER_2_5 4 > > #include > > @@ -52,6 +47,14 @@ > * > */ > > +enum fsl_usb2_controller_ver { > + FSL_USB_VER_OLD = 0, > + FSL_USB_VER_1_6, > + FSL_USB_VER_2_2, > + FSL_USB_VER_2_4, > + FSL_USB_VER_2_5, > +}; Don't you want to change that function that uses these to return the enumerated type and not an integer? Also, I don't think the C standard forces the non-numberd values to be sequential, so I think the compiler could assign FSL_USB_VER_1_6 to be 45 and then FSL_USB_VER_2_2 to be 55 and so on. So it's much better, if you are going to be testing values, to be explicit about the values. Please set them all here. 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/5] drivers:usb:fsl: Check IP version 2.4 for mph USB controller
On Tue, May 26, 2015 at 05:14:42PM +0530, Nikhil Badola wrote: > Check IP version 2.4 for multi port host USB controller and > return FSL_USB_VER_2_4 macro > > Signed-off-by: Nikhil Badola > --- > Separate patches clubbed and resent in an ordered patchset > with proper mailing list in cc > > drivers/usb/host/fsl-mph-dr-of.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/usb/host/fsl-mph-dr-of.c > b/drivers/usb/host/fsl-mph-dr-of.c > index 7e325e9..e588ccd 100644 > --- a/drivers/usb/host/fsl-mph-dr-of.c > +++ b/drivers/usb/host/fsl-mph-dr-of.c > @@ -126,6 +126,7 @@ static int usb_get_ver_info(struct device_node *np) > /* >* returns 1 for usb controller version 1.6 >* returns 2 for usb controller version 2.2 > + * returns 3 for usb controller version 2.4 >* returns 0 otherwise Shouldn't the comment use the #define names instead of values? You can do that in a later 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 2/9] ipv6: drop unneeded goto
From: Julia Lawall Date: Thu, 28 May 2015 23:02:17 +0200 > From: Julia Lawall > > Delete jump to a label on the next line, when that label is not > used elsewhere. > > A simplified version of the semantic patch that makes this change is as > follows: (http://coccinelle.lip6.fr/) ... > Also remove the unnecessary ret variable. > > Signed-off-by: Julia Lawall Applied, thanks Julia. -- 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] staging/lustre/ldlm: Fix up LDLM_POOL_SYSFS_WRITER*_STORE define
From: Oleg Drokin The store method defined by LDLM_POOL_SYSFS_WRITER_STORE and LDLM_POOL_SYSFS_WRITER_NOLOCK_STORE defines should use size_t count, not unsigned long. This produced a warning on i386 (and other 32bit architectures too, I guess) where unsigned long is not 32 bit. Reported by kbuild test bot. Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/ldlm/ldlm_internal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h index cf81bdb..6601e6b 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h @@ -265,7 +265,7 @@ typedef enum ldlm_policy_res ldlm_policy_res_t; static ssize_t var##_store(struct kobject *kobj,\ struct attribute *attr,\ const char *buffer,\ -unsigned long count) \ +size_t count) \ { \ struct ldlm_pool *pl = container_of(kobj, struct ldlm_pool, \ pl_kobj); \ @@ -301,7 +301,7 @@ typedef enum ldlm_policy_res ldlm_policy_res_t; static ssize_t var##_store(struct kobject *kobj,\ struct attribute *attr,\ const char *buffer,\ -unsigned long count) \ +size_t count) \ { \ struct ldlm_pool *pl = container_of(kobj, struct ldlm_pool, \ pl_kobj); \ -- 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 v2] [media] dvb-frontend: Replace timeval with ktime_t
> -- > Changes in v2: > - Use the more concise ktime_us_delta Oops, please ignore this patch and please consider the v3 sent out immediately after instead. Tina -- 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()
On Sun, May 31, 2015 at 07:54:34AM +0200, Nicholas Mc Guire wrote: > 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 Josh is a maintainer of a subsystem that gets a handful of patches a release, at the most, he can carefully hand edit them all with no hit to his productivity. Me, I deal with a few thousand a release :) And he's right about the tools, just not the fact of what branch you made it against, or that you actually test built the thing, those are not useful things in the changelog to preserve for forever as they don't help anyone out. 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 3/3] Drivers: hv: vmbus: Allocate ring buffer memory in NUMA aware fashion
On Sat, May 30, 2015 at 11:37:49PM -0700, K. Y. Srinivasan wrote: > Allocate ring buffer memory from the NUMA node assigned to the channel. But you do more than just that. If there's a failure, you fall-back to the old allocation method. Why not mention that as well? And is that what you really want? Do we ever fail allocation for a node but still have memory from another one? Shouldn't the logic be in the allocator and not be forced to be in every caller? 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: sched_setscheduler() vs idle_balance() race
On Sat, 2015-05-30 at 15:08 +0200, Mike Galbraith wrote: > On Thu, 2015-05-28 at 15:53 +0200, Peter Zijlstra wrote: > > On Thu, May 28, 2015 at 09:43:52AM +0200, Mike Galbraith wrote: > > > Hi Peter, > > > > > > I'm not seeing what prevents pull_task() from yanking a task out from > > > under __sched_setscheduler(). A box sprinkling smoldering 3.0 kernel > > > wreckage all over my bugzilla mbox isn't seeing it either ;-) > > > > Say, how easy can that thing be reproduced? > > > > The below is compile tested only, but it might just work if I didn't > > miss anything :-) > > Seems trying to make the target invisible to balancing created a new > race: dequeue target, do stuff that may drop rq->lock while it's > dequeued, target sneaks into schedule(), dequeues itself (#2), boom. Well, the below (ick) plugged it up, but... I don't see why we can't just say no in can_migrate_task() if ->pi_lock is held. It plugged the original hole in a lot less lines. Hohum, time to go pretend I have something better to do on a sunny Sunday morning ;-) massive_intr_x-6213 [007] d... 170.579339: pull_rt_task: yup, pulled massive_intr_x-6213 [002] d... 170.580114: pull_rt_task: yup, pulled massive_intr_x-6213 [006] d... 170.586083: pull_rt_task: yup, pulled <...>-6237 [006] d... 170.593878: __schedule: saving the day --- kernel/sched/core.c | 43 +++ kernel/sched/deadline.c |6 +++--- kernel/sched/rt.c | 11 +-- kernel/sched/sched.h| 10 +- 4 files changed, 56 insertions(+), 14 deletions(-) --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -2745,9 +2745,18 @@ static void __sched __schedule(void) * can't be reordered with __set_current_state(TASK_INTERRUPTIBLE) * done by the caller to avoid the race with signal_wake_up(). */ +dequeued: smp_mb__before_spinlock(); raw_spin_lock_irq(&rq->lock); + if (unlikely(!task_on_rq_queued(prev))) { + trace_printk("saving the day\n"); + tracing_off(); + raw_spin_unlock_irq(&rq->lock); + cpu_relax(); + goto dequeued; + } + rq->clock_skip_update <<= 1; /* promote REQ to ACT */ switch_count = &prev->nivcsw; @@ -3013,8 +3022,10 @@ void rt_mutex_setprio(struct task_struct prev_class = p->sched_class; queued = task_on_rq_queued(p); running = task_current(rq, p); - if (queued) + if (queued) { dequeue_task(rq, p, 0); + p->on_rq = TASK_ON_RQ_DEQUEUED; + } if (running) put_prev_task(rq, p); @@ -3067,8 +3078,10 @@ void rt_mutex_setprio(struct task_struct if (running) p->sched_class->set_curr_task(rq); - if (queued) + if (queued) { enqueue_task(rq, p, enqueue_flag); + p->on_rq = TASK_ON_RQ_QUEUED; + } /* * Both switched_to() and prio_changed() are allowed to drop @rq->lock; @@ -3114,8 +3127,10 @@ void set_user_nice(struct task_struct *p goto out_unlock; } queued = task_on_rq_queued(p); - if (queued) + if (queued) { dequeue_task(rq, p, 0); + p->on_rq = TASK_ON_RQ_DEQUEUED; + } p->static_prio = NICE_TO_PRIO(nice); set_load_weight(p); @@ -3125,6 +3140,7 @@ void set_user_nice(struct task_struct *p if (queued) { enqueue_task(rq, p, 0); + p->on_rq = TASK_ON_RQ_QUEUED; /* * If the task increased its priority or is running and * lowered its priority, then reschedule its CPU: @@ -3628,8 +3644,10 @@ static int __sched_setscheduler(struct t queued = task_on_rq_queued(p); running = task_current(rq, p); - if (queued) + if (queued) { dequeue_task(rq, p, 0); + p->on_rq = TASK_ON_RQ_DEQUEUED; + } if (running) put_prev_task(rq, p); @@ -3656,6 +3674,7 @@ static int __sched_setscheduler(struct t * increased (user space view). */ enqueue_task(rq, p, oldprio <= p->prio ? ENQUEUE_HEAD : 0); + p->on_rq = TASK_ON_RQ_QUEUED; } /* @@ -4943,8 +4962,10 @@ void sched_setnuma(struct task_struct *p queued = task_on_rq_queued(p); running = task_current(rq, p); - if (queued) + if (queued) { dequeue_task(rq, p, 0); + p->on_rq = TASK_ON_RQ_DEQUEUED; + } if (running) put_prev_task(rq, p); @@ -4952,8 +4973,10 @@ void sched_setnuma(struct task_struct *p if (running) p->sched_class->set_curr_task(rq); - if (queued) + if (queued) { enqueue_task(rq, p, 0); + p->on_rq = TASK_ON_RQ_
Re: [PATCH v3 1/2] usb: ehci-exynos: Make provision for vdd regulators
2014-06-25 21:42 GMT+09:00 Vivek Gautam : > Facilitate getting required 3.3V and 1.0V VDD supply for > EHCI controller on Exynos. > > With the patches for regulators' nodes merged in 3.15: > c8c253f ARM: dts: Add regulator entries to smdk5420 > 275dcd2 ARM: dts: add max77686 pmic node for smdk5250, > the exynos systems turn on only minimal number of regulators. > > Until now, the VDD regulator supplies were either turned on > by the bootloader, or the regulators were enabled by default > in the kernel, so that the controller drivers did not need to > care about turning on these regulators on their own. > This was rather bad about these controller drivers. > So ensuring now that the controller driver requests the necessary > VDD regulators (if available, unless there are direct VDD rails), > and enable them so as to make them working. > > Signed-off-by: Vivek Gautam > Cc: Jingoo Han > Cc: Alan Stern > --- > > Changes from v2: > - replaced devm_regulator_get() with devm_regulator_get_optional(). > - Added Documentation for the vdd supplies for the controller. > - Re-did the commit message. The patch looks useful but it seems it was forgotten. Do you have any plans to resend it? Best regards, Krzysztof -- 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] ARM: dts: odroidxu3: Enable USB3 regulators
2015-05-30 22:53 GMT+09:00 Anand Moon : > On 28 May 2015 at 14:49, Krzysztof Kozlowski wrote: >> On 28.05.2015 17:58, Anand Moon wrote: >>> Enable regulator for usbdrd3_0 and usbdrd3_1 From the schematic pin diagram USB3_0 and USB3_1 >>> is regulated by LDO9 and LD011. >> >> Please reformat statement above to proper sentence(s) without ">" before >> "From". >> >>> >>> Fix the boot message of failed. >>> [3.503539] exynos-dwc3 usb@1200: Looking up vdd33-supply from >>> device tree >>> [3.503556] exynos-dwc3 usb@1200: Looking up vdd33-supply property >>> in node /usb@1200 failed >>> [3.503568] usb@1200 supply vdd33 not found, using dummy regulator >>> [3.509154] exynos-dwc3 usb@1200: Looking up vdd10-supply from >>> device tree >>> [3.509170] exynos-dwc3 usb@1200: Looking up vdd10-supply property >>> in node /usb@1200 failed >>> [3.509181] usb@1200 supply vdd10 not found, using dummy regulator >>> [3.917548] exynos-dwc3 usb@1240: Looking up vdd33-supply from >>> device tree >>> [3.917565] exynos-dwc3 usb@1240: Looking up vdd33-supply property >>> in node /usb@1240 failed >>> [3.917578] usb@1240 supply vdd33 not found, using dummy regulator >>> [3.922731] exynos-dwc3 usb@1240: Looking up vdd10-supply from >>> device tree >>> [3.922747] exynos-dwc3 usb@1240: Looking up vdd10-supply property >>> in node /usb@1240 failed >>> >>> --- >>> This patch is based on Krzysztof github branch >>> work-next/odroid-xu3-s2mps11-irq >>> --- >> >> I mentioned this already on previous postings. Let's make an exercise. >> Please: >> 1. Save your email as mbox format (from mailer). >> 2. Go to a GIT repo with kernel and checkout base branch. >> 3. git am 0001-the-name-of-file.mbox >> 4. git show >> >> Do you see the signed-off-by in commit? >> >> The patch itself looks good, thanks for fixing this. Just please fix the >> issues with commit message. >> >> By the way: >> 1. The always-on from LDO9 could be probably removed if the ehci-exynos >> driver had regulator consumer implemented. >> 2. The Documentation/devicetree/bindings/usb/exynos-usb.txt (or dwc.txt) >> should proably mention the vdd-supply property. > > Hi Krzysztof, > > https://patchwork.kernel.org/patch/4420061/ > https://patchwork.kernel.org/patch/4420071/ > > These patch are missing for this changes to make it work correctly. > > Can you share you thought on this. They look quite old, it is a pity that they were not merged. Best regards, Krzysztof -- 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] Disable write buffering on Toshiba ToPIC95
Ryan, thanks for this patch. Could you add a "Signed-off-by" line as specified in Documentation/SubmittingPatches, please, so that I can pick it up and push it upstream? Thanks! Dominik On Sun, Jan 25, 2015 at 04:07:09PM -0800, Ryan C. Underwood wrote: > From: Ryan Underwood > > Disable write buffering on the Toshiba ToPIC95 if it is enabled by somebody > (it > is not supposed to be a power-on default according to the datasheet). On the > ToPIC95, practically no 32-bit Cardbus card will work under heavy load without > locking up the whole system if this is left enabled. I tried about a dozen. > It does not affect 16-bit cards. This is similar to the O2 bugs in early > controller revisions it seems. Originally posted to > https://bugzilla.kernel.org/show_bug.cgi?id=55961 > --- > drivers/pcmcia/topic.h | 16 > 1 file changed, 16 insertions(+) > > diff --git a/drivers/pcmcia/topic.h b/drivers/pcmcia/topic.h > index 615a45a..582688fe 100644 > --- a/drivers/pcmcia/topic.h > +++ b/drivers/pcmcia/topic.h > @@ -104,6 +104,9 @@ > #define TOPIC_EXCA_IF_CONTROL0x3e/* 8 bit */ > #define TOPIC_EXCA_IFC_33V_ENA 0x01 > > +#define TOPIC_PCI_CFG_PPBCN 0x3e/* 16-bit */ > +#define TOPIC_PCI_CFG_PPBCN_WBEN 0x0400 > + > static void topic97_zoom_video(struct pcmcia_socket *sock, int onoff) > { > struct yenta_socket *socket = container_of(sock, struct yenta_socket, > socket); > @@ -138,6 +141,7 @@ static int topic97_override(struct yenta_socket *socket) > static int topic95_override(struct yenta_socket *socket) > { > u8 fctrl; > + u16 ppbcn; > > /* enable 3.3V support for 16bit cards */ > fctrl = exca_readb(socket, TOPIC_EXCA_IF_CONTROL); > @@ -146,6 +150,18 @@ static int topic95_override(struct yenta_socket *socket) > /* tell yenta to use exca registers to power 16bit cards */ > socket->flags |= YENTA_16BIT_POWER_EXCA | YENTA_16BIT_POWER_DF; > > + /* Disable write buffers to prevent lockups under load with numerous > +Cardbus cards, observed on Tecra 500CDT and reported elsewhere on the > +net. This is not a power-on default according to the datasheet > +but some BIOSes seem to set it. */ > + if (pci_read_config_word(socket->dev, TOPIC_PCI_CFG_PPBCN, &ppbcn) == 0 > + && socket->dev->revision <= 7 > + && (ppbcn & TOPIC_PCI_CFG_PPBCN_WBEN)) { > + ppbcn &= ~TOPIC_PCI_CFG_PPBCN_WBEN; > + pci_write_config_word(socket->dev, TOPIC_PCI_CFG_PPBCN, ppbcn); > + dev_info(&socket->dev->dev, "Disabled ToPIC95 Cardbus write > buffers.\n"); > + } > + > return 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/ signature.asc Description: Digital signature
[PATCH v2] [media] dvb-frontend: Replace timeval with ktime_t
struct timeval uses a 32-bit seconds representation which will overflow in the year 2038 and beyond. This patch replaces the usage of struct timeval with ktime_t which is a 64-bit timestamp and is year 2038 safe. This patch is part of a larger attempt to remove all instances of 32-bit timekeeping variables (timeval, timespec, time_t) which are not year 2038 safe, from the kernel. The patch is a work-in-progress - correctness of the following changes is unclear: (a) Usage of timeval_usec_diff - The function seems to subtract usec values without caring about the difference of the seconds field. There may be an implicit assumption in the original code that the time delta is always of the order of microseconds. The patch replaces the usage of timeval_usec_diff with ktime_to_us(ktime_sub()) which computes the real timestamp difference, not just the difference in the usec field. (b) printk diffing the tv[i] and tv[i-1] values. The original printk statement seems to get the order wrong. This patch preserves that order. Signed-off-by: Tina Ruchandani Suggested-by: Arnd Bergmann -- Changes in v2: - Use the more concise ktime_us_delta - Preserve the waketime argument in dvb_frontend_sleep_until as a pointer, fixes bug introduced in v1 of the patch where the caller doesn't get its timestamp modified. --- drivers/media/dvb-core/dvb_frontend.c | 40 +-- drivers/media/dvb-core/dvb_frontend.h | 3 +-- drivers/media/dvb-frontends/stv0299.c | 11 +- 3 files changed, 17 insertions(+), 37 deletions(-) diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index 882ca41..c110e37 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include "dvb_frontend.h" @@ -889,42 +890,21 @@ static void dvb_frontend_stop(struct dvb_frontend *fe) fepriv->thread); } -s32 timeval_usec_diff(struct timeval lasttime, struct timeval curtime) -{ - return ((curtime.tv_usec < lasttime.tv_usec) ? - 100 - lasttime.tv_usec + curtime.tv_usec : - curtime.tv_usec - lasttime.tv_usec); -} -EXPORT_SYMBOL(timeval_usec_diff); - -static inline void timeval_usec_add(struct timeval *curtime, u32 add_usec) -{ - curtime->tv_usec += add_usec; - if (curtime->tv_usec >= 100) { - curtime->tv_usec -= 100; - curtime->tv_sec++; - } -} - /* * Sleep until gettimeofday() > waketime + add_usec * This needs to be as precise as possible, but as the delay is * usually between 2ms and 32ms, it is done using a scheduled msleep * followed by usleep (normally a busy-wait loop) for the remainder */ -void dvb_frontend_sleep_until(struct timeval *waketime, u32 add_usec) +void dvb_frontend_sleep_until(ktime_t *waketime, u32 add_usec) { - struct timeval lasttime; s32 delta, newdelta; - timeval_usec_add(waketime, add_usec); - - do_gettimeofday(&lasttime); - delta = timeval_usec_diff(lasttime, *waketime); + ktime_add_us(*waketime, add_usec); + delta = ktime_us_delta(ktime_get_real(), *waketime); if (delta > 2500) { msleep((delta - 1500) / 1000); - do_gettimeofday(&lasttime); - newdelta = timeval_usec_diff(lasttime, *waketime); + newdelta = ktime_us_delta(ktime_get_real(), *waketime); delta = (newdelta > delta) ? 0 : newdelta; } if (delta > 0) @@ -2458,13 +2438,13 @@ static int dvb_frontend_ioctl_legacy(struct file *file, * include the initialization or start bit */ unsigned long swcmd = ((unsigned long) parg) << 1; - struct timeval nexttime; - struct timeval tv[10]; + ktime_t nexttime; + ktime_t tv[10]; int i; u8 last = 1; if (dvb_frontend_debug) printk("%s switch command: 0x%04lx\n", __func__, swcmd); - do_gettimeofday(&nexttime); + nexttime = ktime_get_real(); if (dvb_frontend_debug) tv[0] = nexttime; /* before sending a command, initialize by sending @@ -2475,7 +2455,7 @@ static int dvb_frontend_ioctl_legacy(struct file *file, for (i = 0; i < 9; i++) { if (dvb_frontend_debug) - do_gettimeofday(&tv[i + 1]); + tv[i+1] = ktime_get_real(); if ((swcmd & 0x01) != last) { /* set voltage to (last ? 13V : 18V) */
Re: [RFC 07/24] x86/thinkpad_acpi: Use arch_nvram_ops methods instead of nvram_read_byte() and nvram_write_byte()
On Sun, 31 May 2015, Henrique de Moraes Holschuh wrote: > 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. The procedure I used was this, 1. $ xev 2. # rmmod thinkpad_acpi 3. Press key and confirm that xev does not report any events. 4. # modprobe thinkpad_acpi 5. Press key and confirm that xev now reports the key press events. Is this sufficient? Regards, Finn > > > --- > > 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, &lec))) > > 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, &lec))) > > goto unlock; > > lec &= ec_mask; > > - b_nvram = nvram_read_byte(TP_NVRAM_ADDR_MIXER); > > + b_nvram = arch_nvra
[PATCH v2] timekeeping: always make sure wall_to_monotonic isn't positive
I meet two issues on an IMX6 development board without enable RTC device(so timekeeping_init will initialize the boot time and monotonic to 0). Issue 1:exportfs -a generate: "exportfs: /opt/nfs/arm does not support NFS export" Issue 2:cat /proc/stat: "btime 4294967236" Exact reproduction of the same issues on x86 after run below code: " int main(void) { struct timeval val; int ret; val.tv_sec = 0; val.tv_usec = 0; ret = settimeofday(&val, NULL); return 0; } " Reason: The reason is positive wall_to_monotonic push boot time back to the time before Epoch, getboottime will return negative value. In issue 1: negative boot time cause get_expiry overflow time_t when input expire time is 2147483647, then cache_flush always clear entries just added in ip_map_parse. In issue 2: show_stat use "unsigned long" to print negative value return by getboottime. This patch fix these two issues. Note: this patch will cause we can't use settimeofday with time earlier than current time on system which timekeeping_init initialize the xtime, boot and monotonic to 0 before set current time to a more reasonable time point. Signed-off-by: Wang YanQing --- Changes v1-v2: 1: fix subject, use "isn't positive" instead of "is negative". 2: rewrite changelog. 3: simplify code as suggested by John Stultz. It really take me some times to realize how stupid and buggy the version 1 patch is, but I am ready to be told this version is even stupider:) Thanks. kernel/time/timekeeping.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 0d784b3..b501aa6 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -895,6 +895,7 @@ int do_settimeofday64(const struct timespec64 *ts) struct timekeeper *tk = &tk_core.timekeeper; struct timespec64 ts_delta, xt; unsigned long flags; + int ret = 0; if (!timespec64_valid_strict(ts)) return -EINVAL; @@ -908,10 +909,15 @@ int do_settimeofday64(const struct timespec64 *ts) ts_delta.tv_sec = ts->tv_sec - xt.tv_sec; ts_delta.tv_nsec = ts->tv_nsec - xt.tv_nsec; + if (timespec64_compare(&tk->wall_to_monotonic, &ts_delta) > 0) { + ret = -EINVAL; + goto out; + } + tk_set_wall_to_mono(tk, timespec64_sub(tk->wall_to_monotonic, ts_delta)); tk_set_xtime(tk, ts); - +out: timekeeping_update(tk, TK_CLEAR_NTP | TK_MIRROR | TK_CLOCK_WAS_SET); write_seqcount_end(&tk_core.seq); @@ -920,7 +926,7 @@ int do_settimeofday64(const struct timespec64 *ts) /* signal hrtimers about time change */ clock_was_set(); - return 0; + return ret; } EXPORT_SYMBOL(do_settimeofday64); @@ -949,7 +955,8 @@ int timekeeping_inject_offset(struct timespec *ts) /* Make sure the proposed value is valid */ tmp = timespec64_add(tk_xtime(tk), ts64); - if (!timespec64_valid_strict(&tmp)) { + if (timespec64_compare(&tk->wall_to_monotonic, &ts64) > 0 || + !timespec64_valid_strict(&tmp)) { ret = -EINVAL; goto error; } -- 1.8.5.6.2.g3d8a54e.dirty -- 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: lp8755: Convert to devm_request_threaded_irq
Signed-off-by: Axel Lin --- drivers/regulator/lp8755.c | 23 --- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/drivers/regulator/lp8755.c b/drivers/regulator/lp8755.c index 4a415d4..d6773da 100644 --- a/drivers/regulator/lp8755.c +++ b/drivers/regulator/lp8755.c @@ -419,20 +419,16 @@ static int lp8755_int_config(struct lp8755_chip *pchip) } ret = lp8755_read(pchip, 0x0F, ®val); - if (ret < 0) - goto err_i2c; - pchip->irqmask = regval; - ret = request_threaded_irq(pchip->irq, NULL, lp8755_irq_handler, - IRQF_TRIGGER_FALLING | IRQF_ONESHOT, - "lp8755-irq", pchip); - if (ret) + if (ret < 0) { + dev_err(pchip->dev, "i2c acceess error %s\n", __func__); return ret; + } - return ret; - -err_i2c: - dev_err(pchip->dev, "i2c acceess error %s\n", __func__); - return ret; + pchip->irqmask = regval; + return devm_request_threaded_irq(pchip->dev, pchip->irq, NULL, +lp8755_irq_handler, +IRQF_TRIGGER_FALLING | IRQF_ONESHOT, +"lp8755-irq", pchip); } static const struct regmap_config lp8755_regmap = { @@ -514,9 +510,6 @@ static int lp8755_remove(struct i2c_client *client) for (icnt = 0; icnt < LP8755_BUCK_MAX; icnt++) lp8755_write(pchip, icnt, 0x00); - if (pchip->irq != 0) - free_irq(pchip->irq, pchip); - return 0; } -- 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] perf/tool: remove newline char when reading event scale and unit
commit intruduced perf_event_sysfs_show function to display event_str value of an attr in kernel/event/core.c. But the function returns the value with a newline char. So, if a event also carries a event.unit file, when printing the counter data perf tool formatting goes for a spin. That is, because of the event unit, event name is printed in the newline because of perf_event_sysfs_show returns with a newline char. Now fixing perf core will break API, hencing proposing a fix in the perf tool. Cc: Arnaldo Carvalho de Melo Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Jiri Olsa Cc: Sukadev Bhattiprolu Cc: Michael Ellerman Signed-off-by: Madhavan Srinivasan --- tools/perf/util/pmu.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 4841167..cf2cb34 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -112,7 +112,11 @@ static int perf_pmu__parse_scale(struct perf_pmu_alias *alias, char *dir, char * if (sret < 0) goto error; - scale[sret] = '\0'; + if (scale[sret-1] == '\n') + scale[sret-1] = '\0'; + else + scale[sret] = '\0'; + /* * save current locale */ @@ -154,7 +158,10 @@ static int perf_pmu__parse_unit(struct perf_pmu_alias *alias, char *dir, char *n close(fd); - alias->unit[sret] = '\0'; + if (alias->unit[sret-1] == '\n') + alias->unit[sret-1] = '\0'; + else + alias->unit[sret] = '\0'; return 0; error: -- 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 1/2] staging: dgnc: use schedule_timeout_interruptible()
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
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
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(&lprof->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(&lprof->lp_list, &lustre_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
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
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
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(&newchannel->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
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, &channel->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(&primary->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(&primary->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(&primary->lock, flags); +
[PATCH V2 1/3] Drivers: hv: vmbus: Use the vp_index map even for channels bound to CPU 0
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
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
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(&data->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(&suspend_helper_data.done); + + /* use kworker for suspend resume */ + queue_work(suspend_helper_wq, &suspend_helper_data.work); + + /* wait for suspend/resume work to be complete */ + wait_for_completion(&suspend_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(&suspend_helper_data.work, suspend_helper); + init_completion(&suspend_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�&j:+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
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 oldconf
[GIT PULL] target fixes for v4.1-rc6
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
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(&pdev->dev, irq, NULL, da9063_ldo_lim_event, IRQF_TRIGGER_LOW | IRQF_ONESHOT, "LDO_LIM", regulators); if (ret) { - dev_err(&pdev->dev, - "Failed to request LDO_LIM IRQ.\n"); - regulators->irq_ldo_lim = -ENXIO; + dev_err(&pdev->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()
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, &lec))) > 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, &lec))) > 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
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
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(); - lprocfs_unregister_mountpoint(s
[PATCH 5/6] staging/lustre/obd: Remove nid_stats tracking
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
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
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->obd_proc_exports_entry); - obd->obd_proc_exports_entry = NULL; - } - if (!IS_ERR_OR_NULL(obd->obd_debugfs_entry)) ldebugfs_remove(&obd->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->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, &stats->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, &stats->nid, - lprocfs_exp_print_hash, &cb_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; - -
[PATCH 2/6] staging/lustre/obd: remove unused proc_lustre_root
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(&proc_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
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
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().
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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()
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()
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()
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
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()
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
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(&nvram_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, &nvram_proc_fops)) { pr_err("nvram: can't create /proc/driver/nvram\n"); misc_deregister(&nvram_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(&nvram_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
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(&nvram_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(&nvram_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
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(&rtc_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, +
[RFC 04/24] m68k/atari: Replace nvram_{read,write}_byte with arch_nvram_ops
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(&rtc_lock, flags); - c = __nvram_read_byte(i); - spin_unlock_irqrestore(&rtc_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(&rtc_lock, flags); - __nvram_write_byte(c, i); - spin_unlock_irqrestore(&rtc_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(&rtc_lock, flags); - rv = __nvram_check_checksum(); - spin_unlock_irqrestore(&rtc_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(&rtc_lock); + + if (!__nvram_check_checksum()) { + spin_unlock_irq(&rtc_lock); + return -EIO; + } + + for (i = *ppos; count > 0 && i < NVRAM_BYTES; --count, ++i, ++p) + *p = __nvram_read_byte(i); + + spin_unlock_irq(&rtc_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(&rtc_lock); + + if (!__nvram_check_checksum()) { + spin_unlock_irq(&rtc_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(&rtc_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(&b, 1, &offset); /* Arbitration enabled? (for TOS) * If yes, use configured host ID */ - if (b &
[RFC 13/24] powerpc: Cleanup nvram includes
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
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(&rtc_lock); + __nvram_set_checksum(); + spin_unlock_irq(&rtc_lock); + return 0; +} + +static long nvram_initialize(void) +{ + ssize_t i; - spin_lock_irqsave(&rtc_lock, flags); + spin_lock_irq(&rtc_lock); + for (i = 0; i < NVRAM_BYTES; ++i) + __nvram_write_byte(0, i); __nvram_set_checksum(); - spin_unlock_irqrestore(&rtc_lock, flags); + spin_unlock_irq(&rtc_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(&nvram_mutex); - spin_lock_irq(&rtc_lock); - - for (i = 0; i < NVRAM_BYTES; ++i) - __nvram_write_byte(0, i); - __nvram_set_checksum(); - - spin_unlock_irq(&rtc_lock); + if (arch_nvram_ops.initialize != NULL) + ret = arch_nvram_ops.initialize(); mutex_unlock(&nvram_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(&nvram_mutex); - spin_lock_irq(&rtc_lock); - __nvram_set_checksum(); - spin_unlock_irq(&rtc_lock); + if (arch_nvram_ops.set_checksum != NULL) + ret = arch_nvram_ops.set_checksum(); mutex_unlock(&nvram_mutex); - return 0; - - default: - return -ENOTTY; + break; } + return ret; } static int nvram_misc_open(struct inode *inode, struct file *file) { spin_lock(&nvram_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(&nvram_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(&nvram_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"
[RFC 01/24] macintosh/nvram: Remove as unused
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(&part, (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, &offset, 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", - &nvram_fops -}; - -int __init nvram_init(void) -{ - printk(KERN_INFO "Macintosh non-volatile memory driver v%s\n", - NVRAM_VERSION); - return misc_register(&nvram_dev); -} - -void __exit nvram_cleanup(void) -{ -misc_deregister( &nvram_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
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(&rtc_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(&rtc_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(&rtc_lock, flags); - rv = __nvram_check_checksum(); - spin_unlock_irqrestore(&rtc_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
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(&nvram_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(&nvram_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
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(&req, NULL, 3, PMU_READ_NVRAM, - (offset >> 8) & 0xFF, offset & 0xFF) < 0) + + if (pmu_request(&req, 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(&req, NULL, 4, PMU_WRITE_NVRAM, - (offset >> 8) & 0xFF, offset & 0xFF, data) < 0) + + if (pmu_request(&req, 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, &temp); + + 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, &temp); + + /* Write the byte to XPRAM */ + temp = data; + via_pram_command(0x3800 | 0x0001 | addr, &temp); + + /* Set the write protect bit */ + temp = 0xD5; + via_pram_command(0x34 | 0x01, &temp); } #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
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()
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, &lec))) 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, &lec))) 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
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 RAM"
[RFC 09/24] char/nvram: Implement NVRAM read/write methods
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(&rtc_lock); + if (!__nvram_check_checksum()) { + spin_unlock_irq(&rtc_lock); + return -EIO; + } + for (i = *ppos; count > 0 && i < NVRAM_BYTES; --count, ++i, ++p) + *p = __nvram_read_byte(i); + spin_unlock_irq(&rtc_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(&rtc_lock); + if (!__nvram_check_checksum()) { + spin_unlock_irq(&rtc_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(&rtc_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(&rtc_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(&rtc_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(&rtc_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, b
[RFC 02/24] scsi/atari_scsi: Dont select CONFIG_NVRAM
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
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(&rtc_lock, flags); + c = __nvram_read_byte(i); + spin_unlock_irqrestore(&rtc_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(&rtc_lock, flags); + __nvram_write_byte(c, i); + spin_unlock_irqrestore(&rtc_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(&rtc_lock, flags); + rv = __nvram_check_checksum(); + spin_unlock_irqrestore(&rtc_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(&rtc_lock); + checksum = __nvram_check_checksum(); + spin_unlock_irq(&rtc_lock); + + seq_printf(seq, "Checksum status : %svalid\n", checksum ? "" : "not "); + + seq_puts(seq, "B
[RFC 21/24] powerpc: Adopt nvram module for PPC64
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(&lock, 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()
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
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(&rtc_lock); + __nvram_set_checksum(); + spin_unlock_irq(&rtc_lock); + return 0; +} + +static long nvram_initialize(void) +{ + loff_t i; + + spin_lock_irq(&rtc_lock); + for (i = 0; i < NVRAM_BYTES; ++i) + __nvram_write_byte(0, i); + __nvram_set_checksum(); + spin_unlock_irq(&rtc_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
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(&part, + (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, +&offset, sizeof(offset)) != 0) + return -EFAULT; + ret = 0; + break; + } +#endif + case IOC_NVRAM_SYNC: + mutex_lock(&nvram_mutex); + if (arch_nvram_ops.sync != NULL) + ret = arch_nvram_ops.sync(); + mutex_unlock(&nvram_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(&nvram_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(&nvram_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("
[RFC 00/24] Re-use nvram module
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
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(&req, 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(&req, 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(&req, 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(&req, 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(&req, 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(&req, 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[vB
[RFC 05/24] char/nvram: Re-order functions to remove forward declarations and #ifdefs
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(&nvram_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(&nvram_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(&rtc_lock); - for (i = 0; i < NVRAM_BYTES; ++i) - contents[i] = __nvram_read_byte(i); - spin_unlock_irq(&rtc_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, &nvram_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", - &nvram_fops -}; - -static int __init nvram_init(void) -{ - int ret; - - ret = misc_register(&nvram_dev); - if (ret) { - printk(KERN_ERR "nvram: can't misc_register on minor=%d\n", - NVRAM_MINOR); - goto out; -
[RFC 20/24] char/generic_nvram: Remove as unused
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(&part, (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, &offset, 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(&nvram_mutex); - ret = nvram_ioctl(file, cmd, arg); - mutex_unlock(&nvram_mutex); - - return ret; -} - -const struct file_operations nvram_fops = { - .owner = THIS_MODULE, - .llseek = nvram_llseek, - .read = read_nvram, - .write = write_nvram, - .unlocked_i
[RFC 12/24] char/nvram: Add "devname:nvram" module alias
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
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
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
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
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
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(&pdev->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", > +&ion_heap_name); > + if (ret != 0) > + goto errfreeipdev; > + > + ret = of_property_read_u32(pdev->dev.of_node, "ion-heap-id", > + &ion_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(&pdev->dev, "bad heap id specified: %d\n", > + ion_heap_id); > + goto errfreeipdev; > + } > + > + if ((1 << ion_heap_id) & claimed_heap_ids) { > + dev_err(
Re: [PATCH V2 net-next 1/1] hv_netvsc: Properly size the vrss queues
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
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
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
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
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(&pi_task->dl, &p->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
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
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
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(&rq->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
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/