From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dmitry Torokhov Subject: Re: [PATCH] Input: mc13783-pwrbutton: Allocate resources using managed interfaces Date: Sun, 25 May 2014 22:32:51 -0700 Message-ID: <20140526053251.GC12890@core.coreip.homeip.net> References: <20140525101400.GA19075@himangi-Dell> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mail-pb0-f52.google.com ([209.85.160.52]:45402 "EHLO mail-pb0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751224AbaEZFcy (ORCPT ); Mon, 26 May 2014 01:32:54 -0400 Content-Disposition: inline In-Reply-To: <20140525101400.GA19075@himangi-Dell> Sender: linux-input-owner@vger.kernel.org List-Id: linux-input@vger.kernel.org To: Himangi Saraogi Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, julia.lawall@lip6.fr 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 > Acked-by: Julia Lawall > --- > 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