From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=3.0 tests=BAYES_00,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABF42C4361B for ; Sun, 13 Dec 2020 17:46:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6A90F2333C for ; Sun, 13 Dec 2020 17:46:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725924AbgLMRqL (ORCPT ); Sun, 13 Dec 2020 12:46:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:49438 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725308AbgLMRqL (ORCPT ); Sun, 13 Dec 2020 12:46:11 -0500 Received: from archlinux (cpc108967-cmbg20-2-0-cust86.5-4.cable.virginm.net [81.101.6.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AC6C522BF5; Sun, 13 Dec 2020 17:45:29 +0000 (UTC) Date: Sun, 13 Dec 2020 17:45:26 +0000 From: Jonathan Cameron To: Alexandru Ardelean Cc: Gwendal Grignou , Lars-Peter Clausen , Andy Shevchenko , linux-iio Subject: Re: [PATCH v2 2/7] iio: fix devm_iio_trigger_alloc with parent.cocci Message-ID: <20201213174526.5d81c7bb@archlinux> In-Reply-To: References: <20201210204211.967018-1-gwendal@chromium.org> <20201210204211.967018-3-gwendal@chromium.org> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org On Fri, 11 Dec 2020 09:47:58 +0200 Alexandru Ardelean wrote: > On Thu, Dec 10, 2020 at 10:42 PM Gwendal Grignou wrote: > > > > Use cocci semantic patch: > > @@ > > expression trigger, P, name; > > @@ > > trigger = devm_iio_trigger_alloc(P, ...); > > ... > > - trigger->dev.parent = P; > > > > To remove trigger->dev.parent, since it is set by default. > > > > Reviewed-by: Alexandru Ardelean > > > Signed-off-by: Gwendal Grignou There's a bonus one in here :) Otherwise looks good. Jonathan > > diff --git a/drivers/iio/light/vcnl4035.c b/drivers/iio/light/vcnl4035.c > > index 765c44adac57..e732d308ac4e 100644 > > --- a/drivers/iio/light/vcnl4035.c > > +++ b/drivers/iio/light/vcnl4035.c > > @@ -511,7 +511,6 @@ static int vcnl4035_probe_trigger(struct iio_dev *indio_dev) > > if (!data->drdy_trigger0) > > return -ENOMEM; > > > > - data->drdy_trigger0->dev.parent = indio_dev->dev.parent; > > data->drdy_trigger0->ops = &vcnl4035_trigger_ops; > > iio_trigger_set_drvdata(data->drdy_trigger0, indio_dev); > > ret = devm_iio_trigger_register(indio_dev->dev.parent, This one is a bit obscured by the code. I wonder it it would be sensible to just pass the client->dev directly into vcnl4035_probe_trigger rather than somewhat making us guess where it goes. Unrelated to your patch though. > > diff --git a/drivers/iio/proximity/sx932x.c b/drivers/iio/proximity/sx932x.c > > index 26503348ce85..95ad49e627c6 100644 > > --- a/drivers/iio/proximity/sx932x.c > > +++ b/drivers/iio/proximity/sx932x.c > > @@ -1336,7 +1336,6 @@ static int sx932x_probe(struct i2c_client *client, > > if (!data->trig) > > return -ENOMEM; > > > > - data->trig->dev.parent = &client->dev; > > data->trig->ops = &sx932x_trigger_ops; > > iio_trigger_set_drvdata(data->trig, indio_dev); There is no such driver in mainline yet. I had the sudden horror that I'd let another wild card name in without noticing and checked :) We had a v1 of the patch, but currently waiting for v2. Jonathan > > > > -- > > 2.29.2.576.ga3fc446d84-goog > >