[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20140526053251.GC12890@core.coreip.homeip.net>
Date: Sun, 25 May 2014 22:32:51 -0700
From: Dmitry Torokhov <dmitry.torokhov@...il.com>
To: Himangi Saraogi <himangi774@...il.com>
Cc: linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
julia.lawall@...6.fr
Subject: Re: [PATCH] Input: mc13783-pwrbutton: Allocate resources using
managed interfaces
On Sun, May 25, 2014 at 03:44:01PM +0530, Himangi Saraogi wrote:
> This patch moves most data allocated in the probe function from
> unmanaged interfaces to managed interfaces. The kfrees and error
> handling code is done away with. The unnecesary labels are
> removed. Also, linux/device.h is added to make sure the devm_*()
> routine declarations are unambiguously available. The name of label
> free_priv is changed to unlock as it does not free priv anymore.
>
> The following Coccinelle semantic patch was used for making a part of
> the change:
>
> @platform@
> identifier p, probefn, removefn;
> @@
> struct platform_driver p = {
> .probe = probefn,
> .remove = removefn,
> };
>
> @prb@
> identifier platform.probefn, pdev;
> expression e, e1, e2;
> @@
> probefn(struct platform_device *pdev, ...) {
> <+...
> - e = kzalloc(e1, e2)
> + e = devm_kzalloc(&pdev->dev, e1, e2)
> ...
> ?-kfree(e);
> ...+>
> }
>
> @rem depends on prb@
> identifier platform.removefn;
> expression e;
> @@
> removefn(...) {
> <...
> - kfree(e);
> ...>
> }
>
> Signed-off-by: Himangi Saraogi <himangi774@...il.com>
> Acked-by: Julia Lawall <julia.lawall@...6.fr>
> ---
> Not compiled due to incompatible architecture.
>
> mc13xxx_irq_request is not devm'd, and doing so looks complicated due to
> the locks around the frees. Is there some way to resolve this issue?
Yes there us - let's leave the driver as is so we are not mixing the 2
styles.
Thanks.
--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists