Received: by 10.213.65.68 with SMTP id h4csp337002imn; Fri, 23 Mar 2018 05:51:17 -0700 (PDT) X-Google-Smtp-Source: AG47ELs1Dc+BHYeS4Qo0MqHJayT3WagXVlLzO5V8ue5yCF3JW8ft6bgzGIaJbyYNUlaCxMn1JXZz X-Received: by 2002:a17:902:24c7:: with SMTP id l7-v6mr26353077plg.320.1521809477167; Fri, 23 Mar 2018 05:51:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521809477; cv=none; d=google.com; s=arc-20160816; b=hbtHOYxd5QUVgP5oFpWaarVrIAvN6Gz4Q7tWSFiQPL31IGkk0rTAVDYg1pTyFT/Vgt hEXWiihfbcSX3DxXPx3i6r1hMvZOuRqjcqgt8lmNmmlmmh4fVEdHonNHgzgDmcpx/Kmk nHYKpCQgT+Zd3Xp1AhMLxhaUzkW7ghaJ7FNSmige9kG1JPURLHq5WUV40BUce8lR6M1C hXFQhYYFFw7L1KGjRXMfCUSY/0ypdeeDhF+mpaWzRuEQqgoJKQXzrchNjElxXaURJUSB 6ZkJ/B6FgBxhyQ0U01bAayMHTdd9c3QJUp+DsP93tcB5e+Ma13PEIO1rXp9jEHwfdSY/ 0RYQ== 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 :arc-authentication-results; bh=Xm0Uxm36Lz8XhVU86ztNSqYXBqHj1LnDMLEJPNaD98g=; b=hN4i3z2eTTBS2/L/gQeVz6vJiboIF6ri8AL9+L1/JCLiIjZ0vPn2bUY5xt6rswZZ7A fPL+eSBe1dT307h8LBvmJRTQIfoU3YWsUQ8Mj4aRkXUkXLEMR2m8H3QmpgvNwncuHrLN l1cQSL8WTI6/vwXotk2W4geY122CVtscPpngEkcnzX7SFcEfsPqwxPNcgADJBzvWaqtP m9sEfIsb+kdRNZgkgXr7DTuPWF9Tmu+S+jI63mh1st0M/2r5Qlmcd0uSJQtSndApt1Z1 Ifqg0r+3WOBfiSBROtWN0oMISyj4MoSp9an+LJsX159g2H0+QjES/RhRBu88Yjp71LNg poMg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3-v6si8386244plc.700.2018.03.23.05.51.03; Fri, 23 Mar 2018 05:51:17 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752405AbeCWMsy convert rfc822-to-8bit (ORCPT + 99 others); Fri, 23 Mar 2018 08:48:54 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:36918 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752009AbeCWMsx (ORCPT ); Fri, 23 Mar 2018 08:48:53 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id A38718C9D8C24; Fri, 23 Mar 2018 20:48:47 +0800 (CST) Received: from localhost (10.202.226.45) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 23 Mar 2018 20:48:46 +0800 Date: Fri, 23 Mar 2018 12:48:37 +0000 From: Jonathan Cameron To: =?ISO-8859-1?Q?Hern=E1n?= Gonzalez CC: , , , , , , Subject: Re: [PATCH 07/11] staging: iio: ad7746: Add remove() Message-ID: <20180323134837.00002ab0@huawei.com> In-Reply-To: <1521642539-4845-8-git-send-email-hernan@vanguardiasur.com.ar> References: <1521642539-4845-1-git-send-email-hernan@vanguardiasur.com.ar> <1521642539-4845-8-git-send-email-hernan@vanguardiasur.com.ar> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.31; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8BIT X-Originating-IP: [10.202.226.45] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 21 Mar 2018 11:28:55 -0300 Hern?n Gonzalez wrote: > This allows the driver to be probed and removed as a module. > > Signed-off-by: Hern?n Gonzalez > --- > drivers/staging/iio/cdc/ad7746.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/drivers/staging/iio/cdc/ad7746.c b/drivers/staging/iio/cdc/ad7746.c > index 815573c..8abba71 100644 > --- a/drivers/staging/iio/cdc/ad7746.c > +++ b/drivers/staging/iio/cdc/ad7746.c > @@ -768,6 +768,15 @@ static int ad7746_probe(struct i2c_client *client, > return 0; > } > > +static int ad7746_remove(struct i2c_client *client) > +{ > + struct iio_dev *indio_dev = i2c_get_clientdata(client); > + > + iio_device_unregister(indio_dev); Remove is not required to allow a driver to be removed.. It's required to clean up anything that needs cleaning up when the remove happens. If all you have is the device unregister then it should be possible to use. devm_iio_device_register and rely on managed cleanup to automatically call the unregister code for you. Hence there would be no need to have a remove function. Jonathan > + > + return 0; > +} > + > static const struct i2c_device_id ad7746_id[] = { > { "ad7745", 7745 }, > { "ad7746", 7746 }, > @@ -792,6 +801,7 @@ static struct i2c_driver ad7746_driver = { > .of_match_table = of_match_ptr(ad7746_of_match), > }, > .probe = ad7746_probe, > + .remove = ad7746_remove, > .id_table = ad7746_id, > }; > module_i2c_driver(ad7746_driver);