Re: [RFC 05/12] dt-bindings: mtd: add Marvell NAND controller documentation
On Wed, Oct 18, 2017 at 04:36:22PM +0200, Miquel Raynal wrote: > Document the bindings for the legacy and the new bindings relative to > Marvell NAND controller driver rework. > > Signed-off-by: Miquel Raynal> --- > .../devicetree/bindings/mtd/marvell-nand.txt | 95 > ++ > 1 file changed, 95 insertions(+) > create mode 100644 Documentation/devicetree/bindings/mtd/marvell-nand.txt > > diff --git a/Documentation/devicetree/bindings/mtd/marvell-nand.txt > b/Documentation/devicetree/bindings/mtd/marvell-nand.txt > new file mode 100644 > index ..ea99f426c03f > --- /dev/null > +++ b/Documentation/devicetree/bindings/mtd/marvell-nand.txt > @@ -0,0 +1,95 @@ > +Marvell NAND Flash Controller (NFC) > + > +Required properties: > +C'est faux, t'en a rajouté un y a pas longtps :). > +Je conseille de mettre ça sous forme de liste, genre Humm. > + > +- compatible: can be one of the following: > +* "marvell,armada-8k-nand-controller" > +* "marvell,armada370-nand-controller" > +* "marvell,pxa3xx-nand-controller" > +* "marvell,armada-8k-nand" (deprecated) > +* "marvell,armada370-nand" (deprecated) > +* "marvell,pxa3xx-nand" (deprecated) > +- reg: shall contain registers location and length for data and reg. 2 regions? > +- #address-cells: shall be set to 1. Encode the nand CS. > +- #size-cells: shall be set to 0. > +- interrupts: shall define the nand controller interrupt. > +- clocks: shall reference nand controller clocks. How many clocks? > +- marvell,system-controller: Set to retrieve the syscon node that handles > + NAND controller related registers (only required with the > + "marvell,armada-8k-nand[-controller]" compatibles). > + > +Optional properties: > +- dmas: shall reference DMA channel associated to the NAND controller. > +- dma-names: shall be "rxtx". > + > +Optional children nodes: > +Children nodes represent the available NAND chips. > + > +Required properties: > +- reg: shall contain the native Chip Select ids (0-3) > +- marvell,rb: shall contain the native Ready/Busy ids (0-1) > + > +Optional properties: > +- marvell,nand-keep-config: orders the driver not to take the timings > + from the core and leaving them completely untouched. Bootloader > + timings will then be used. > +- marvell,nand-enable-arbiter: only useful for PXA platforms, will > + enable bus arbiter between NFC and DFI bus (must be enabled for > + NFC operation) Why do you need this if it must be enabled? > +- nand-on-flash-bbt: speed up the boot process by not discovering all > + the bad blocks at each boot and reading directly an on flash table. > +- nand-ecc-mode: one of the supported ECC modes ("none", "soft", > + "hw"). If not specified, hardware ECC will be used. > +- nand-ecc-algo: algorithm to use if previous choice was "soft" > + ("hamming" or "bch). This property may be added for hardware ECC for > + clarification but will be ignored by the driver because ECC mode is > + chosen depending on the page size and the strength required by the > + NAND chip. This value may be overwritten with the nand-ecc-strength > + property. > +- nand-ecc-strength: desired ECC strength. > +- nand-ecc-step-size: indication on the ECC step size. This has no > + effect and will be ignored by the driver when using hardware > + ECC. Because Marvell's NAND flash controller does use fixed strength > + (1-bit for Hamming, 16-bit for BCH), the step size will shrink or > + grown in order to fit the required strength and the value > + updated. Step sizes are not completely random for all and follow > + certain patterns described in AN-379, "Marvell SoC NFC ECC". For standard properties, just reference nand.txt and add any constraints. Don't define what the property is again. > + > +See Documentation/devicetree/bindings/mtd/nand.txt for more details on > +generic bindings. > + > + > +Example: > +nand_controller: nand-controller@d { > + compatible = "marvell,armada370-nand-controller"; > + reg = <0xd 0x54>; > + #address-cells = <1>; > + #size-cells = <0>; > + interrupts = ; > + clocks = < 0>; > + status = "okay"; Don't show status in examples. > + > + nand@0 { > + reg = <0>; > + marvell,rb = <0>; > + nand-ecc-mode = "hw"; > + marvell,nand-keep-config; > + marvell,nand-enable-arbiter; > + nand-on-flash-bbt; > + nand-ecc-strength = <4>; > + nand-ecc-step-size = <512>; > + > + partitions { > + compatible = "fixed-partitions"; > + #address-cells = <1>; > + #size-cells = <1>; > + > + partition@0 { > + label = "Rootfs"; > + reg = <0x 0x4000>; > + }; > + }; > + }; > +}; > -- > 2.11.0 >
Re: [PATCH v2 1/4] android: binder: Don't get mm from task
On Tue, Oct 24, 2017 at 12:28 AM, Greg Kroah-Hartmanwrote: > On Mon, Oct 23, 2017 at 11:18:52AM -0700, Arve Hjønnevåg wrote: >> On Sat, Oct 21, 2017 at 1:15 AM, Greg Kroah-Hartman >> wrote: >> > On Fri, Oct 20, 2017 at 08:58:58PM -0400, Sherry Yang wrote: >> >> Use binder_alloc struct's mm_struct rather than getting >> >> a reference to the mm struct through get_task_mm to >> >> avoid a potential deadlock between lru lock, task lock and >> >> dentry lock, since a thread can be holding the task lock >> >> and the dentry lock while trying to acquire the lru lock. >> >> >> >> Acked-by: Arve Hjønnevåg >> >> Signed-off-by: Sherry Yang >> >> --- >> >> drivers/android/binder_alloc.c | 22 +- >> >> drivers/android/binder_alloc.h | 1 - >> >> 2 files changed, 9 insertions(+), 14 deletions(-) >> > >> > I've applied these first 2 patches, but patches 3 and 4 I have already >> > applied to my char-misc-next tree, right? >> > >> > thanks, >> > >> > greg k-h >> >> I would expect you got a merge conflict from one of those. Using patch >> 3 and 4 in from this patchset should avoid that conflict if your >> eventual 4.15 branch is not based on your current char-misc-next >> branch. > > I've resolved the merge conflict so my char-misc-next branch should be > all caught up now. It would be wonderful if you could verify this. > > thanks, > > greg k-h I have not tested your branch directly, but the relevant code in char-misc-next is now identical to the code I tested. -- Arve Hjønnevåg ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v3 02/26] staging: most: integrate driver in kernel's device model
On Fri, 20 Oct 2017 16:56:10 +0200 Greg KHwrote: > On Fri, Oct 20, 2017 at 04:20:33PM +0200, Christian Gromm wrote: > > On 18.10.2017 16:29, Greg KH wrote: > > > On Wed, Oct 18, 2017 at 04:02:33PM +0200, Christian Gromm wrote: > > > > On 18.10.2017 14:12, Greg KH wrote: > > > > > On Mon, Oct 16, 2017 at 10:46:09AM +0200, Christian Gromm > > > > > wrote: > > > > > > The following patch adapts the driver to use the device > > > > > > model by: > > > > > > > > > > > > - adopting the MOST bus_type > > > > > > - registering the core as a busdriver > > > > > > - removing private kobject/kset usage > > > > > > - removing private lists and structures to track > > > > > > registered modules and making use of the device model API > > > > > > - removing prefix of modules > > > > > > - allowing adapter drivers (a.k.a. HDM) to register > > > > > > MOST devices > > > > > > - registering AIM modules as components with the > > > > > > core to build the user space experience of the driver stack > > > > > > - using attribute groups to create the sysfs files > > > > > > - renaming variables to prevent collision with the > > > > > > introduced device structs. > > > > > > > > > > Hint, when you have to enumerate a list of different things > > > > > you do in a single patch, that is a _huge_ sign that the > > > > > patch needs to be broken up into smaller pieces, each piece > > > > > only doing one logical thing. > > > > > > > > > > > > > This is a huge reconstruction of the driver architecture that > > > > requires more than one thing be done at a time. Breaking this > > > > up into tiny patches might render the sources broken, if you > > > > don't apply the complete series. (Which is also a no-go, right?) > > > > > > > > Since staging is meant to be the place to fix things up, > > > > I thought I'd get away with this. Anyways, I'll try... > > > > > > Try to make it into something that you would want to be able to > > > review :) > > > > > > > Well... ok then. > > > > Do think you can spend an extra minute in Prague next week, so we > > can talk about what's next? > > Sure, but to start with, getting this patch series into a mergable > state is "what is next" :) > What about Wednesday, the slot right before (or right after) lunch time? Does this happen to fit in your schedule? regards, Chris ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v6 2/2] staging: ion: create one device entry per heap
On Mon, Oct 23, 2017 at 05:55:37PM +0200, Benjamin Gaignard wrote: > Instead a getting only one common device "/dev/ion" for > all the heaps this patch allow to create one device > entry ("/dev/ionX") per heap. > Getting an entry per heap could allow to set security rules > per heap and global ones for all heaps. > > Allocation requests will be only allowed if the mask_id > match with device minor. > Query request could be done on any of the devices. > > Ion devices are parentless so it is need to add platform_bus as > parent and platform_bus_type as bus to be put in /sys/device/paltform. nit: paltform -> platform. Jordan -- The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2] staging: greybus: Convert timers to use timer_setup()
On 24/10/17 15:49, Kees Cook wrote: In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: Greg Kroah-HartmanCc: "Bryan O'Donoghue" Cc: Johan Hovold Cc: Alex Elder Cc: greybus-...@lists.linaro.org Cc: de...@driverdev.osuosl.org Signed-off-by: Kees Cook --- v2: Added back "get" in timer code, thanks to Bryan. :) --- drivers/staging/greybus/loopback.c | 19 +-- drivers/staging/greybus/operation.c | 7 +++ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c index 08e255884206..1c0bafeb7ea5 100644 --- a/drivers/staging/greybus/loopback.c +++ b/drivers/staging/greybus/loopback.c @@ -572,16 +572,16 @@ static void gb_loopback_async_operation_work(struct work_struct *work) gb_loopback_async_operation_put(op_async); } -static void gb_loopback_async_operation_timeout(unsigned long data) +static void gb_loopback_async_operation_timeout(struct timer_list *t) { - struct gb_loopback_async_operation *op_async; - u16 id = data; + struct gb_loopback_async_operation *op_async = + from_timer(op_async, t, timer); + unsigned long flags; + + spin_lock_irqsave(_dev.lock, flags); + gb_loopback_async_operation_get(op_async); + spin_unlock_irqrestore(_dev.lock, flags); Damnit I'm just wrong (I hate that). The pointer can already have gone away by the time the timer runs - my bad... see attached for update - with my Signed-off added. --- bod >From aa9fbf091122c816a47de2aece5412f7fd9225a9 Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Tue, 24 Oct 2017 07:49:38 -0700 Subject: [PATCH] staging: greybus: Convert timers to use timer_setup() In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: Greg Kroah-Hartman Cc: "Bryan O'Donoghue" Cc: Johan Hovold Cc: Alex Elder Cc: greybus-...@lists.linaro.org Cc: de...@driverdev.osuosl.org Signed-off-by: Kees Cook Signed-off-by: Bryan O'Donoghue --- drivers/staging/greybus/loopback.c | 38 ++--- drivers/staging/greybus/operation.c | 7 +++ 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c index 08e2558..81447e3 100644 --- a/drivers/staging/greybus/loopback.c +++ b/drivers/staging/greybus/loopback.c @@ -472,6 +472,26 @@ static void gb_loopback_async_operation_put(struct gb_loopback_async_operation spin_unlock_irqrestore(_dev.lock, flags); } +static struct gb_loopback_async_operation *gb_loopback_async_operation_valid( + struct gb_loopback_async_operation *op_async) +{ + struct gb_loopback_async_operation *op_async_tmp; + bool found = false; + unsigned long flags; + + spin_lock_irqsave(_dev.lock, flags); + list_for_each_entry(op_async_tmp, _dev.list_op_async, entry) { + if (op_async_tmp == op_async) { + gb_loopback_async_operation_get(op_async); + found = true; + break; + } + } + spin_unlock_irqrestore(_dev.lock, flags); + + return found ? op_async : NULL; +} + static struct gb_loopback_async_operation * gb_loopback_operation_find(u16 id) { @@ -572,17 +592,14 @@ static void gb_loopback_async_operation_work(struct work_struct *work) gb_loopback_async_operation_put(op_async); } -static void gb_loopback_async_operation_timeout(unsigned long data) +static void gb_loopback_async_operation_timeout(struct timer_list *t) { - struct gb_loopback_async_operation *op_async; - u16 id = data; + struct gb_loopback_async_operation *op_async = + from_timer(op_async, t, timer); - op_async = gb_loopback_operation_find(id); - if (!op_async) { - pr_err("operation %d not found - time out ?\n", id); - return; - } - schedule_work(_async->work); + op_async = gb_loopback_async_operation_valid(op_async); + if (op_async) + schedule_work(_async->work); } static int gb_loopback_async_operation(struct gb_loopback *gb, int type, @@ -631,8 +648,7 @@ static int gb_loopback_async_operation(struct gb_loopback *gb, int type, if (ret) goto error; - setup_timer(_async->timer, gb_loopback_async_operation_timeout, - (unsigned long)operation->id); + timer_setup(_async->timer, gb_loopback_async_operation_timeout, 0); op_async->timer.expires = jiffies + gb->jiffy_timeout; add_timer(_async->timer); diff --git a/drivers/staging/greybus/operation.c b/drivers/staging/greybus/operation.c index 3023012..ee4ba3f 100644
[PATCH v2] staging: greybus: Convert timers to use timer_setup()
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: Greg Kroah-HartmanCc: "Bryan O'Donoghue" Cc: Johan Hovold Cc: Alex Elder Cc: greybus-...@lists.linaro.org Cc: de...@driverdev.osuosl.org Signed-off-by: Kees Cook --- v2: Added back "get" in timer code, thanks to Bryan. :) --- drivers/staging/greybus/loopback.c | 19 +-- drivers/staging/greybus/operation.c | 7 +++ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c index 08e255884206..1c0bafeb7ea5 100644 --- a/drivers/staging/greybus/loopback.c +++ b/drivers/staging/greybus/loopback.c @@ -572,16 +572,16 @@ static void gb_loopback_async_operation_work(struct work_struct *work) gb_loopback_async_operation_put(op_async); } -static void gb_loopback_async_operation_timeout(unsigned long data) +static void gb_loopback_async_operation_timeout(struct timer_list *t) { - struct gb_loopback_async_operation *op_async; - u16 id = data; + struct gb_loopback_async_operation *op_async = + from_timer(op_async, t, timer); + unsigned long flags; + + spin_lock_irqsave(_dev.lock, flags); + gb_loopback_async_operation_get(op_async); + spin_unlock_irqrestore(_dev.lock, flags); - op_async = gb_loopback_operation_find(id); - if (!op_async) { - pr_err("operation %d not found - time out ?\n", id); - return; - } schedule_work(_async->work); } @@ -631,8 +631,7 @@ static int gb_loopback_async_operation(struct gb_loopback *gb, int type, if (ret) goto error; - setup_timer(_async->timer, gb_loopback_async_operation_timeout, - (unsigned long)operation->id); + timer_setup(_async->timer, gb_loopback_async_operation_timeout, 0); op_async->timer.expires = jiffies + gb->jiffy_timeout; add_timer(_async->timer); diff --git a/drivers/staging/greybus/operation.c b/drivers/staging/greybus/operation.c index 3023012808d9..ee4ba3f23bef 100644 --- a/drivers/staging/greybus/operation.c +++ b/drivers/staging/greybus/operation.c @@ -294,9 +294,9 @@ static void gb_operation_work(struct work_struct *work) gb_operation_put(operation); } -static void gb_operation_timeout(unsigned long arg) +static void gb_operation_timeout(struct timer_list *t) { - struct gb_operation *operation = (void *)arg; + struct gb_operation *operation = from_timer(operation, t, timer); if (gb_operation_result_set(operation, -ETIMEDOUT)) { /* @@ -541,8 +541,7 @@ gb_operation_create_common(struct gb_connection *connection, u8 type, goto err_request; } - setup_timer(>timer, gb_operation_timeout, - (unsigned long)operation); + timer_setup(>timer, gb_operation_timeout, 0); } operation->flags = op_flags; -- 2.7.4 -- Kees Cook Pixel Security ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: greybus: Convert timers to use timer_setup()
On Tue, Oct 24, 2017 at 6:30 AM, Bryan O'Donoghuewrote: > On 24/10/17 14:14, Kees Cook wrote: >> >> On Tue, Oct 24, 2017 at 5:52 AM, Bryan O'Donoghue >> wrote: >>> >>> On 24/10/17 13:47, Kees Cook wrote: On Tue, Oct 24, 2017 at 2:40 AM, Bryan O'Donoghue wrote: > > > On 24/10/17 10:35, Bryan O'Donoghue wrote: >> >> >> >> On 24/10/17 09:25, Kees Cook wrote: >>> >>> >>> >>> In preparation for unconditionally passing the struct timer_list >>> pointer >>> to >>> all timer callbacks, switch to using the new timer_setup() and >>> from_timer() >>> to pass the timer pointer explicitly. >>> >>> Cc: Greg Kroah-Hartman >>> Cc: "Bryan O'Donoghue" >>> Cc: Johan Hovold >>> Cc: Alex Elder >>> Cc: greybus-...@lists.linaro.org >>> Cc: de...@driverdev.osuosl.org >>> Signed-off-by: Kees Cook >>> --- >>> drivers/staging/greybus/loopback.c | 14 -- >>> drivers/staging/greybus/operation.c | 7 +++ >>> 2 files changed, 7 insertions(+), 14 deletions(-) >>> >>> diff --git a/drivers/staging/greybus/loopback.c >>> b/drivers/staging/greybus/loopback.c >>> index 08e255884206..045aaf81113a 100644 >>> --- a/drivers/staging/greybus/loopback.c >>> +++ b/drivers/staging/greybus/loopback.c >>> @@ -572,16 +572,11 @@ static void >>> gb_loopback_async_operation_work(struct >>> work_struct *work) >>> gb_loopback_async_operation_put(op_async); >>> } >>> -static void gb_loopback_async_operation_timeout(unsigned long data) >>> +static void gb_loopback_async_operation_timeout(struct timer_list >>> *t) >>> { >>> -struct gb_loopback_async_operation *op_async; >>> -u16 id = data; >>> +struct gb_loopback_async_operation *op_async = >>> +from_timer(op_async, t, timer); >>> -op_async = gb_loopback_operation_find(id); >>> -if (!op_async) { >>> -pr_err("operation %d not found - time out ?\n", id); >>> -return; >>> -} >> >> >> >> >> Hi Kees, you need to add >> >>gb_loopback_async_operation_get(op_async); when dropping the >> gb_loopback_operation_find() call here. > > > > > Actually: > > spin_lock_irqsave(_dev.lock, flags); > gb_loopback_async_operation_get(op_async); > spin_unlock_irqrestore(_dev.lock, flags); Shouldn't the get/put follow the lifetime of the timer running instead? It shouldnt' be possible to free the op_async while the timer is still pending/running. >>> >>> >>> The timeout timer runs for an operation that never completed but on the >>> regular "everything is good" path you end up doing >>> del_timer_sync(_async->timer); so the timer doesn't run. >> >> >> As far as I can tell, the get/put is already happening external to the >> timer: >> >> gb_loopback_async_operation(): >> ... >> op_async = kzalloc(sizeof(*op_async), GFP_KERNEL); >> ... >> INIT_WORK(_async->work, gb_loopback_async_operation_work); >> kref_init(_async->kref); >> ... >> op_async->pending = true; >> ... >> ret = gb_operation_request_send(operation, >> >> gb_loopback_async_operation_callback, >> 0, >> GFP_KERNEL); >> ... >> timer_setup(_async->timer, >> gb_loopback_async_operation_timeout, 0); >> op_async->timer.expires = jiffies + gb->jiffy_timeout; >> add_timer(_async->timer); >> >> >> gb_loopback_async_operation_callback(): (run by operation) >> ... >> op_async->pending = false; >> del_timer_sync(_async->timer); >> gb_loopback_async_operation_put(op_async); >> >> >> gb_loopback_async_operation_work(): (scheduled by timer) >> ... >> op_async->pending = false; >> gb_loopback_async_operation_put(op_async); >> > > >> (Doing a get/put in the timer callback itself shouldn't be happening: >> it must already be pinned in memory for the callback to run.) > > > Both gb_loopback_async_operation_callback() and > (gb_loopback_async_operation_timeout || gb_loopback_async_operation_work()) > can run in parallel so the get in the timer callback means we can let the > timer stuff free-run w/r to gb_loopback_async_operation_callback() - take a > reference indicating we still want that object and then let > gb_loopback_async_operation_work() run. Ah right, we're protecting the scheduled worker thread. I'll send a v2, thanks! -Kees -- Kees Cook Pixel Security
Searching help for Linux support for RTL8812AU
Hey Linux wireless list, A while ago I bought an ALFA Network AWUS036AC[0] which does not yet seem to be supported in Linux mainline. I would like to get it supported. The problem is that I have not that much experience doing software development. kind regards txt.file PS: Please keep me in CC as I am not subscribed to the lists. [0] https://wikidevi.com/wiki/ALFA_Network_AWUS036AC signature.asc Description: OpenPGP digital signature ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: greybus: Convert timers to use timer_setup()
On 24/10/17 14:14, Kees Cook wrote: On Tue, Oct 24, 2017 at 5:52 AM, Bryan O'Donoghuewrote: On 24/10/17 13:47, Kees Cook wrote: On Tue, Oct 24, 2017 at 2:40 AM, Bryan O'Donoghue wrote: On 24/10/17 10:35, Bryan O'Donoghue wrote: On 24/10/17 09:25, Kees Cook wrote: In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: Greg Kroah-Hartman Cc: "Bryan O'Donoghue" Cc: Johan Hovold Cc: Alex Elder Cc: greybus-...@lists.linaro.org Cc: de...@driverdev.osuosl.org Signed-off-by: Kees Cook --- drivers/staging/greybus/loopback.c | 14 -- drivers/staging/greybus/operation.c | 7 +++ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c index 08e255884206..045aaf81113a 100644 --- a/drivers/staging/greybus/loopback.c +++ b/drivers/staging/greybus/loopback.c @@ -572,16 +572,11 @@ static void gb_loopback_async_operation_work(struct work_struct *work) gb_loopback_async_operation_put(op_async); } -static void gb_loopback_async_operation_timeout(unsigned long data) +static void gb_loopback_async_operation_timeout(struct timer_list *t) { -struct gb_loopback_async_operation *op_async; -u16 id = data; +struct gb_loopback_async_operation *op_async = +from_timer(op_async, t, timer); -op_async = gb_loopback_operation_find(id); -if (!op_async) { -pr_err("operation %d not found - time out ?\n", id); -return; -} Hi Kees, you need to add gb_loopback_async_operation_get(op_async); when dropping the gb_loopback_operation_find() call here. Actually: spin_lock_irqsave(_dev.lock, flags); gb_loopback_async_operation_get(op_async); spin_unlock_irqrestore(_dev.lock, flags); Shouldn't the get/put follow the lifetime of the timer running instead? It shouldnt' be possible to free the op_async while the timer is still pending/running. The timeout timer runs for an operation that never completed but on the regular "everything is good" path you end up doing del_timer_sync(_async->timer); so the timer doesn't run. As far as I can tell, the get/put is already happening external to the timer: gb_loopback_async_operation(): ... op_async = kzalloc(sizeof(*op_async), GFP_KERNEL); ... INIT_WORK(_async->work, gb_loopback_async_operation_work); kref_init(_async->kref); ... op_async->pending = true; ... ret = gb_operation_request_send(operation, gb_loopback_async_operation_callback, 0, GFP_KERNEL); ... timer_setup(_async->timer, gb_loopback_async_operation_timeout, 0); op_async->timer.expires = jiffies + gb->jiffy_timeout; add_timer(_async->timer); gb_loopback_async_operation_callback(): (run by operation) ... op_async->pending = false; del_timer_sync(_async->timer); gb_loopback_async_operation_put(op_async); gb_loopback_async_operation_work(): (scheduled by timer) ... op_async->pending = false; gb_loopback_async_operation_put(op_async); (Doing a get/put in the timer callback itself shouldn't be happening: it must already be pinned in memory for the callback to run.) Both gb_loopback_async_operation_callback() and (gb_loopback_async_operation_timeout || gb_loopback_async_operation_work()) can run in parallel so the get in the timer callback means we can let the timer stuff free-run w/r to gb_loopback_async_operation_callback() - take a reference indicating we still want that object and then let gb_loopback_async_operation_work() run. --- bod ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: greybus: Convert timers to use timer_setup()
On Tue, Oct 24, 2017 at 5:52 AM, Bryan O'Donoghuewrote: > On 24/10/17 13:47, Kees Cook wrote: >> >> On Tue, Oct 24, 2017 at 2:40 AM, Bryan O'Donoghue >> wrote: >>> >>> On 24/10/17 10:35, Bryan O'Donoghue wrote: On 24/10/17 09:25, Kees Cook wrote: > > > In preparation for unconditionally passing the struct timer_list > pointer > to > all timer callbacks, switch to using the new timer_setup() and > from_timer() > to pass the timer pointer explicitly. > > Cc: Greg Kroah-Hartman > Cc: "Bryan O'Donoghue" > Cc: Johan Hovold > Cc: Alex Elder > Cc: greybus-...@lists.linaro.org > Cc: de...@driverdev.osuosl.org > Signed-off-by: Kees Cook > --- >drivers/staging/greybus/loopback.c | 14 -- >drivers/staging/greybus/operation.c | 7 +++ >2 files changed, 7 insertions(+), 14 deletions(-) > > diff --git a/drivers/staging/greybus/loopback.c > b/drivers/staging/greybus/loopback.c > index 08e255884206..045aaf81113a 100644 > --- a/drivers/staging/greybus/loopback.c > +++ b/drivers/staging/greybus/loopback.c > @@ -572,16 +572,11 @@ static void > gb_loopback_async_operation_work(struct > work_struct *work) >gb_loopback_async_operation_put(op_async); >} > -static void gb_loopback_async_operation_timeout(unsigned long data) > +static void gb_loopback_async_operation_timeout(struct timer_list *t) >{ > -struct gb_loopback_async_operation *op_async; > -u16 id = data; > +struct gb_loopback_async_operation *op_async = > +from_timer(op_async, t, timer); > -op_async = gb_loopback_operation_find(id); > -if (!op_async) { > -pr_err("operation %d not found - time out ?\n", id); > -return; > -} Hi Kees, you need to add gb_loopback_async_operation_get(op_async); when dropping the gb_loopback_operation_find() call here. >>> >>> >>> >>> Actually: >>> >>> spin_lock_irqsave(_dev.lock, flags); >>> gb_loopback_async_operation_get(op_async); >>> spin_unlock_irqrestore(_dev.lock, flags); >> >> Shouldn't the get/put follow the lifetime of the timer running >> instead? It shouldnt' be possible to free the op_async while the timer >> is still pending/running. > > The timeout timer runs for an operation that never completed but on the > regular "everything is good" path you end up doing > del_timer_sync(_async->timer); so the timer doesn't run. As far as I can tell, the get/put is already happening external to the timer: gb_loopback_async_operation(): ... op_async = kzalloc(sizeof(*op_async), GFP_KERNEL); ... INIT_WORK(_async->work, gb_loopback_async_operation_work); kref_init(_async->kref); ... op_async->pending = true; ... ret = gb_operation_request_send(operation, gb_loopback_async_operation_callback, 0, GFP_KERNEL); ... timer_setup(_async->timer, gb_loopback_async_operation_timeout, 0); op_async->timer.expires = jiffies + gb->jiffy_timeout; add_timer(_async->timer); gb_loopback_async_operation_callback(): (run by operation) ... op_async->pending = false; del_timer_sync(_async->timer); gb_loopback_async_operation_put(op_async); gb_loopback_async_operation_work(): (scheduled by timer) ... op_async->pending = false; gb_loopback_async_operation_put(op_async); (Doing a get/put in the timer callback itself shouldn't be happening: it must already be pinned in memory for the callback to run.) -Kees -- Kees Cook Pixel Security ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/2] uio: Prefer MSI(X) interrupts in PCI drivers
On Fri, 20 Oct 2017 14:50:44 +0200 "gre...@linuxfoundation.org"wrote: > On Fri, Oct 06, 2017 at 07:57:00AM -0700, Stephen Hemminger wrote: > > On Fri, 6 Oct 2017 13:50:44 + > > "Stahl, Manuel" wrote: > > > > > MSI(X) interrupts are not shared between devices. So when available > > > those should be preferred over legacy interrupts. > > > > > > Signed-off-by: Manuel Stahl > > > --- > > > drivers/uio/uio_pci_dmem_genirq.c | 27 --- > > > drivers/uio/uio_pci_generic.c | 24 ++-- > > > 2 files changed, 38 insertions(+), 13 deletions(-) > > > > The last time I tried to do MSI-X with pci-generic it got rejected > > by the maintainer. > > Hm, yeah, this would break users today that do not have msi-x, right? > > Not good, Manuel, how well did you test this? > > thanks, > > greg k-h Look at https://patchwork.kernel.org/patch/7303021/ The objection was more that UIO developers did not like that UIO was (already) being used for DMA without IOMMU, and MSI-x has DMA because of vector table. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: irda: resolve sparse errors due to implicit pci_power_t casts
* Greg KH[2017-10-18 16:12:16 +0200]: On Thu, Oct 05, 2017 at 04:38:23PM -0700, Matthew Giassa wrote: Explicitly casting pci_power_t types to resolve sparse warnings (shown below). Also fixing a related logging bug where pci_power_t is cast to unsigned (can be negative, i.e. PCI_POWER_ERROR). Original sparse report: drivers/staging/irda/drivers//vlsi_ir.c:170:51: warning: cast from restricted pci_power_t drivers/staging/irda/drivers//vlsi_ir.c:1726:39: warning: restricted pci_power_t degrades to integer drivers/staging/irda/drivers//vlsi_ir.c:1728:45: warning: incorrect type in assignment (different base types) drivers/staging/irda/drivers//vlsi_ir.c:1728:45:expected restricted pci_power_t [usertype] current_state drivers/staging/irda/drivers//vlsi_ir.c:1728:45:got int [signed] [usertype] event drivers/staging/irda/drivers//vlsi_ir.c:1748:29: warning: incorrect type in assignment (different base types) drivers/staging/irda/drivers//vlsi_ir.c:1748:29:expected restricted pci_power_t [usertype] current_state drivers/staging/irda/drivers//vlsi_ir.c:1748:29:got int [signed] [usertype] event Please do not line-wrap lines like this, it makes them harder to understand. Duly noted. Warnings no longer present. Signed-off-by: Matthew Giassa --- drivers/staging/irda/drivers/vlsi_ir.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/staging/irda/drivers/vlsi_ir.c b/drivers/staging/irda/drivers/vlsi_ir.c index 3dff3c5..20ce4d8 100644 --- a/drivers/staging/irda/drivers/vlsi_ir.c +++ b/drivers/staging/irda/drivers/vlsi_ir.c @@ -167,7 +167,8 @@ static void vlsi_proc_pdev(struct seq_file *seq, struct pci_dev *pdev) seq_printf(seq, "\n%s (vid/did: [%04x:%04x])\n", pci_name(pdev), (int)pdev->vendor, (int)pdev->device); - seq_printf(seq, "pci-power-state: %u\n", (unsigned) pdev->current_state); + seq_printf(seq, "pci-power-state: %d\n", + (int __force)pdev->current_state); Ick, using __force is almost always a huge sign that something is wrong here. This patch does not look correct because of this. You did read drivers/staging/irda/TODO, right? thanks, greg k-h Good point. This patch can be discarded. -Matthew ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: greybus: Convert timers to use timer_setup()
On 24/10/17 13:47, Kees Cook wrote: On Tue, Oct 24, 2017 at 2:40 AM, Bryan O'Donoghuewrote: On 24/10/17 10:35, Bryan O'Donoghue wrote: On 24/10/17 09:25, Kees Cook wrote: In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: Greg Kroah-Hartman Cc: "Bryan O'Donoghue" Cc: Johan Hovold Cc: Alex Elder Cc: greybus-...@lists.linaro.org Cc: de...@driverdev.osuosl.org Signed-off-by: Kees Cook --- drivers/staging/greybus/loopback.c | 14 -- drivers/staging/greybus/operation.c | 7 +++ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c index 08e255884206..045aaf81113a 100644 --- a/drivers/staging/greybus/loopback.c +++ b/drivers/staging/greybus/loopback.c @@ -572,16 +572,11 @@ static void gb_loopback_async_operation_work(struct work_struct *work) gb_loopback_async_operation_put(op_async); } -static void gb_loopback_async_operation_timeout(unsigned long data) +static void gb_loopback_async_operation_timeout(struct timer_list *t) { -struct gb_loopback_async_operation *op_async; -u16 id = data; +struct gb_loopback_async_operation *op_async = +from_timer(op_async, t, timer); -op_async = gb_loopback_operation_find(id); -if (!op_async) { -pr_err("operation %d not found - time out ?\n", id); -return; -} Hi Kees, you need to add gb_loopback_async_operation_get(op_async); when dropping the gb_loopback_operation_find() call here. Actually: spin_lock_irqsave(_dev.lock, flags); gb_loopback_async_operation_get(op_async); spin_unlock_irqrestore(_dev.lock, flags); Shouldn't the get/put follow the lifetime of the timer running instead? It shouldnt' be possible to free the op_async while the timer is still pending/running. -Kees The timeout timer runs for an operation that never completed but on the regular "everything is good" path you end up doing del_timer_sync(_async->timer); so the timer doesn't run. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: greybus: Convert timers to use timer_setup()
On Tue, Oct 24, 2017 at 2:40 AM, Bryan O'Donoghuewrote: > On 24/10/17 10:35, Bryan O'Donoghue wrote: >> >> On 24/10/17 09:25, Kees Cook wrote: >>> >>> In preparation for unconditionally passing the struct timer_list pointer >>> to >>> all timer callbacks, switch to using the new timer_setup() and >>> from_timer() >>> to pass the timer pointer explicitly. >>> >>> Cc: Greg Kroah-Hartman >>> Cc: "Bryan O'Donoghue" >>> Cc: Johan Hovold >>> Cc: Alex Elder >>> Cc: greybus-...@lists.linaro.org >>> Cc: de...@driverdev.osuosl.org >>> Signed-off-by: Kees Cook >>> --- >>> drivers/staging/greybus/loopback.c | 14 -- >>> drivers/staging/greybus/operation.c | 7 +++ >>> 2 files changed, 7 insertions(+), 14 deletions(-) >>> >>> diff --git a/drivers/staging/greybus/loopback.c >>> b/drivers/staging/greybus/loopback.c >>> index 08e255884206..045aaf81113a 100644 >>> --- a/drivers/staging/greybus/loopback.c >>> +++ b/drivers/staging/greybus/loopback.c >>> @@ -572,16 +572,11 @@ static void gb_loopback_async_operation_work(struct >>> work_struct *work) >>> gb_loopback_async_operation_put(op_async); >>> } >>> -static void gb_loopback_async_operation_timeout(unsigned long data) >>> +static void gb_loopback_async_operation_timeout(struct timer_list *t) >>> { >>> -struct gb_loopback_async_operation *op_async; >>> -u16 id = data; >>> +struct gb_loopback_async_operation *op_async = >>> +from_timer(op_async, t, timer); >>> -op_async = gb_loopback_operation_find(id); >>> -if (!op_async) { >>> -pr_err("operation %d not found - time out ?\n", id); >>> -return; >>> -} >> >> >> Hi Kees, you need to add >> >> gb_loopback_async_operation_get(op_async); when dropping the >> gb_loopback_operation_find() call here. > > > Actually: > > spin_lock_irqsave(_dev.lock, flags); > gb_loopback_async_operation_get(op_async); > spin_unlock_irqrestore(_dev.lock, flags); Shouldn't the get/put follow the lifetime of the timer running instead? It shouldnt' be possible to free the op_async while the timer is still pending/running. -Kees -- Kees Cook Pixel Security ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: greybus: Convert timers to use timer_setup()
Actually, on further reflection, I don't care. However you write it is fine. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: greybus: Convert timers to use timer_setup()
On Tue, Oct 24, 2017 at 01:25:50AM -0700, Kees Cook wrote: > In preparation for unconditionally passing the struct timer_list pointer to > all timer callbacks, switch to using the new timer_setup() and from_timer() > to pass the timer pointer explicitly. > > Cc: Greg Kroah-Hartman> Cc: "Bryan O'Donoghue" > Cc: Johan Hovold > Cc: Alex Elder > Cc: greybus-...@lists.linaro.org > Cc: de...@driverdev.osuosl.org > Signed-off-by: Kees Cook > --- > drivers/staging/greybus/loopback.c | 14 -- > drivers/staging/greybus/operation.c | 7 +++ > 2 files changed, 7 insertions(+), 14 deletions(-) > > diff --git a/drivers/staging/greybus/loopback.c > b/drivers/staging/greybus/loopback.c > index 08e255884206..045aaf81113a 100644 > --- a/drivers/staging/greybus/loopback.c > +++ b/drivers/staging/greybus/loopback.c > @@ -572,16 +572,11 @@ static void gb_loopback_async_operation_work(struct > work_struct *work) > gb_loopback_async_operation_put(op_async); > } > > -static void gb_loopback_async_operation_timeout(unsigned long data) > +static void gb_loopback_async_operation_timeout(struct timer_list *t) > { > - struct gb_loopback_async_operation *op_async; > - u16 id = data; > + struct gb_loopback_async_operation *op_async = > + from_timer(op_async, t, timer); > Since this one needs to be re-sent any way, could you do this instead of breaking up the line? struct gb_loopback_async_operation *op_async; op_async = from_timer(op_async, t, timer); regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: ccree: Fix lines longer than 80 characters
On Tue, Oct 24, 2017 at 08:44:31PM +1100, Tobin C. Harding wrote: > Removing from CC list: > > - de...@driverdev.osuosl.org (this is the old address, it forwards to > driverdev-devel@linuxdriverproject.org now I believe). Both work equally well, and are interchangable for odd historical reasons. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: ccree: Fix lines longer than 80 characters
Removing from CC list: - de...@driverdev.osuosl.org (this is the old address, it forwards to driverdev-devel@linuxdriverproject.org now I believe). - Linux Crypto Mailing List, should we be spamming these guys with checkpatch fixing discussions? Please do correct me if this is not the correct etiquette, I am still learning also. On Tue, Oct 24, 2017 at 11:49:41AM +0300, Gilad Ben-Yossef wrote: > Hi Tobin, > > On Tue, Oct 24, 2017 at 6:02 AM, Tobin C. Harding wrote: > > On Mon, Oct 23, 2017 at 07:53:18AM -0700, Stephen Brennan wrote: > >> Simply break down some long lines and tab-indent them. > > > > Hi Stephen, > > > > Welcome to the Linux kernel. Great that you have put in a patch, you are, > > however, unlikely to see > > success fixing 'line over 80' warnings. There are a bunch of arguments for > > and against the line over > > 80 limit, a web search will surely show them to you. The TL;DR is that it > > these changes do not > > _really_ improve the readability of the code, they are just changes to > > quiet the static analysis > > tool. > > I completely agree with you that the end target is more readable code > and that lines over 80 char is > only a symptom but I do think in this case there is something useful to do. > > Perhaps, if Stephen is willing, re-write the code to be more readable Oh, refactoring, that's a whole 'nother story. I'm a huge fan. And I agree with you that that is the correct way to deal with 'line over 80' warnings. For me, it helped to get a few _trivial_ checkpatch fixes in before I moved onto refactoring. 'line over 80' warnings are great to fix if viewed as an opportunity to refactor but not so great if viewed as a trivial white space fix to get started with. thanks, Tobin. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: greybus: Convert timers to use timer_setup()
On 24/10/17 09:25, Kees Cook wrote: In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: Greg Kroah-HartmanCc: "Bryan O'Donoghue" Cc: Johan Hovold Cc: Alex Elder Cc: greybus-...@lists.linaro.org Cc: de...@driverdev.osuosl.org Signed-off-by: Kees Cook --- drivers/staging/greybus/loopback.c | 14 -- drivers/staging/greybus/operation.c | 7 +++ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c index 08e255884206..045aaf81113a 100644 --- a/drivers/staging/greybus/loopback.c +++ b/drivers/staging/greybus/loopback.c @@ -572,16 +572,11 @@ static void gb_loopback_async_operation_work(struct work_struct *work) gb_loopback_async_operation_put(op_async); } -static void gb_loopback_async_operation_timeout(unsigned long data) +static void gb_loopback_async_operation_timeout(struct timer_list *t) { - struct gb_loopback_async_operation *op_async; - u16 id = data; + struct gb_loopback_async_operation *op_async = + from_timer(op_async, t, timer); - op_async = gb_loopback_operation_find(id); - if (!op_async) { - pr_err("operation %d not found - time out ?\n", id); - return; - } Hi Kees, you need to add gb_loopback_async_operation_get(op_async); when dropping the gb_loopback_operation_find() call here. schedule_work(_async->work); } @@ -631,8 +626,7 @@ static int gb_loopback_async_operation(struct gb_loopback *gb, int type, if (ret) goto error; - setup_timer(_async->timer, gb_loopback_async_operation_timeout, - (unsigned long)operation->id); + timer_setup(_async->timer, gb_loopback_async_operation_timeout, 0); op_async->timer.expires = jiffies + gb->jiffy_timeout; add_timer(_async->timer); diff --git a/drivers/staging/greybus/operation.c b/drivers/staging/greybus/operation.c index 3023012808d9..ee4ba3f23bef 100644 --- a/drivers/staging/greybus/operation.c +++ b/drivers/staging/greybus/operation.c @@ -294,9 +294,9 @@ static void gb_operation_work(struct work_struct *work) gb_operation_put(operation); } -static void gb_operation_timeout(unsigned long arg) +static void gb_operation_timeout(struct timer_list *t) { - struct gb_operation *operation = (void *)arg; + struct gb_operation *operation = from_timer(operation, t, timer); if (gb_operation_result_set(operation, -ETIMEDOUT)) { /* @@ -541,8 +541,7 @@ gb_operation_create_common(struct gb_connection *connection, u8 type, goto err_request; } - setup_timer(>timer, gb_operation_timeout, - (unsigned long)operation); + timer_setup(>timer, gb_operation_timeout, 0); } operation->flags = op_flags; Other than that, the rest looks good to me and you can add my Reviewed-by: Bryan O'Donoghue ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: greybus: Convert timers to use timer_setup()
On 24/10/17 10:35, Bryan O'Donoghue wrote: On 24/10/17 09:25, Kees Cook wrote: In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: Greg Kroah-HartmanCc: "Bryan O'Donoghue" Cc: Johan Hovold Cc: Alex Elder Cc: greybus-...@lists.linaro.org Cc: de...@driverdev.osuosl.org Signed-off-by: Kees Cook --- drivers/staging/greybus/loopback.c | 14 -- drivers/staging/greybus/operation.c | 7 +++ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c index 08e255884206..045aaf81113a 100644 --- a/drivers/staging/greybus/loopback.c +++ b/drivers/staging/greybus/loopback.c @@ -572,16 +572,11 @@ static void gb_loopback_async_operation_work(struct work_struct *work) gb_loopback_async_operation_put(op_async); } -static void gb_loopback_async_operation_timeout(unsigned long data) +static void gb_loopback_async_operation_timeout(struct timer_list *t) { -struct gb_loopback_async_operation *op_async; -u16 id = data; +struct gb_loopback_async_operation *op_async = +from_timer(op_async, t, timer); -op_async = gb_loopback_operation_find(id); -if (!op_async) { -pr_err("operation %d not found - time out ?\n", id); -return; -} Hi Kees, you need to add gb_loopback_async_operation_get(op_async); when dropping the gb_loopback_operation_find() call here. Actually: spin_lock_irqsave(_dev.lock, flags); gb_loopback_async_operation_get(op_async); spin_unlock_irqrestore(_dev.lock, flags); --- bod ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: ccree: Fix lines longer than 80 characters
Hi Tobin, On Tue, Oct 24, 2017 at 6:02 AM, Tobin C. Hardingwrote: > On Mon, Oct 23, 2017 at 07:53:18AM -0700, Stephen Brennan wrote: >> Simply break down some long lines and tab-indent them. > > Hi Stephen, > > Welcome to the Linux kernel. Great that you have put in a patch, you are, > however, unlikely to see > success fixing 'line over 80' warnings. There are a bunch of arguments for > and against the line over > 80 limit, a web search will surely show them to you. The TL;DR is that it > these changes do not > _really_ improve the readability of the code, they are just changes to quiet > the static analysis > tool. I completely agree with you that the end target is more readable code and that lines over 80 char is only a symptom but I do think in this case there is something useful to do. Perhaps, if Stephen is willing, re-write the code to be more readable by, for example, using a temp variable for the register address, and in doing so both making the code more readable as well as treating the symptom? Thanks, Gilad -- Gilad Ben-Yossef Chief Coffee Drinker "If you take a class in large-scale robotics, can you end up in a situation where the homework eats your dog?" -- Jean-Baptiste Queru ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 1/4] android: binder: Don't get mm from task
On Mon, Oct 23, 2017 at 11:18:52AM -0700, Arve Hjønnevåg wrote: > On Sat, Oct 21, 2017 at 1:15 AM, Greg Kroah-Hartman >wrote: > > On Fri, Oct 20, 2017 at 08:58:58PM -0400, Sherry Yang wrote: > >> Use binder_alloc struct's mm_struct rather than getting > >> a reference to the mm struct through get_task_mm to > >> avoid a potential deadlock between lru lock, task lock and > >> dentry lock, since a thread can be holding the task lock > >> and the dentry lock while trying to acquire the lru lock. > >> > >> Acked-by: Arve Hjønnevåg > >> Signed-off-by: Sherry Yang > >> --- > >> drivers/android/binder_alloc.c | 22 +- > >> drivers/android/binder_alloc.h | 1 - > >> 2 files changed, 9 insertions(+), 14 deletions(-) > > > > I've applied these first 2 patches, but patches 3 and 4 I have already > > applied to my char-misc-next tree, right? > > > > thanks, > > > > greg k-h > > I would expect you got a merge conflict from one of those. Using patch > 3 and 4 in from this patchset should avoid that conflict if your > eventual 4.15 branch is not based on your current char-misc-next > branch. I've resolved the merge conflict so my char-misc-next branch should be all caught up now. It would be wonderful if you could verify this. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rtl8723bs: Convert timers to use timer_setup()
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. This performs some refactoring to remove needless wrapper functions, and adds a pointer back to the desired adapter. Cc: Greg Kroah-HartmanCc: Shreeya Patel Cc: Hans de Goede Cc: Larry Finger Cc: Himanshu Jha Cc: Joe Perches Cc: Derek Robson Cc: Harsha Sharma Cc: Dan Carpenter Cc: "David S. Miller" Cc: Stephen Hemminger Cc: yuan linyu Cc: Johannes Berg Cc: de...@driverdev.osuosl.org Signed-off-by: Kees Cook --- drivers/staging/rtl8723bs/core/rtw_mlme.c | 10 +-- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 15 +++--- drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 23 +++ drivers/staging/rtl8723bs/core/rtw_recv.c | 15 ++ drivers/staging/rtl8723bs/include/osdep_service.h | 2 -- .../rtl8723bs/include/osdep_service_linux.h| 11 --- drivers/staging/rtl8723bs/include/rtw_mlme.h | 10 +++ drivers/staging/rtl8723bs/include/rtw_mlme_ext.h | 8 ++--- drivers/staging/rtl8723bs/include/rtw_pwrctrl.h| 1 + drivers/staging/rtl8723bs/include/rtw_recv.h | 2 +- drivers/staging/rtl8723bs/os_dep/mlme_linux.c | 34 -- drivers/staging/rtl8723bs/os_dep/osdep_service.c | 7 - drivers/staging/rtl8723bs/os_dep/recv_linux.c | 5 ++-- 13 files changed, 69 insertions(+), 74 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c index f9247a0a1539..fe739eb2cf7d 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c @@ -1814,8 +1814,10 @@ void rtw_wmm_event_callback(struct adapter *padapter, u8 *pbuf) * _rtw_join_timeout_handler - Timeout/failure handler for CMD JoinBss * @adapter: pointer to struct adapter structure */ -void _rtw_join_timeout_handler (struct adapter *adapter) +void _rtw_join_timeout_handler(struct timer_list *t) { + struct adapter *adapter = from_timer(adapter, t, + mlmepriv.assoc_timer); struct mlme_priv *pmlmepriv = >mlmepriv; DBG_871X("%s, fw_state =%x\n", __func__, get_fwstate(pmlmepriv)); @@ -1867,8 +1869,10 @@ void _rtw_join_timeout_handler (struct adapter *adapter) * rtw_scan_timeout_handler - Timeout/Failure handler for CMD SiteSurvey * @adapter: pointer to struct adapter structure */ -void rtw_scan_timeout_handler (struct adapter *adapter) +void rtw_scan_timeout_handler(struct timer_list *t) { + struct adapter *adapter = from_timer(adapter, t, + mlmepriv.scan_to_timer); struct mlme_priv *pmlmepriv = >mlmepriv; DBG_871X(FUNC_ADPT_FMT" fw_state =%x\n", FUNC_ADPT_ARG(adapter), get_fwstate(pmlmepriv)); @@ -1931,7 +1935,7 @@ static void rtw_auto_scan_handler(struct adapter *padapter) return; } -void rtw_dynamic_check_timer_handlder(struct adapter *adapter) +void rtw_dynamic_check_timer_handler(struct adapter *adapter) { if (!adapter) return; diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c index 480511524437..7d7756e40bcb 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c @@ -5830,8 +5830,10 @@ void linked_status_chk(struct adapter *padapter) } -void survey_timer_hdl(struct adapter *padapter) +void survey_timer_hdl(struct timer_list *t) { + struct adapter *padapter = + from_timer(padapter, t, mlmeextpriv.survey_timer); struct cmd_obj *ph2c; struct sitesurvey_parm *psurveyPara; struct cmd_priv *pcmdpriv = >cmdpriv; @@ -5877,8 +5879,10 @@ void survey_timer_hdl(struct adapter *padapter) return; } -void link_timer_hdl(struct adapter *padapter) +void link_timer_hdl(struct timer_list *t) { + struct adapter *padapter = + from_timer(padapter, t, mlmeextpriv.link_timer); /* static unsigned int rx_pkt = 0; */ /* static u64 tx_cnt = 0; */ /* struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); */ @@ -5927,8 +5931,9 @@ void link_timer_hdl(struct adapter *padapter) return; } -void addba_timer_hdl(struct sta_info *psta) +void addba_timer_hdl(struct timer_list *t) { + struct sta_info *psta = from_timer(psta, t, addba_retry_timer);
[PATCH] staging: vc04_services: Convert timers to use timer_setup()
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: Greg Kroah-HartmanCc: Eric Anholt Cc: Stefan Wahren Cc: Michael Zoran Cc: Keerthi Reddy Cc: linux-rpi-ker...@lists.infradead.org Cc: linux-arm-ker...@lists.infradead.org Cc: de...@driverdev.osuosl.org Signed-off-by: Kees Cook --- .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 13 +++-- .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.h | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c index 6fcc62603580..6d16cc036c0c 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c @@ -109,7 +109,7 @@ static const char *const resume_state_names[] = { * requested */ #define FORCE_SUSPEND_TIMEOUT_MS 200 -static void suspend_timer_callback(unsigned long context); +static void suspend_timer_callback(struct timer_list *t); typedef struct user_service_struct { VCHIQ_SERVICE_T *service; @@ -2184,8 +2184,9 @@ vchiq_arm_init_state(VCHIQ_STATE_T *state, VCHIQ_ARM_STATE_T *arm_state) arm_state->suspend_timer_timeout = SUSPEND_TIMER_TIMEOUT_MS; arm_state->suspend_timer_running = 0; - setup_timer(_state->suspend_timer, suspend_timer_callback, - (unsigned long)(state)); + arm_state->state = state; + timer_setup(_state->suspend_timer, suspend_timer_callback, + 0); arm_state->first_connect = 0; @@ -3017,10 +3018,10 @@ vchiq_instance_set_trace(VCHIQ_INSTANCE_T instance, int trace) instance->trace = (trace != 0); } -static void suspend_timer_callback(unsigned long context) +static void suspend_timer_callback(struct timer_list *t) { - VCHIQ_STATE_T *state = (VCHIQ_STATE_T *)context; - VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state); + VCHIQ_ARM_STATE_T *arm_state = from_timer(arm_state, t, suspend_timer); + VCHIQ_STATE_T *state = arm_state->state; if (!arm_state) goto out; diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h index a4cc0db899be..40bb0c63b1a9 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h @@ -83,6 +83,7 @@ typedef struct vchiq_arm_state_struct { unsigned int wake_address; + VCHIQ_STATE_T *state; struct timer_list suspend_timer; int suspend_timer_timeout; int suspend_timer_running; -- 2.7.4 -- Kees Cook Pixel Security ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: ks7010: Convert timers to use timer_setup()
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: Greg Kroah-HartmanCc: "Tobin C. Harding" Cc: de...@driverdev.osuosl.org Signed-off-by: Kees Cook --- drivers/staging/ks7010/ks_wlan_net.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c index b82b515a514f..880085e2f24a 100644 --- a/drivers/staging/ks7010/ks_wlan_net.c +++ b/drivers/staging/ks7010/ks_wlan_net.c @@ -114,7 +114,7 @@ int ks_wlan_update_phy_information(struct ks_wlan_private *priv) } static -void ks_wlan_update_phyinfo_timeout(unsigned long ptr) +void ks_wlan_update_phyinfo_timeout(struct timer_list *unused) { DPRINTK(4, "in_interrupt = %ld\n", in_interrupt()); atomic_set(_phyinfo, 0); @@ -2951,8 +2951,7 @@ int ks_wlan_net_start(struct net_device *dev) /* phy information update timer */ atomic_set(_phyinfo, 0); - setup_timer(_phyinfo_timer, ks_wlan_update_phyinfo_timeout, - (unsigned long)priv); + timer_setup(_phyinfo_timer, ks_wlan_update_phyinfo_timeout, 0); /* dummy address set */ memcpy(priv->eth_addr, dummy_addr, ETH_ALEN); -- 2.7.4 -- Kees Cook Pixel Security ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: greybus: Convert timers to use timer_setup()
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: Greg Kroah-HartmanCc: "Bryan O'Donoghue" Cc: Johan Hovold Cc: Alex Elder Cc: greybus-...@lists.linaro.org Cc: de...@driverdev.osuosl.org Signed-off-by: Kees Cook --- drivers/staging/greybus/loopback.c | 14 -- drivers/staging/greybus/operation.c | 7 +++ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c index 08e255884206..045aaf81113a 100644 --- a/drivers/staging/greybus/loopback.c +++ b/drivers/staging/greybus/loopback.c @@ -572,16 +572,11 @@ static void gb_loopback_async_operation_work(struct work_struct *work) gb_loopback_async_operation_put(op_async); } -static void gb_loopback_async_operation_timeout(unsigned long data) +static void gb_loopback_async_operation_timeout(struct timer_list *t) { - struct gb_loopback_async_operation *op_async; - u16 id = data; + struct gb_loopback_async_operation *op_async = + from_timer(op_async, t, timer); - op_async = gb_loopback_operation_find(id); - if (!op_async) { - pr_err("operation %d not found - time out ?\n", id); - return; - } schedule_work(_async->work); } @@ -631,8 +626,7 @@ static int gb_loopback_async_operation(struct gb_loopback *gb, int type, if (ret) goto error; - setup_timer(_async->timer, gb_loopback_async_operation_timeout, - (unsigned long)operation->id); + timer_setup(_async->timer, gb_loopback_async_operation_timeout, 0); op_async->timer.expires = jiffies + gb->jiffy_timeout; add_timer(_async->timer); diff --git a/drivers/staging/greybus/operation.c b/drivers/staging/greybus/operation.c index 3023012808d9..ee4ba3f23bef 100644 --- a/drivers/staging/greybus/operation.c +++ b/drivers/staging/greybus/operation.c @@ -294,9 +294,9 @@ static void gb_operation_work(struct work_struct *work) gb_operation_put(operation); } -static void gb_operation_timeout(unsigned long arg) +static void gb_operation_timeout(struct timer_list *t) { - struct gb_operation *operation = (void *)arg; + struct gb_operation *operation = from_timer(operation, t, timer); if (gb_operation_result_set(operation, -ETIMEDOUT)) { /* @@ -541,8 +541,7 @@ gb_operation_create_common(struct gb_connection *connection, u8 type, goto err_request; } - setup_timer(>timer, gb_operation_timeout, - (unsigned long)operation); + timer_setup(>timer, gb_operation_timeout, 0); } operation->flags = op_flags; -- 2.7.4 -- Kees Cook Pixel Security ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: atomisp: i2c: Convert timers to use timer_setup()
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Signed-off-by: Kees Cook--- drivers/staging/media/atomisp/i2c/lm3554.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/media/atomisp/i2c/lm3554.c b/drivers/staging/media/atomisp/i2c/lm3554.c index 679176f7c542..a815f208409f 100644 --- a/drivers/staging/media/atomisp/i2c/lm3554.c +++ b/drivers/staging/media/atomisp/i2c/lm3554.c @@ -171,10 +171,9 @@ static int lm3554_set_config1(struct lm3554 *flash) /* - * Hardware trigger */ -static void lm3554_flash_off_delay(long unsigned int arg) +static void lm3554_flash_off_delay(struct timer_list *t) { - struct v4l2_subdev *sd = i2c_get_clientdata((struct i2c_client *)arg); - struct lm3554 *flash = to_lm3554(sd); + struct lm3554 *flash = from_timer(flash, t, flash_off_delay); struct lm3554_platform_data *pdata = flash->pdata; gpio_set_value(pdata->gpio_strobe, 0); @@ -915,8 +914,7 @@ static int lm3554_probe(struct i2c_client *client, mutex_init(>power_lock); - setup_timer(>flash_off_delay, lm3554_flash_off_delay, - (unsigned long)client); + timer_setup(>flash_off_delay, lm3554_flash_off_delay, 0); err = lm3554_gpio_init(client); if (err) { -- 2.7.4 -- Kees Cook Pixel Security ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: VME: Remove PIO2 driver
The PIO2 device is (as far as I know) no longer manufactured. I no longer have access to the device and this seems unlikely to change. The only changes to this driver in a long time have been as a result of API changes else where. Time to remove it... Signed-off-by: Martyn Welch--- drivers/staging/vme/devices/Kconfig | 13 - drivers/staging/vme/devices/Makefile| 3 - drivers/staging/vme/devices/vme_pio2.h | 244 -- drivers/staging/vme/devices/vme_pio2_cntr.c | 71 drivers/staging/vme/devices/vme_pio2_core.c | 493 drivers/staging/vme/devices/vme_pio2_gpio.c | 220 - 6 files changed, 1044 deletions(-) delete mode 100644 drivers/staging/vme/devices/vme_pio2.h delete mode 100644 drivers/staging/vme/devices/vme_pio2_cntr.c delete mode 100644 drivers/staging/vme/devices/vme_pio2_core.c delete mode 100644 drivers/staging/vme/devices/vme_pio2_gpio.c diff --git a/drivers/staging/vme/devices/Kconfig b/drivers/staging/vme/devices/Kconfig index 1d2ff0cc41f1..c548dd8c91e1 100644 --- a/drivers/staging/vme/devices/Kconfig +++ b/drivers/staging/vme/devices/Kconfig @@ -10,16 +10,3 @@ config VME_USER To compile this driver as a module, choose M here. The module will be called vme_user. If unsure, say N. - -config VME_PIO2 - tristate "GE PIO2 VME" - depends on STAGING && GPIOLIB - help - Say Y here to include support for the GE PIO2. The PIO2 is a 6U VME - slave card, implementing 32 solid-state relay switched IO lines, in - 4 groups of 8. Each bank of IO lines is built to function as input, - output or both depending on the variant of the card. - - To compile this driver as a module, choose M here. The module will - be called vme_pio2. If unsure, say N. - diff --git a/drivers/staging/vme/devices/Makefile b/drivers/staging/vme/devices/Makefile index 172512cb5dbf..459742a75283 100644 --- a/drivers/staging/vme/devices/Makefile +++ b/drivers/staging/vme/devices/Makefile @@ -3,6 +3,3 @@ # obj-$(CONFIG_VME_USER) += vme_user.o - -vme_pio2-objs := vme_pio2_cntr.o vme_pio2_gpio.o vme_pio2_core.o -obj-$(CONFIG_VME_PIO2) += vme_pio2.o diff --git a/drivers/staging/vme/devices/vme_pio2.h b/drivers/staging/vme/devices/vme_pio2.h deleted file mode 100644 index ac4a4bad4091.. --- a/drivers/staging/vme/devices/vme_pio2.h +++ /dev/null @@ -1,244 +0,0 @@ -#ifndef _VME_PIO2_H_ -#define _VME_PIO2_H_ - -#define PIO2_CARDS_MAX 32 - -#define PIO2_VARIANT_LENGTH5 - -#define PIO2_NUM_CHANNELS 32 -#define PIO2_NUM_IRQS 11 -#define PIO2_NUM_CNTRS 6 - -#define PIO2_REGS_SIZE 0x40 - -#define PIO2_REGS_DATA00x0 -#define PIO2_REGS_DATA10x1 -#define PIO2_REGS_DATA20x2 -#define PIO2_REGS_DATA30x3 - -static const int PIO2_REGS_DATA[4] = { PIO2_REGS_DATA0, PIO2_REGS_DATA1, - PIO2_REGS_DATA2, PIO2_REGS_DATA3 }; - -#define PIO2_REGS_INT_STAT00x8 -#define PIO2_REGS_INT_STAT10x9 -#define PIO2_REGS_INT_STAT20xa -#define PIO2_REGS_INT_STAT30xb - -static const int PIO2_REGS_INT_STAT[4] = { PIO2_REGS_INT_STAT0, - PIO2_REGS_INT_STAT1, - PIO2_REGS_INT_STAT2, - PIO2_REGS_INT_STAT3 }; - -#define PIO2_REGS_INT_STAT_CNTR0xc -#define PIO2_REGS_INT_MASK00x10 -#define PIO2_REGS_INT_MASK10x11 -#define PIO2_REGS_INT_MASK20x12 -#define PIO2_REGS_INT_MASK30x13 -#define PIO2_REGS_INT_MASK40x14 -#define PIO2_REGS_INT_MASK50x15 -#define PIO2_REGS_INT_MASK60x16 -#define PIO2_REGS_INT_MASK70x17 - -static const int PIO2_REGS_INT_MASK[8] = { PIO2_REGS_INT_MASK0, - PIO2_REGS_INT_MASK1, - PIO2_REGS_INT_MASK2, - PIO2_REGS_INT_MASK3, - PIO2_REGS_INT_MASK4, - PIO2_REGS_INT_MASK5, - PIO2_REGS_INT_MASK6, - PIO2_REGS_INT_MASK7 }; - -#define PIO2_REGS_CTRL 0x18 -#define PIO2_REGS_VME_VECTOR 0x19 -#define PIO2_REGS_CNTR00x20 -#define PIO2_REGS_CNTR10x22 -#define PIO2_REGS_CNTR20x24 -#define PIO2_REGS_CTRL_WRD00x26 -#define PIO2_REGS_CNTR30x28 -#define PIO2_REGS_CNTR40x2a -#define PIO2_REGS_CNTR50x2c -#define
[PATCH] VME: Return -EBUSY when DMA list in use
From: Martyn WelchThe VME subsystem currently returns -EBUSY when trying to free a DMA resource that is busy, but returns -EINVAL when trying to free a DMA list that is in use. Switch to returning -EBUSY when trying to free a DMA list that is in use for consistency and correctness. Signed-off-by: Martyn Welch --- drivers/vme/vme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vme/vme.c b/drivers/vme/vme.c index d0ce50d56019..81246221a13b 100644 --- a/drivers/vme/vme.c +++ b/drivers/vme/vme.c @@ -1194,7 +1194,7 @@ int vme_dma_list_free(struct vme_dma_list *list) if (!mutex_trylock(>mtx)) { printk(KERN_ERR "Link List in use\n"); - return -EINVAL; + return -EBUSY; } /* -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel