Skip to content

Commit 50f1969

Browse files
committed
parisc: Use signed char for hardware path in pdc.h
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 <[email protected]> Cc: Jason A. Donenfeld <[email protected]>
1 parent 9e4e2ce commit 50f1969

File tree

2 files changed

+30
-40
lines changed

2 files changed

+30
-40
lines changed

arch/parisc/include/uapi/asm/pdc.h

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -363,20 +363,25 @@
363363

364364
#if !defined(__ASSEMBLY__)
365365

366-
/* flags of the device_path */
366+
/* flags for hardware_path */
367367
#define PF_AUTOBOOT 0x80
368368
#define PF_AUTOSEARCH 0x40
369369
#define PF_TIMER 0x0F
370370

371-
struct device_path { /* page 1-69 */
372-
unsigned char flags; /* flags see above! */
373-
unsigned char bc[6]; /* bus converter routing info */
374-
unsigned char mod;
375-
unsigned int layers[6];/* device-specific layer-info */
376-
} __attribute__((aligned(8))) ;
371+
struct hardware_path {
372+
unsigned char flags; /* see bit definitions below */
373+
signed char bc[6]; /* Bus Converter routing info to a specific */
374+
/* I/O adaptor (< 0 means none, > 63 resvd) */
375+
signed char mod; /* fixed field of specified module */
376+
};
377+
378+
struct pdc_module_path { /* page 1-69 */
379+
struct hardware_path path;
380+
unsigned int layers[6]; /* device-specific info (ctlr #, unit # ...) */
381+
} __attribute__((aligned(8)));
377382

378383
struct pz_device {
379-
struct device_path dp; /* see above */
384+
struct pdc_module_path dp; /* see above */
380385
/* struct iomod *hpa; */
381386
unsigned int hpa; /* HPA base address */
382387
/* char *spa; */
@@ -611,21 +616,6 @@ struct pdc_initiator { /* PDC_INITIATOR */
611616
int mode;
612617
};
613618

614-
struct hardware_path {
615-
char flags; /* see bit definitions below */
616-
char bc[6]; /* Bus Converter routing info to a specific */
617-
/* I/O adaptor (< 0 means none, > 63 resvd) */
618-
char mod; /* fixed field of specified module */
619-
};
620-
621-
/*
622-
* Device path specifications used by PDC.
623-
*/
624-
struct pdc_module_path {
625-
struct hardware_path path;
626-
unsigned int layers[6]; /* device-specific info (ctlr #, unit # ...) */
627-
};
628-
629619
/* Only used on some pre-PA2.0 boxes */
630620
struct pdc_memory_map { /* PDC_MEMORY_MAP */
631621
unsigned long hpa; /* mod's register set address */

drivers/parisc/pdc_stable.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* all) PA-RISC machines should have them. Anyway, for safety reasons, the
1515
* following code can deal with just 96 bytes of Stable Storage, and all
1616
* sizes between 96 and 192 bytes (provided they are multiple of struct
17-
* device_path size, eg: 128, 160 and 192) to provide full information.
17+
* pdc_module_path size, eg: 128, 160 and 192) to provide full information.
1818
* One last word: there's one path we can always count on: the primary path.
1919
* Anything above 224 bytes is used for 'osdep2' OS-dependent storage area.
2020
*
@@ -88,7 +88,7 @@ struct pdcspath_entry {
8888
short ready; /* entry record is valid if != 0 */
8989
unsigned long addr; /* entry address in stable storage */
9090
char *name; /* entry name */
91-
struct device_path devpath; /* device path in parisc representation */
91+
struct pdc_module_path devpath; /* device path in parisc representation */
9292
struct device *dev; /* corresponding device */
9393
struct kobject kobj;
9494
};
@@ -138,7 +138,7 @@ struct pdcspath_attribute paths_attr_##_name = { \
138138
static int
139139
pdcspath_fetch(struct pdcspath_entry *entry)
140140
{
141-
struct device_path *devpath;
141+
struct pdc_module_path *devpath;
142142

143143
if (!entry)
144144
return -EINVAL;
@@ -153,7 +153,7 @@ pdcspath_fetch(struct pdcspath_entry *entry)
153153
return -EIO;
154154

155155
/* Find the matching device.
156-
NOTE: hardware_path overlays with device_path, so the nice cast can
156+
NOTE: hardware_path overlays with pdc_module_path, so the nice cast can
157157
be used */
158158
entry->dev = hwpath_to_device((struct hardware_path *)devpath);
159159

@@ -179,7 +179,7 @@ pdcspath_fetch(struct pdcspath_entry *entry)
179179
static void
180180
pdcspath_store(struct pdcspath_entry *entry)
181181
{
182-
struct device_path *devpath;
182+
struct pdc_module_path *devpath;
183183

184184
BUG_ON(!entry);
185185

@@ -221,7 +221,7 @@ static ssize_t
221221
pdcspath_hwpath_read(struct pdcspath_entry *entry, char *buf)
222222
{
223223
char *out = buf;
224-
struct device_path *devpath;
224+
struct pdc_module_path *devpath;
225225
short i;
226226

227227
if (!entry || !buf)
@@ -236,11 +236,11 @@ pdcspath_hwpath_read(struct pdcspath_entry *entry, char *buf)
236236
return -ENODATA;
237237

238238
for (i = 0; i < 6; i++) {
239-
if (devpath->bc[i] >= 128)
239+
if (devpath->path.bc[i] < 0)
240240
continue;
241-
out += sprintf(out, "%u/", (unsigned char)devpath->bc[i]);
241+
out += sprintf(out, "%d/", devpath->path.bc[i]);
242242
}
243-
out += sprintf(out, "%u\n", (unsigned char)devpath->mod);
243+
out += sprintf(out, "%u\n", (unsigned char)devpath->path.mod);
244244

245245
return out - buf;
246246
}
@@ -296,12 +296,12 @@ pdcspath_hwpath_write(struct pdcspath_entry *entry, const char *buf, size_t coun
296296
for (i=5; ((temp = strrchr(in, '/'))) && (temp-in > 0) && (likely(i)); i--) {
297297
hwpath.bc[i] = simple_strtoul(temp+1, NULL, 10);
298298
in[temp-in] = '\0';
299-
DPRINTK("%s: bc[%d]: %d\n", __func__, i, hwpath.bc[i]);
299+
DPRINTK("%s: bc[%d]: %d\n", __func__, i, hwpath.path.bc[i]);
300300
}
301301

302302
/* Store the final field */
303303
hwpath.bc[i] = simple_strtoul(in, NULL, 10);
304-
DPRINTK("%s: bc[%d]: %d\n", __func__, i, hwpath.bc[i]);
304+
DPRINTK("%s: bc[%d]: %d\n", __func__, i, hwpath.path.bc[i]);
305305

306306
/* Now we check that the user isn't trying to lure us */
307307
if (!(dev = hwpath_to_device((struct hardware_path *)&hwpath))) {
@@ -342,7 +342,7 @@ static ssize_t
342342
pdcspath_layer_read(struct pdcspath_entry *entry, char *buf)
343343
{
344344
char *out = buf;
345-
struct device_path *devpath;
345+
struct pdc_module_path *devpath;
346346
short i;
347347

348348
if (!entry || !buf)
@@ -547,7 +547,7 @@ static ssize_t pdcs_auto_read(struct kobject *kobj,
547547
pathentry = &pdcspath_entry_primary;
548548

549549
read_lock(&pathentry->rw_lock);
550-
out += sprintf(out, "%s\n", (pathentry->devpath.flags & knob) ?
550+
out += sprintf(out, "%s\n", (pathentry->devpath.path.flags & knob) ?
551551
"On" : "Off");
552552
read_unlock(&pathentry->rw_lock);
553553

@@ -594,8 +594,8 @@ static ssize_t pdcs_timer_read(struct kobject *kobj,
594594

595595
/* print the timer value in seconds */
596596
read_lock(&pathentry->rw_lock);
597-
out += sprintf(out, "%u\n", (pathentry->devpath.flags & PF_TIMER) ?
598-
(1 << (pathentry->devpath.flags & PF_TIMER)) : 0);
597+
out += sprintf(out, "%u\n", (pathentry->devpath.path.flags & PF_TIMER) ?
598+
(1 << (pathentry->devpath.path.flags & PF_TIMER)) : 0);
599599
read_unlock(&pathentry->rw_lock);
600600

601601
return out - buf;
@@ -764,7 +764,7 @@ static ssize_t pdcs_auto_write(struct kobject *kobj,
764764

765765
/* Be nice to the existing flag record */
766766
read_lock(&pathentry->rw_lock);
767-
flags = pathentry->devpath.flags;
767+
flags = pathentry->devpath.path.flags;
768768
read_unlock(&pathentry->rw_lock);
769769

770770
DPRINTK("%s: flags before: 0x%X\n", __func__, flags);
@@ -785,7 +785,7 @@ static ssize_t pdcs_auto_write(struct kobject *kobj,
785785
write_lock(&pathentry->rw_lock);
786786

787787
/* Change the path entry flags first */
788-
pathentry->devpath.flags = flags;
788+
pathentry->devpath.path.flags = flags;
789789

790790
/* Now, dive in. Write back to the hardware */
791791
pdcspath_store(pathentry);

0 commit comments

Comments
 (0)