Re: [PATCH] parisc: Use signed char for hardware path in pdc.h

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

 



Am Freitag, 21. Oktober 2022, 09:20:38 CEST schrieb Helge Deller:
> Clean up the struct for hardware_path and drop the struct device_path
> with a proper assignment of bc[] and mod members as signed chars.
> 
> This patch prepares for the kbuild change from Jason A. Donenfeld to
> treat char as always unsigned.
> 
> Signed-off-by: Helge Deller <deller@xxxxxx>
> Cc: Jason A. Donenfeld <Jason@xxxxxxxxx>
> ---
>  arch/parisc/include/uapi/asm/pdc.h | 36 +++++++++++-------------------
>  drivers/parisc/pdc_stable.c        | 34 ++++++++++++++--------------
>  2 files changed, 30 insertions(+), 40 deletions(-)
> 
> diff --git a/arch/parisc/include/uapi/asm/pdc.h
> b/arch/parisc/include/uapi/asm/pdc.h index e794e143ec5f..7a90070136e8
> 100644
> --- a/arch/parisc/include/uapi/asm/pdc.h
> +++ b/arch/parisc/include/uapi/asm/pdc.h
> @@ -363,20 +363,25 @@
> 
>  #if !defined(__ASSEMBLY__)
> 
> -/* flags of the device_path */
> +/* flags for hardware_path */
>  #define	PF_AUTOBOOT	0x80
>  #define	PF_AUTOSEARCH	0x40
>  #define	PF_TIMER	0x0F
> 
> -struct device_path {		/* page 1-69 */
> -	unsigned char flags;	/* flags see above! */
> -	unsigned char bc[6];	/* bus converter routing info */
> -	unsigned char mod;
> -	unsigned int  layers[6];/* device-specific layer-info */
> -} __attribute__((aligned(8))) ;
> +struct hardware_path {
> +	unsigned char flags;	/* see bit definitions below */
> +	signed   char bc[6];	/* Bus Converter routing info to a specific */
> +				/* I/O adaptor (< 0 means none, > 63 resvd) */
> +	signed   char mod;	/* fixed field of specified module */
> +};
> +
> +struct pdc_module_path {	/* page 1-69 */
> +	struct hardware_path path;
> +	unsigned int layers[6]; /* device-specific info (ctlr #, unit # ...) */
> +} __attribute__((aligned(8)));
> 
>  struct pz_device {
> -	struct	device_path dp;	/* see above */
> +	struct pdc_module_path dp;	/* see above */
>  	/* struct	iomod *hpa; */
>  	unsigned int hpa;	/* HPA base address */
>  	/* char	*spa; */
> @@ -611,21 +616,6 @@ struct pdc_initiator { /* PDC_INITIATOR */
>  	int mode;
>  };
> 
> -struct hardware_path {
> -	char  flags;	/* see bit definitions below */
> -	char  bc[6];	/* Bus Converter routing info to a specific */
> -			/* I/O adaptor (< 0 means none, > 63 resvd) */
> -	char  mod;	/* fixed field of specified module */
> -};
> -
> -/*
> - * Device path specifications used by PDC.
> - */
> -struct pdc_module_path {
> -	struct hardware_path path;
> -	unsigned int layers[6]; /* device-specific info (ctlr #, unit # ...) */
> -};
> -
>  /* Only used on some pre-PA2.0 boxes */
>  struct pdc_memory_map {		/* PDC_MEMORY_MAP */
>  	unsigned long hpa;	/* mod's register set address */
> diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c
> index d9e51036a4fa..d6af5726ddf3 100644
> --- a/drivers/parisc/pdc_stable.c
> +++ b/drivers/parisc/pdc_stable.c
> @@ -88,7 +88,7 @@ struct pdcspath_entry {
>  	short ready;			/* entry record is valid if != 0 */
>  	unsigned long addr;		/* entry address in stable storage */
>  	char *name;			/* entry name */
> -	struct device_path devpath;	/* device path in parisc representation */
> +	struct pdc_module_path devpath;	/* device path in parisc representation */
> struct device *dev;		/* corresponding device */
>  	struct kobject kobj;
>  };
> @@ -138,7 +138,7 @@ struct pdcspath_attribute paths_attr_##_name = { \
>  static int
>  pdcspath_fetch(struct pdcspath_entry *entry)
>  {
> -	struct device_path *devpath;
> +	struct pdc_module_path *devpath;
> 
>  	if (!entry)
>  		return -EINVAL;
> @@ -153,7 +153,7 @@ pdcspath_fetch(struct pdcspath_entry *entry)
>  		return -EIO;
> 
>  	/* Find the matching device.
> -	   NOTE: hardware_path overlays with device_path, so the nice cast can
> +	   NOTE: hardware_path overlays with pdc_module_path, so the nice cast can
> be used */
>  	entry->dev = hwpath_to_device((struct hardware_path *)devpath);

Maybe just use &devpath->path instead and scrap the comment?

Regards,

Eike

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [Linux SoC]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux