Skip to content

Commit 6a23acf

Browse files
sfrothwellDavid S. Miller
authored andcommitted
[SPARC64]: constify of_get_property return: arch/sparc64
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 8271f04 commit 6a23acf

11 files changed

Lines changed: 46 additions & 43 deletions

File tree

‎arch/sparc64/kernel/central.c‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ static void central_probe_failure(int line)
3232
static void central_ranges_init(struct linux_central *central)
3333
{
3434
struct device_node *dp = central->prom_node;
35-
void *pval;
35+
const void *pval;
3636
int len;
3737

3838
central->num_central_ranges = 0;
@@ -47,7 +47,7 @@ static void central_ranges_init(struct linux_central *central)
4747
static void fhc_ranges_init(struct linux_fhc *fhc)
4848
{
4949
struct device_node *dp = fhc->prom_node;
50-
void *pval;
50+
const void *pval;
5151
int len;
5252

5353
fhc->num_fhc_ranges = 0;
@@ -119,7 +119,7 @@ static unsigned long prom_reg_to_paddr(struct linux_prom_registers *r)
119119
static void probe_other_fhcs(void)
120120
{
121121
struct device_node *dp;
122-
struct linux_prom64_registers *fpregs;
122+
const struct linux_prom64_registers *fpregs;
123123

124124
for_each_node_by_name(dp, "fhc") {
125125
struct linux_fhc *fhc;
@@ -190,7 +190,8 @@ static void probe_clock_board(struct linux_central *central,
190190
struct device_node *fp)
191191
{
192192
struct device_node *dp;
193-
struct linux_prom_registers cregs[3], *pr;
193+
struct linux_prom_registers cregs[3];
194+
const struct linux_prom_registers *pr;
194195
int nslots, tmp, nregs;
195196

196197
dp = fp->child;
@@ -299,7 +300,8 @@ static void init_all_fhc_hw(void)
299300

300301
void central_probe(void)
301302
{
302-
struct linux_prom_registers fpregs[6], *pr;
303+
struct linux_prom_registers fpregs[6];
304+
const struct linux_prom_registers *pr;
303305
struct linux_fhc *fhc;
304306
struct device_node *dp, *fp;
305307
int err;

‎arch/sparc64/kernel/chmc.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,8 @@ static int init_one_mctrl(struct device_node *dp)
343343
{
344344
struct mctrl_info *mp = kzalloc(sizeof(*mp), GFP_KERNEL);
345345
int portid = of_getintprop_default(dp, "portid", -1);
346-
struct linux_prom64_registers *regs;
347-
void *pval;
346+
const struct linux_prom64_registers *regs;
347+
const void *pval;
348348
int len;
349349

350350
if (!mp)

‎arch/sparc64/kernel/ebus.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ static void __init fill_ebus_child(struct device_node *dp,
285285
int non_standard_regs)
286286
{
287287
struct of_device *op;
288-
int *regs;
288+
const int *regs;
289289
int i, len;
290290

291291
dev->prom_node = dp;

‎arch/sparc64/kernel/irq.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ static u64 prom_limit0, prom_limit1;
627627
static void map_prom_timers(void)
628628
{
629629
struct device_node *dp;
630-
unsigned int *addr;
630+
const unsigned int *addr;
631631

632632
/* PROM timer node hangs out in the top level of device siblings... */
633633
dp = of_find_node_by_path("/");

‎arch/sparc64/kernel/isa.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ static void __init report_dev(struct sparc_isa_device *isa_dev, int child)
2424

2525
static void __init isa_dev_get_resource(struct sparc_isa_device *isa_dev)
2626
{
27-
struct linux_prom_registers *pregs;
27+
const struct linux_prom_registers *pregs;
2828
unsigned long base, len;
2929
int prop_len;
3030

‎arch/sparc64/kernel/of_device.c‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ struct of_bus {
245245
int *addrc, int *sizec);
246246
int (*map)(u32 *addr, const u32 *range,
247247
int na, int ns, int pna);
248-
unsigned int (*get_flags)(u32 *addr);
248+
unsigned int (*get_flags)(const u32 *addr);
249249
};
250250

251251
/*
@@ -305,7 +305,7 @@ static int of_bus_default_map(u32 *addr, const u32 *range,
305305
return 0;
306306
}
307307

308-
static unsigned int of_bus_default_get_flags(u32 *addr)
308+
static unsigned int of_bus_default_get_flags(const u32 *addr)
309309
{
310310
return IORESOURCE_MEM;
311311
}
@@ -369,7 +369,7 @@ static int of_bus_pci_map(u32 *addr, const u32 *range,
369369
return 0;
370370
}
371371

372-
static unsigned int of_bus_pci_get_flags(u32 *addr)
372+
static unsigned int of_bus_pci_get_flags(const u32 *addr)
373373
{
374374
unsigned int flags = 0;
375375
u32 w = addr[0];
@@ -482,7 +482,7 @@ static int __init build_one_resource(struct device_node *parent,
482482
u32 *addr,
483483
int na, int ns, int pna)
484484
{
485-
u32 *ranges;
485+
const u32 *ranges;
486486
unsigned int rlen;
487487
int rone;
488488

@@ -513,7 +513,7 @@ static int __init build_one_resource(struct device_node *parent,
513513

514514
static int __init use_1to1_mapping(struct device_node *pp)
515515
{
516-
char *model;
516+
const char *model;
517517

518518
/* If this is on the PMU bus, don't try to translate it even
519519
* if a ranges property exists.
@@ -548,7 +548,7 @@ static void __init build_device_resources(struct of_device *op,
548548
struct of_bus *bus;
549549
int na, ns;
550550
int index, num_reg;
551-
void *preg;
551+
const void *preg;
552552

553553
if (!parent)
554554
return;
@@ -578,7 +578,7 @@ static void __init build_device_resources(struct of_device *op,
578578
for (index = 0; index < num_reg; index++) {
579579
struct resource *r = &op->resource[index];
580580
u32 addr[OF_MAX_ADDR_CELLS];
581-
u32 *reg = (preg + (index * ((na + ns) * 4)));
581+
const u32 *reg = (preg + (index * ((na + ns) * 4)));
582582
struct device_node *dp = op->node;
583583
struct device_node *pp = p_op->node;
584584
struct of_bus *pbus, *dbus;
@@ -643,14 +643,14 @@ static void __init build_device_resources(struct of_device *op,
643643

644644
static struct device_node * __init
645645
apply_interrupt_map(struct device_node *dp, struct device_node *pp,
646-
u32 *imap, int imlen, u32 *imask,
646+
const u32 *imap, int imlen, const u32 *imask,
647647
unsigned int *irq_p)
648648
{
649649
struct device_node *cp;
650650
unsigned int irq = *irq_p;
651651
struct of_bus *bus;
652652
phandle handle;
653-
u32 *reg;
653+
const u32 *reg;
654654
int na, num_reg, i;
655655

656656
bus = of_match_bus(pp);
@@ -705,7 +705,7 @@ static unsigned int __init pci_irq_swizzle(struct device_node *dp,
705705
struct device_node *pp,
706706
unsigned int irq)
707707
{
708-
struct linux_prom_pci_registers *regs;
708+
const struct linux_prom_pci_registers *regs;
709709
unsigned int bus, devfn, slot, ret;
710710

711711
if (irq < 1 || irq > 4)
@@ -794,7 +794,7 @@ static unsigned int __init build_one_device_irq(struct of_device *op,
794794
pp = dp->parent;
795795
ip = NULL;
796796
while (pp) {
797-
void *imap, *imsk;
797+
const void *imap, *imsk;
798798
int imlen;
799799

800800
imap = of_get_property(pp, "interrupt-map", &imlen);
@@ -859,7 +859,7 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
859859
struct device *parent)
860860
{
861861
struct of_device *op = kzalloc(sizeof(*op), GFP_KERNEL);
862-
unsigned int *irq;
862+
const unsigned int *irq;
863863
int len, i;
864864

865865
if (!op)

‎arch/sparc64/kernel/pci_sun4v.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,24 +1281,24 @@ static int msi_queue_alloc(struct pci_pbm_info *pbm)
12811281

12821282
static void pci_sun4v_msi_init(struct pci_pbm_info *pbm)
12831283
{
1284-
u32 *val;
1284+
const u32 *val;
12851285
int len;
12861286

12871287
val = of_get_property(pbm->prom_node, "#msi-eqs", &len);
12881288
if (!val || len != 4)
12891289
goto no_msi;
12901290
pbm->msiq_num = *val;
12911291
if (pbm->msiq_num) {
1292-
struct msiq_prop {
1292+
const struct msiq_prop {
12931293
u32 first_msiq;
12941294
u32 num_msiq;
12951295
u32 first_devino;
12961296
} *mqp;
1297-
struct msi_range_prop {
1297+
const struct msi_range_prop {
12981298
u32 first_msi;
12991299
u32 num_msi;
13001300
} *mrng;
1301-
struct addr_range_prop {
1301+
const struct addr_range_prop {
13021302
u32 msi32_high;
13031303
u32 msi32_low;
13041304
u32 msi32_len;

‎arch/sparc64/kernel/prom.c‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ EXPORT_SYMBOL(of_getintprop_default);
196196

197197
int of_n_addr_cells(struct device_node *np)
198198
{
199-
int* ip;
199+
const int* ip;
200200
do {
201201
if (np->parent)
202202
np = np->parent;
@@ -211,7 +211,7 @@ EXPORT_SYMBOL(of_n_addr_cells);
211211

212212
int of_n_size_cells(struct device_node *np)
213213
{
214-
int* ip;
214+
const int* ip;
215215
do {
216216
if (np->parent)
217217
np = np->parent;
@@ -397,7 +397,7 @@ static unsigned int psycho_irq_build(struct device_node *dp,
397397

398398
static void psycho_irq_trans_init(struct device_node *dp)
399399
{
400-
struct linux_prom64_registers *regs;
400+
const struct linux_prom64_registers *regs;
401401

402402
dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller));
403403
dp->irq_trans->irq_build = psycho_irq_build;
@@ -547,7 +547,7 @@ static unsigned long __sabre_onboard_imap_off[] = {
547547
static int sabre_device_needs_wsync(struct device_node *dp)
548548
{
549549
struct device_node *parent = dp->parent;
550-
char *parent_model, *parent_compat;
550+
const char *parent_model, *parent_compat;
551551

552552
/* This traversal up towards the root is meant to
553553
* handle two cases:
@@ -589,7 +589,7 @@ static unsigned int sabre_irq_build(struct device_node *dp,
589589
{
590590
struct sabre_irq_data *irq_data = _data;
591591
unsigned long controller_regs = irq_data->controller_regs;
592-
struct linux_prom_pci_registers *regs;
592+
const struct linux_prom_pci_registers *regs;
593593
unsigned long imap, iclr;
594594
unsigned long imap_off, iclr_off;
595595
int inofixup = 0;
@@ -639,9 +639,9 @@ static unsigned int sabre_irq_build(struct device_node *dp,
639639

640640
static void sabre_irq_trans_init(struct device_node *dp)
641641
{
642-
struct linux_prom64_registers *regs;
642+
const struct linux_prom64_registers *regs;
643643
struct sabre_irq_data *irq_data;
644-
u32 *busrange;
644+
const u32 *busrange;
645645

646646
dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller));
647647
dp->irq_trans->irq_build = sabre_irq_build;
@@ -795,7 +795,7 @@ static unsigned int schizo_irq_build(struct device_node *dp,
795795

796796
static void __schizo_irq_trans_init(struct device_node *dp, int is_tomatillo)
797797
{
798-
struct linux_prom64_registers *regs;
798+
const struct linux_prom64_registers *regs;
799799
struct schizo_irq_data *irq_data;
800800

801801
dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller));
@@ -836,7 +836,7 @@ static unsigned int pci_sun4v_irq_build(struct device_node *dp,
836836

837837
static void pci_sun4v_irq_trans_init(struct device_node *dp)
838838
{
839-
struct linux_prom64_registers *regs;
839+
const struct linux_prom64_registers *regs;
840840

841841
dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller));
842842
dp->irq_trans->irq_build = pci_sun4v_irq_build;
@@ -940,7 +940,7 @@ static unsigned int sbus_of_build_irq(struct device_node *dp,
940940
void *_data)
941941
{
942942
unsigned long reg_base = (unsigned long) _data;
943-
struct linux_prom_registers *regs;
943+
const struct linux_prom_registers *regs;
944944
unsigned long imap, iclr;
945945
int sbus_slot = 0;
946946
int sbus_level = 0;
@@ -994,7 +994,7 @@ static unsigned int sbus_of_build_irq(struct device_node *dp,
994994

995995
static void sbus_irq_trans_init(struct device_node *dp)
996996
{
997-
struct linux_prom64_registers *regs;
997+
const struct linux_prom64_registers *regs;
998998

999999
dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller));
10001000
dp->irq_trans->irq_build = sbus_of_build_irq;
@@ -1080,7 +1080,7 @@ static unsigned int sun4v_vdev_irq_build(struct device_node *dp,
10801080

10811081
static void sun4v_vdev_irq_trans_init(struct device_node *dp)
10821082
{
1083-
struct linux_prom64_registers *regs;
1083+
const struct linux_prom64_registers *regs;
10841084

10851085
dp->irq_trans = prom_early_alloc(sizeof(struct of_irq_controller));
10861086
dp->irq_trans->irq_build = sun4v_vdev_irq_build;

‎arch/sparc64/kernel/sbus.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,7 +1025,7 @@ static void __init sysio_register_error_handlers(struct sbus_bus *sbus)
10251025
/* Boot time initialization. */
10261026
static void __init sbus_iommu_init(int __node, struct sbus_bus *sbus)
10271027
{
1028-
struct linux_prom64_registers *pr;
1028+
const struct linux_prom64_registers *pr;
10291029
struct device_node *dp;
10301030
struct sbus_iommu *iommu;
10311031
unsigned long regs;
@@ -1133,7 +1133,7 @@ static void __init sbus_iommu_init(int __node, struct sbus_bus *sbus)
11331133
void sbus_fill_device_irq(struct sbus_dev *sdev)
11341134
{
11351135
struct device_node *dp = of_find_node_by_phandle(sdev->prom_node);
1136-
struct linux_prom_irqs *irqs;
1136+
const struct linux_prom_irqs *irqs;
11371137

11381138
irqs = of_get_property(dp, "interrupts", NULL);
11391139
if (!irqs) {

‎arch/sparc64/kernel/time.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ static int hypervisor_set_time(u32 secs)
704704
return -EOPNOTSUPP;
705705
}
706706

707-
static int __init clock_model_matches(char *model)
707+
static int __init clock_model_matches(const char *model)
708708
{
709709
if (strcmp(model, "mk48t02") &&
710710
strcmp(model, "mk48t08") &&
@@ -721,7 +721,7 @@ static int __init clock_model_matches(char *model)
721721
static int __devinit clock_probe(struct of_device *op, const struct of_device_id *match)
722722
{
723723
struct device_node *dp = op->node;
724-
char *model = of_get_property(dp, "model", NULL);
724+
const char *model = of_get_property(dp, "model", NULL);
725725
unsigned long size, flags;
726726
void __iomem *regs;
727727

0 commit comments

Comments
 (0)