From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH v2 18/41] arm: Introduce a generic way to use a device from acpi Date: Sun, 24 May 2015 08:40:17 +0100 Message-ID: <55618061.7080506@citrix.com> References: <1431893048-5214-1-git-send-email-parth.dixit@linaro.org> <1431893048-5214-19-git-send-email-parth.dixit@linaro.org> <555DBF5E.8050303@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Parth Dixit , Julien Grall Cc: keir@xen.org, Ian Campbell , andrew.cooper3@citrix.com, tim@xen.org, xen-devel , Stefano Stabellini , Jan Beulich , Christoffer Dall List-Id: xen-devel@lists.xenproject.org Hi Parth, On 24/05/2015 08:06, Parth Dixit wrote: > > +struct acpi_device_desc { > > + /* Device name */ > > + const char *name; > > + /* Device class */ > > + enum device_class class; > > + /* type of device supported by the driver */ > > + const int class_type; > > + /* Device initialization */ > > + int (*init)(const void *data); > > +}; > > Given that the number of device will be minimal in Xen, I would prefer > to merge this structure into device_desc by adding the ACPI fields. > > It would avoid to duplicate everything for only 2 fields changes. > > From the drivers point of view it would look like > > DEVICE_START(....) > .dt_init = ... > #ifdef CONFIG_ACPI > .acpi_init = ... > #endif > DEVICE_END > > Or something like > > DEVICE_START(...) > DT_INIT(...) > ACPI_INIT(...) > DEVICE_END > > And ACPI_INIT will be a no-op when CONFIG_ACPI is not enabled. > > I think we agreed not to use common structure as it had some dt specific > entries and there was scope of confusion. I don't remember a such agreement. So far, only compatible and init are DT specific. The rest (most of the fields) are device agnostic. If you prefix the DT callback by dt_ (or smth else), there would be confusion and a smaller code. Anyway, I will let Ian and Stefano gives their opinion on it. Regards, -- Julien Grall