Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1216514ybi; Sat, 27 Jul 2019 05:05:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqwlKrFGTggGYzY2uGcmULeguZAlQNXkwIaGWHZhwQLgwGHKkv3qxapcpq3L1lkZIB8eKfUw X-Received: by 2002:a17:902:e306:: with SMTP id cg6mr101124120plb.263.1564229126756; Sat, 27 Jul 2019 05:05:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564229126; cv=none; d=google.com; s=arc-20160816; b=zSCZ+H26DvsNGaWU/+WvTiXXGgX6lLKiblu1Z3KwuHPhC6owy1KUqfQ7XqbXoL1+aU GBo5DOUrfTOuO5I3IsYALMv6otGgUgswTwuowAWeY8xquLU/ax4hTiDVPSF3lKgcZ7AK 314/FWGCgUcDNscBJL7HSbuaoGFot/VAsoUlgDMAgBiYm0bTUqHygl5y5QrcFuhc/FU+ 62oIjKQT0mcic25THHdFZ0/6zG43tENXxTD22Cok4AIG3k1rnu3xkMi4D+x8DlBn5Fn7 GXKQCmrzfXnsC+25Dbxd1kPVdX41CW19HRsXKuy4At5jiwjepAM3TE9NNasXd7oE6K2h RRvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=U6yXWJAuu9fKOShvDw5FI8ymL7WeEj6RBgXQ0esdIP8=; b=Ec445qZ40z3BMDQ2PrU40mH0P+kHaekwP7fX6Kv7HdPwvAqCjcuTuB/C3bQIrrPEcb ZpWOXgJuq6p2huXhB4bFD8mqHbNlfFoPK7UnHbijsPT89bzqdOXU+A6q4gL5nbsp91kz jrxSRh1iL0tMvJiA61R5RsaCHNKGqR8g+QezF3JEaojFDS2te0jnQNIW8YHgEvnAEA3n TqYskaQtaVg5FSt8jACStbnFzjCk3Qy9J7xQowkUkx2bSyLg/RERouXJzOwiqRwRSARX Z6MmlYuQ9hWDl5BlIHEVe392Dfw3BC/UpuBoHj83VvQY1SFZD3rZ2t4msCAcNJ+b0jRJ EnLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="v/HEhMy0"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f25si46535439pgv.292.2019.07.27.05.05.10; Sat, 27 Jul 2019 05:05:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="v/HEhMy0"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728839AbfG0L5y (ORCPT + 99 others); Sat, 27 Jul 2019 07:57:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:52804 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725975AbfG0L5y (ORCPT ); Sat, 27 Jul 2019 07:57:54 -0400 Received: from archlinux (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (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 A3D5A2077C; Sat, 27 Jul 2019 11:57:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564228673; bh=Qt1Rf8kXzBIqNTkx2KISu/ts1iMKogFu67lTKS8akwI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=v/HEhMy0bQOo4vFVcF94DEwwyVIWHx7+pCMkhVSsEY3OVeC7TUfFW103L3KbvqJcq VH7Za++mrEkiLmJgYnQmayvu3G2mS8ZXy5dlfL/mFHkeyodeVaG989Xpg1V39kKTNS guPhMWIvdhu0M9ba8dA+QI6Yij3H8KPpAqd+Zdv0= Date: Sat, 27 Jul 2019 12:57:49 +0100 From: Jonathan Cameron To: Chuhong Yuan Cc: Brian Masney , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] iio: tsl2772: Use device-managed API Message-ID: <20190727125749.63297c28@archlinux> In-Reply-To: <20190726123058.22915-1-hslester96@gmail.com> References: <20190726123058.22915-1-hslester96@gmail.com> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 26 Jul 2019 20:30:58 +0800 Chuhong Yuan wrote: > Use devm_iio_device_register to simplify > the code. > > Signed-off-by: Chuhong Yuan Please try to pick up on likely reviewers in your cc list. In this case Brian did a lot of work cleaning these drivers up so I've added him. Not everyone keeps up with the linux-iio list for some reason ;) Immediate thought was that you had broken the ordering but turns out it is already buggy. As things stand, we remove the userspace interfaces (iio_device_unregister) after turning off the power. This is obviously a bad idea and also form a purely "obviously correct" stand point, we aren't doing the reverse of probe. So, I 'think' the right option is to reorder remove so that the power left on until after the iio_device_unregister call. At that point, we can't use devm_iio_device_register as we'll have the same incorrect ordering we currently have. Brian, you looked at this driver most recently. Thoughts? Thanks, Jonathan > --- > drivers/iio/light/tsl2772.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/iio/light/tsl2772.c b/drivers/iio/light/tsl2772.c > index 83cece921843..aa5891d105e8 100644 > --- a/drivers/iio/light/tsl2772.c > +++ b/drivers/iio/light/tsl2772.c > @@ -1877,7 +1877,7 @@ static int tsl2772_probe(struct i2c_client *clientp, > if (ret < 0) > return ret; > > - ret = iio_device_register(indio_dev); > + ret = devm_iio_device_register(&clientp->dev, indio_dev); > if (ret) { > tsl2772_chip_off(indio_dev); > dev_err(&clientp->dev, > @@ -1928,8 +1928,6 @@ static int tsl2772_remove(struct i2c_client *client) > > tsl2772_chip_off(indio_dev); > > - iio_device_unregister(indio_dev); > - > return 0; > } >