From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH v3 06/13] xen/arm: Introduce a generic way to describe device Date: Tue, 24 Feb 2015 14:26:18 +0000 Message-ID: <54EC8A0A.6000101@linaro.org> References: <1422643768-23614-1-git-send-email-julien.grall@linaro.org> <1422643768-23614-7-git-send-email-julien.grall@linaro.org> <1424434952.30924.201.camel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YQGRp-0001UG-BM for xen-devel@lists.xenproject.org; Tue, 24 Feb 2015 14:26:53 +0000 Received: by mail-wi0-f172.google.com with SMTP id l15so25838296wiw.5 for ; Tue, 24 Feb 2015 06:26:48 -0800 (PST) In-Reply-To: <1424434952.30924.201.camel@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: Keir Fraser , Andrew Cooper , tim@xen.org, stefano.stabellini@citrix.com, Jan Beulich , xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org Hi Ian, On 20/02/15 12:22, Ian Campbell wrote: > On Fri, 2015-01-30 at 18:49 +0000, Julien Grall wrote: >> @@ -2,8 +2,34 @@ >> #define __ASM_ARM_DEVICE_H >> >> #include >> + >> +enum device_type >> +{ >> + DEV_DT, > > I suppose no #ifdef here because an empty enum is a bit silly? this code is ARM-specific and device tree is always supported for this architecture. >> >> +/* TODO: Correctly implement dev_is_pci when PCI will be supported on ARM */ > > s/will be/is/ > >> +#define dev_is_pci(dev) ((void)(dev), 0) >> +#define dev_is_dt(dev) ((dev->type == DEV_DT) >> + >> enum device_class >> { >> DEVICE_SERIAL, >> diff --git a/xen/include/asm-x86/device.h b/xen/include/asm-x86/device.h >> new file mode 100644 >> index 0000000..a016112 >> --- /dev/null >> +++ b/xen/include/asm-x86/device.h >> @@ -0,0 +1,25 @@ >> +#ifndef __ASM_X86_DEVICE_H >> +#define __ASM_X86_DEVICE_H >> + >> +#include >> + >> +/* >> + * x86 is only supported PCI. Therefore it's possible to directly use > > "x86 is only supporting PCI" or (better) "x86 only supports PCI". > >> +#define dt_to_dev(dt_node) (&(dt_node)->dev) >> + >> +static inline struct dt_device_node *dev_to_dt(struct device *dev) >> +{ >> + ASSERT(dev->type == DEV_DT); >> + >> + return container_of(dev, struct dt_device_node, dev); >> +} > > Given that x86 uses a difference struct and doesn't support DT shouldn't > this either be wrapped in a HAVE_DEVICE_TREE or placed in the ARM header > (or some other common-to-all-dt-platforms header)? That would be a mistake to include on x86. Currently all the #include to this header are protected with #ifdef HAVE_DEVICE_TREE. Regards, -- Julien Grall