Re: [PATCH 2/5] staging: fsl-mc: define a macro to differentiate root dprc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Oct 25, 2015 at 05:41:20PM -0500, Lijun Pan wrote:
> Define is_root_dprc(dev) to tell whether a device is
> root dprc or not via platform_bus_type.
> 
> Signed-off-by: Lijun Pan <Lijun.Pan@xxxxxxxxxxxxx>
> ---
>  drivers/staging/fsl-mc/include/mc.h | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/staging/fsl-mc/include/mc.h b/drivers/staging/fsl-mc/include/mc.h
> index a933291..483763e 100644
> --- a/drivers/staging/fsl-mc/include/mc.h
> +++ b/drivers/staging/fsl-mc/include/mc.h
> @@ -14,6 +14,7 @@
>  #include <linux/device.h>
>  #include <linux/mod_devicetable.h>
>  #include <linux/list.h>
> +#include <linux/platform_device.h>
>  #include "../include/dprc.h"
>  
>  #define FSL_MC_VENDOR_FREESCALE	0x1957
> @@ -109,6 +110,15 @@ struct fsl_mc_resource {
>  #define FSL_MC_IS_DPRC	0x0001
>  
>  /**
> +  * root dprc's parent is a platform device
> +  * that platform device's bus type is platform_bus_type.
> +  */
> +#define is_root_dprc(dev) \
> +	((to_fsl_mc_device(dev)->flags & FSL_MC_IS_DPRC) && \
> +	((dev)->bus == &fsl_mc_bus_type) && \
> +	((dev)->parent->bus == &platform_bus_type))
> +

It's best to make this type of thing a static inline function, to ensure
you get the correct typechecking.

thanks,

greg k-h
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux