Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751531AbcDRE41 (ORCPT ); Mon, 18 Apr 2016 00:56:27 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:33558 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751028AbcDRE4Z (ORCPT ); Mon, 18 Apr 2016 00:56:25 -0400 Date: Sun, 17 Apr 2016 21:56:22 -0700 From: Alison Schofield To: "Andrew F. Davis" Cc: Jonathan Cameron , knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, kgene@kernel.org, k.kozlowski@samsung.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 4/5] iio: health: afe4404: use regmap to retrieve struct device Message-ID: <20160418045621.GA2835@d830.WORKGROUP> References: <2dd23e55fa7c2d16c577146eefd4a84046d2b838.1460314070.git.amsfield22@gmail.com> <57129101.7000503@kernel.org> <5713D0F8.20303@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5713D0F8.20303@ti.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1182 Lines: 30 On Sun, Apr 17, 2016 at 01:07:52PM -0500, Andrew F. Davis wrote: > On 04/16/2016 02:22 PM, Jonathan Cameron wrote: > > On 10/04/16 20:07, Alison Schofield wrote: > >> Driver includes struct regmap and struct device in its global data. > >> Remove the struct device and use regmap API to retrieve device info. > >> > > Why? This adds nothing but more code to get dev through some > container_of trickery when we could just keep a dev pointer in the data > structure. > > Andrew Thanks for the review and response. The why would be for simplification and uniformity across IIO. I think I see your point in general, but not sure I get your specific concerns with these afe4403/04 drivers. The drivers only use the device struct in probe and then again at device remove time. At probe, the change no longer stores it in the global data. At remove the regmap_get_device() func is a simple dereference to retrieve the device struct. That's the simplification: we don't carry that ptr in global data waiting for the opportunity to use it at device remove. We just find it when we need it at device remove. (Perhaps these devices are getting removed frequently?) Regards, alisons