Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp935424imm; Wed, 11 Jul 2018 13:47:23 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfELweID1jVnTPgLMwKtaeRhXRyeH/a3QhaNXWmvUQ+Z0453e6QKhohTVqls5SDyFy/WG2a X-Received: by 2002:a62:569c:: with SMTP id h28-v6mr158829pfj.201.1531342043029; Wed, 11 Jul 2018 13:47:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531342042; cv=none; d=google.com; s=arc-20160816; b=V/gnU0aO5qta0U9Bs9UJc+6LidPebr0wCG9xw0s0VD3IxOwsIkDrR9Jzm68oF0aFul f+FI6UxxoHtih4ygGTELogcl5wBdtPIR+1Zul9+f3ACfiZcR/U6GkpIzx7OBP4VnQSN6 PMhhloIQhtu5y14bGovGrAY9nilVlDXJ3I2d37rStDhR6NMJu4qo7UvXJSXjuJEWi+Vq vsu15spnOQ/cWMrRy/ozM5IwYz8BrppLK+sxCkniXUort84wNkkqDLIM2MACbDsbpyq3 fUET5th2C++1Kj9aGp5NQ+I8hTu4+WFb3vXrgvkfOt56j2hAG4o6RZ8HrVUVfiouj/c2 ALeA== 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=CkFYwh4jC6cyIABRXkqEJaXnF5cZpRBjlnuvTS+xuFE=; b=pmSswNPK7WfayCYTXi38G7JqTTKzWtp33VZodypWEaEFW6RSJ4OFkA+tHok0No511L cxeXxhBIjj0jLXtVEpHfdLg9RX10f0fwFT5B8VDnaOe//jn9vrVm6Y51Qw3/JyGD7Y1t JddUh9hz1ejw5LOjXK/sh9QrGMfLUWrDCWgn4aWpj+7UnR93bhbHBdUBkbCnltbRwWpu Z/hhck4vohfh9NNq5PGh1tDrZhD5fQmsoEw5XcxWGabsf6y0WEIcufQNEGA0yjZV5vjC 2alO15n3wZXGLfK02YPh6thzSiXWrijGq5K3teMqPKqN5Mxe6tARrkNC6vGwpk1tc3KA 6Iiw== 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 o81-v6si21956266pfj.350.2018.07.11.13.47.07; Wed, 11 Jul 2018 13:47:22 -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 S2388854AbeGKPII (ORCPT + 99 others); Wed, 11 Jul 2018 11:08:08 -0400 Received: from mail.bootlin.com ([62.4.15.54]:58260 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732605AbeGKPII (ORCPT ); Wed, 11 Jul 2018 11:08:08 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 8400F20766; Wed, 11 Jul 2018 17:03:21 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from bbrezillon (AAubervilliers-681-1-12-56.w90-88.abo.wanadoo.fr [90.88.133.56]) by mail.bootlin.com (Postfix) with ESMTPSA id DDDE52072C; Wed, 11 Jul 2018 17:03:20 +0200 (CEST) Date: Wed, 11 Jul 2018 17:03:20 +0200 From: Boris Brezillon To: Arnd Bergmann Cc: Wolfram Sang , linux-i2c@vger.kernel.org, Jonathan Corbet , "open list:DOCUMENTATION" , Greg Kroah-Hartman , Przemyslaw Sroka , Arkadiusz Golec , Alan Douglas , Bartosz Folta , Damian Kos , Alicja Jurasik-Urbaniak , Cyprian Wronka , Suresh Punnoose , Rafal Ciepiela , Thomas Petazzoni , Nishanth Menon , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , DTML , Linux Kernel Mailing List , Vitor Soares , Geert Uytterhoeven , Linus Walleij , Xiang Lin , linux-gpio@vger.kernel.org Subject: Re: [PATCH v4 01/10] i3c: Add core I3C infrastructure Message-ID: <20180711170320.5b2b0114@bbrezillon> In-Reply-To: <20180711164120.3e32fb08@bbrezillon> References: <20180330074751.25987-1-boris.brezillon@bootlin.com> <20180330074751.25987-2-boris.brezillon@bootlin.com> <20180711164120.3e32fb08@bbrezillon> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; 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 Wed, 11 Jul 2018 16:41:20 +0200 Boris Brezillon wrote: > > > +/** > > > + * i3cdev_to_dev() - Returns the device embedded in @i3cdev > > > + * @i3cdev: I3C device > > > + * > > > + * Return: a pointer to a device object. > > > + */ > > > +struct device *i3cdev_to_dev(struct i3c_device *i3cdev) > > > +{ > > > + return &i3cdev->dev; > > > +} > > > +EXPORT_SYMBOL_GPL(i3cdev_to_dev); > > > + > > > +/** > > > + * dev_to_i3cdev() - Returns the I3C device containing @dev > > > + * @dev: device object > > > + * > > > + * Return: a pointer to an I3C device object. > > > + */ > > > +struct i3c_device *dev_to_i3cdev(struct device *dev) > > > +{ > > > + return container_of(dev, struct i3c_device, dev); > > > +} > > > +EXPORT_SYMBOL_GPL(dev_to_i3cdev); > > > > Many other subsystems just make the device structure available > > to all client drivers so this can be an inline operation. Is there > > a strong reason to hide it here? > > No, but I think most subsystem do provide dev_to_xxxdev() at least > (to_platform_device() for instance) > My bad. I misunderstood you question. The main reason I did that was because I didn't want to expose i3c_device internals to the I3C device drivers. Anyway, this part will be reworked in my v6 to address one problem we had when re-attaching a pre-existing device that had lost its dynamic address and acquired a new one. Since we want that operation to be transparent to I3C device drivers, I had to decouple the I3C device driver representation from the I3C master controller one. I thus end up with struct i3C_dev_desc on the controller API side, and struct i3c_device on the driver side with a link between the 2 object that can be updated at runtime. And as you can imagine, i3c_device does not contain a lot of information now.