sparc/of: Move of_device fields into struct pdev_archdata
Subsystems (11)
A message that is not in the archive (sent off-list or not yet received): 20100604205930.2762.17131.stgit@angua
PATCH 1/2 sparc/of: Move of_device fields into struct pdev_archdata
This patch moves SPARC architecture specific data members out of struct of_device and into the pdev_archdata structure. The reason for this change is to unify the struct of_device definition amongst all the architectures. It also remvoes the .sysdata, .slot, .portid and .clock_freq properties because they aren't actually used by anything.
A subsequent patch will replace struct of_device entirely with struct platform_device and the of_platform support code will share common routines with the platform bus (but the bus instances themselves can remain separate).
This patch also adds 'struct resources *resource' and num_resources to match the fields defined in struct platform_device. After this change, 'struct platform_device' can be used as a drop-in replacement for 'struct of_platform'.
This change is in preparation for merging the of_platform_bus_type with the platform_bus_type.
--- arch/sparc/include/asm/device.h | 5 +++++ arch/sparc/include/asm/floppy_64.h | 4 ++-- arch/sparc/include/asm/of_device.h | 11 +++-------- arch/sparc/include/asm/parport.h | 4 ++-- arch/sparc/kernel/of_device_32.c | 28 ++++++++++++---------------- arch/sparc/kernel/of_device_64.c | 24 ++++++++++-------------- arch/sparc/kernel/of_device_common.c | 4 ++-- arch/sparc/kernel/pci.c | 2 +- arch/sparc/kernel/pci_psycho.c | 8 ++++---- arch/sparc/kernel/pci_sabre.c | 8 ++++---- arch/sparc/kernel/pci_schizo.c | 20 ++++++++++---------- arch/sparc/kernel/power.c | 2 +- drivers/atm/fore200e.c | 2 +- drivers/input/serio/i8042-sparcio.h | 8 ++++---- drivers/net/myri_sbus.c | 2 +- drivers/net/niu.c | 6 +++--- drivers/net/sunbmac.c | 2 +- drivers/net/sunhme.c | 6 +++--- drivers/net/sunlance.c | 2 +- drivers/net/sunqe.c | 6 +++--- drivers/parport/parport_sunbpp.c | 2 +- drivers/sbus/char/bbc_i2c.c | 6 +++--- drivers/sbus/char/uctrl.c | 2 +- drivers/scsi/qlogicpti.c | 4 ++-- drivers/scsi/sun_esp.c | 2 +- drivers/serial/sunhv.c | 4 ++-- drivers/serial/sunsab.c | 2 +- drivers/serial/sunsu.c | 2 +- drivers/serial/sunzilog.c | 10 +++++----- drivers/watchdog/cpwd.c | 2 +- sound/sparc/amd7930.c | 2 +- sound/sparc/cs4231.c | 14 +++++++------- sound/sparc/dbri.c | 2 +- 33 files changed, 100 insertions(+), 108 deletions(-)
arch/sparc/include/asm/device.h +5 -0
@@ -6,6 +6,8 @@#ifndef _ASM_SPARC_DEVICE_H#define _ASM_SPARC_DEVICE_H +#include <asm/openprom.h> +struct device_node ;struct of_device ;
@@ -18,6 +20,9 @@ struct dev_archdata { };struct pdev_archdata { +struct resource resource[PROMREG_MAX ]; +unsigned int irqs[PROMINTR_MAX ]; +int num_irqs; };#endif /* _ASM_SPARC_DEVICE_H */
arch/sparc/include/asm/floppy_64.h +2 -2
@@ -567,7 +567,7 @@ static unsigned long __init sun_floppy_init(void) }if (op) { floppy_op = op; -FLOPPY_IRQ = op->irqs[0 ]; +FLOPPY_IRQ = op->archdata.irqs[0 ]; }else {struct device_node *ebus_dp;void __iomem *auxio_reg;
@@ -593,7 +593,7 @@ static unsigned long __init sun_floppy_init(void)if (state_prop && !strncmp (state_prop,"disabled" ,8 ))return 0 ; -FLOPPY_IRQ = op->irqs[0 ]; +FLOPPY_IRQ = op->archdata.irqs[0 ];/* Make sure the high density bit is set, some systems * (most notably Ultra5/Ultra10) come up with it clear.
arch/sparc/include/asm/of_device.h +3 -8
@@ -15,15 +15,10 @@struct of_device {struct device dev; -struct resource resource[PROMREG_MAX ]; -unsigned int irqs[PROMINTR_MAX ]; -int num_irqs; +u32 num_resources; +struct resource *resource; -void *sysdata; - -int slot; -int portid; -int clock_freq; +struct pdev_archdata archdata; };extern void __iomem *of_ioremap (struct resource *res,unsigned long offset,unsigned long size,char *name);
arch/sparc/include/asm/parport.h +2 -2
@@ -116,7 +116,7 @@ static int __devinit ecpp_probe(struct of_device *op, const struct of_device_id parent = op->dev.of_node->parent;if (!strcmp (parent->name,"dma" )) { p =parport_pc_probe_port (base, base +0x400 , - op->irqs[0 ],PARPORT_DMA_NOFIFO , + op->archdata.irqs[0 ],PARPORT_DMA_NOFIFO , op->dev.parent->parent,0 );if (!p)return -ENOMEM ;
@@ -166,7 +166,7 @@ static int __devinit ecpp_probe(struct of_device *op, const struct of_device_id 0, PTR_LPT_REG_DIR); p =parport_pc_probe_port (base, base +0x400 , - op->irqs[0 ], + op->archdata.irqs[0 ], slot, op->dev.parent,0 );
arch/sparc/kernel/of_device_32.c +12 -16
@@ -267,6 +267,8 @@ static void __init build_device_resources(struct of_device *op,/* Conver to num-entries. */ num_reg /= na + ns; + op->resource = op->archdata.resource; + op->num_resources = num_reg;for (index =0 ; index < num_reg; index++) {struct resource *r = &op->resource[index];u32 addr[OF_MAX_ADDR_CELLS ];
@@ -349,27 +351,21 @@ static struct of_device * __init scan_one_device(struct device_node *dp, op->dev.of_node = dp; - op->clock_freq =of_getintprop_default (dp,"clock-frequency" , - (25 *1000 *1000 )); - op->portid =of_getintprop_default (dp,"upa-portid" ,-1 ); -if (op->portid ==-1 ) - op->portid =of_getintprop_default (dp,"portid" ,-1 ); - intr =of_get_property (dp,"intr" , &len);if (intr) { - op->num_irqs = len /sizeof (struct linux_prom_irqs ); -for (i =0 ; i < op->num_irqs; i++) - op->irqs[i] = intr[i].pri; + op->archdata.num_irqs = len /sizeof (struct linux_prom_irqs ); +for (i =0 ; i < op->archdata.num_irqs; i++) + op->archdata.irqs[i] = intr[i].pri; }else {const unsigned int *irq =of_get_property (dp,"interrupts" , &len);if (irq) { - op->num_irqs = len /sizeof (unsigned int ); -for (i =0 ; i < op->num_irqs; i++) - op->irqs[i] = irq[i]; + op->archdata.num_irqs = len /sizeof (unsigned int ); +for (i =0 ; i < op->archdata.num_irqs; i++) + op->archdata.irqs[i] = irq[i]; }else { - op->num_irqs =0 ; + op->archdata.num_irqs =0 ; } }if (sparc_cpu_model == sun4d) {
@@ -411,8 +407,8 @@ static struct of_device * __init scan_one_device(struct device_node *dp, goto build_resources; } -for (i =0 ; i < op->num_irqs; i++) { -int this_irq = op->irqs[i]; +for (i =0 ; i < op->archdata.num_irqs; i++) { +int this_irq = op->archdata.irqs[i];int sbusl = pil_to_sbus[this_irq];if (sbusl)
@@ -420,7 +416,7 @@ static struct of_device * __init scan_one_device(struct device_node *dp, (sbusl <<2 ) + slot); - op->irqs[i] = this_irq; + op->archdata.irqs[i] = this_irq; } }
arch/sparc/kernel/of_device_64.c +10 -14
@@ -344,6 +344,8 @@ static void __init build_device_resources(struct of_device *op, num_reg =PROMREG_MAX ; } + op->resource = op->archdata.resource; + op->num_resources = num_reg;for (index =0 ; index < num_reg; index++) {struct resource *r = &op->resource[index];u32 addr[OF_MAX_ADDR_CELLS ];
@@ -644,31 +646,25 @@ static struct of_device * __init scan_one_device(struct device_node *dp, op->dev.of_node = dp; - op->clock_freq =of_getintprop_default (dp,"clock-frequency" , - (25 *1000 *1000 )); - op->portid =of_getintprop_default (dp,"upa-portid" ,-1 ); -if (op->portid ==-1 ) - op->portid =of_getintprop_default (dp,"portid" ,-1 ); - irq =of_get_property (dp,"interrupts" , &len);if (irq) { - op->num_irqs = len /4 ; + op->archdata.num_irqs = len /4 ;/* Prevent overrunning the op->irqs[] array. */ -if (op->num_irqs >PROMINTR_MAX ) { +if (op->archdata.num_irqs >PROMINTR_MAX ) {printk (KERN_WARNING "%s: Too many irqs (%d), " "limiting to %d.\n" , - dp->full_name, op->num_irqs,PROMINTR_MAX ); - op->num_irqs =PROMINTR_MAX ; + dp->full_name, op->archdata.num_irqs,PROMINTR_MAX ); + op->archdata.num_irqs =PROMINTR_MAX ; } -memcpy (op->irqs, irq, op->num_irqs *4 ); +memcpy (op->archdata.irqs, irq, op->archdata.num_irqs *4 ); }else { - op->num_irqs =0 ; + op->archdata.num_irqs =0 ; }build_device_resources (op, parent); -for (i =0 ; i < op->num_irqs; i++) - op->irqs[i] =build_one_device_irq (op, parent, op->irqs[i]); +for (i =0 ; i < op->archdata.num_irqs; i++) + op->archdata.irqs[i] =build_one_device_irq (op, parent, op->archdata.irqs[i]); op->dev.parent = parent; op->dev.bus = &of_platform_bus_type;
arch/sparc/kernel/of_device_common.c +2 -2
@@ -35,10 +35,10 @@ unsigned int irq_of_parse_and_map(struct device_node *node, int index) {struct of_device *op =of_find_device_by_node (node); -if (!op || index >= op->num_irqs) +if (!op || index >= op->archdata.num_irqs)return 0 ; -return op->irqs[index]; +return op->archdata.irqs[index]; }EXPORT_SYMBOL (irq_of_parse_and_map);
arch/sparc/kernel/pci.c +1 -1
@@ -340,7 +340,7 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm, dev->hdr_type =PCI_HEADER_TYPE_NORMAL ; dev->rom_base_reg =PCI_ROM_ADDRESS ; - dev->irq = sd->op->irqs[0 ]; + dev->irq = sd->op->archdata.irqs[0 ];if (dev->irq ==0xffffffff ) dev->irq =PCI_IRQ_NONE ; }
arch/sparc/kernel/pci_psycho.c +4 -4
@@ -302,23 +302,23 @@ static void psycho_register_error_handlers(struct pci_pbm_info *pbm)* 5: POWER MANAGEMENT */ -if (op->num_irqs <6 ) +if (op->archdata.num_irqs <6 )return ;/* We really mean to ignore the return result here. Two * PCI controller share the same interrupt numbers and * drive the same front-end hardware. */ - err =request_irq (op->irqs[1 ], psycho_ue_intr,IRQF_SHARED , + err =request_irq (op->archdata.irqs[1 ], psycho_ue_intr,IRQF_SHARED ,"PSYCHO_UE" , pbm); - err =request_irq (op->irqs[2 ], psycho_ce_intr,IRQF_SHARED , + err =request_irq (op->archdata.irqs[2 ], psycho_ce_intr,IRQF_SHARED ,"PSYCHO_CE" , pbm);/* This one, however, ought not to fail. We can just warn * about it since the system can still operate properly even * if this fails. */ - err =request_irq (op->irqs[0 ], psycho_pcierr_intr,IRQF_SHARED , + err =request_irq (op->archdata.irqs[0 ], psycho_pcierr_intr,IRQF_SHARED ,"PSYCHO_PCIERR" , pbm);if (err) printk(KERN_WARNING "%s: Could not register PCIERR, "
arch/sparc/kernel/pci_sabre.c +4 -4
@@ -329,7 +329,7 @@ static void sabre_register_error_handlers(struct pci_pbm_info *pbm)* 2: CE ERR * 3: POWER FAIL */ -if (op->num_irqs <4 ) +if (op->archdata.num_irqs <4 )return ;/* We clear the error bits in the appropriate AFSR before
@@ -341,7 +341,7 @@ static void sabre_register_error_handlers(struct pci_pbm_info *pbm) SABRE_UEAFSR_SDTE | SABRE_UEAFSR_PDTE), base + SABRE_UE_AFSR); - err =request_irq (op->irqs[1 ], sabre_ue_intr,0 ,"SABRE_UE" , pbm); + err =request_irq (op->archdata.irqs[1 ], sabre_ue_intr,0 ,"SABRE_UE" , pbm);if (err)printk (KERN_WARNING "%s: Couldn't register UE, err=%d.\n" , pbm->name, err);
@@ -351,11 +351,11 @@ static void sabre_register_error_handlers(struct pci_pbm_info *pbm) base + SABRE_CE_AFSR); - err =request_irq (op->irqs[2 ], sabre_ce_intr,0 ,"SABRE_CE" , pbm); + err =request_irq (op->archdata.irqs[2 ], sabre_ce_intr,0 ,"SABRE_CE" , pbm);if (err)printk (KERN_WARNING "%s: Couldn't register CE, err=%d.\n" , pbm->name, err); - err =request_irq (op->irqs[0 ], psycho_pcierr_intr,0 , + err =request_irq (op->archdata.irqs[0 ], psycho_pcierr_intr,0 ,"SABRE_PCIERR" , pbm);if (err) printk(KERN_WARNING "%s: Couldn't register PCIERR, err=%d.\n",
arch/sparc/kernel/pci_schizo.c +10 -10
@@ -857,14 +857,14 @@ static void tomatillo_register_error_handlers(struct pci_pbm_info *pbm)*/ if (pbm_routes_this_ino (pbm,SCHIZO_UE_INO )) { - err =request_irq (op->irqs[1 ], schizo_ue_intr,0 , + err =request_irq (op->archdata.irqs[1 ], schizo_ue_intr,0 ,"TOMATILLO_UE" , pbm);if (err)printk (KERN_WARNING "%s: Could not register UE, " "err=%d\n" , pbm->name, err); }if (pbm_routes_this_ino (pbm,SCHIZO_CE_INO )) { - err =request_irq (op->irqs[2 ], schizo_ce_intr,0 , + err =request_irq (op->archdata.irqs[2 ], schizo_ce_intr,0 ,"TOMATILLO_CE" , pbm);if (err) printk(KERN_WARNING "%s: Could not register CE, "
@@ -872,10 +872,10 @@ static void tomatillo_register_error_handlers(struct pci_pbm_info *pbm) } err =0 ;if (pbm_routes_this_ino (pbm,SCHIZO_PCIERR_A_INO )) { - err =request_irq (op->irqs[0 ], schizo_pcierr_intr,0 , + err =request_irq (op->archdata.irqs[0 ], schizo_pcierr_intr,0 ,"TOMATILLO_PCIERR" , pbm); }else if (pbm_routes_this_ino (pbm,SCHIZO_PCIERR_B_INO )) { - err =request_irq (op->irqs[0 ], schizo_pcierr_intr,0 , + err =request_irq (op->archdata.irqs[0 ], schizo_pcierr_intr,0 ,"TOMATILLO_PCIERR" , pbm); }if (err)
@@ -883,7 +883,7 @@ static void tomatillo_register_error_handlers(struct pci_pbm_info *pbm) "err=%d\n", pbm->name, err);if (pbm_routes_this_ino (pbm,SCHIZO_SERR_INO )) { - err =request_irq (op->irqs[3 ], schizo_safarierr_intr,0 , + err =request_irq (op->archdata.irqs[3 ], schizo_safarierr_intr,0 ,"TOMATILLO_SERR" , pbm);if (err) printk(KERN_WARNING "%s: Could not register SERR, "
@@ -952,14 +952,14 @@ static void schizo_register_error_handlers(struct pci_pbm_info *pbm)*/ if (pbm_routes_this_ino (pbm,SCHIZO_UE_INO )) { - err =request_irq (op->irqs[1 ], schizo_ue_intr,0 , + err =request_irq (op->archdata.irqs[1 ], schizo_ue_intr,0 ,"SCHIZO_UE" , pbm);if (err)printk (KERN_WARNING "%s: Could not register UE, " "err=%d\n" , pbm->name, err); }if (pbm_routes_this_ino (pbm,SCHIZO_CE_INO )) { - err =request_irq (op->irqs[2 ], schizo_ce_intr,0 , + err =request_irq (op->archdata.irqs[2 ], schizo_ce_intr,0 ,"SCHIZO_CE" , pbm);if (err) printk(KERN_WARNING "%s: Could not register CE, "
@@ -967,10 +967,10 @@ static void schizo_register_error_handlers(struct pci_pbm_info *pbm) } err =0 ;if (pbm_routes_this_ino (pbm,SCHIZO_PCIERR_A_INO )) { - err =request_irq (op->irqs[0 ], schizo_pcierr_intr,0 , + err =request_irq (op->archdata.irqs[0 ], schizo_pcierr_intr,0 ,"SCHIZO_PCIERR" , pbm); }else if (pbm_routes_this_ino (pbm,SCHIZO_PCIERR_B_INO )) { - err =request_irq (op->irqs[0 ], schizo_pcierr_intr,0 , + err =request_irq (op->archdata.irqs[0 ], schizo_pcierr_intr,0 ,"SCHIZO_PCIERR" , pbm); }if (err)
@@ -978,7 +978,7 @@ static void schizo_register_error_handlers(struct pci_pbm_info *pbm) "err=%d\n", pbm->name, err);if (pbm_routes_this_ino (pbm,SCHIZO_SERR_INO )) { - err =request_irq (op->irqs[3 ], schizo_safarierr_intr,0 , + err =request_irq (op->archdata.irqs[3 ], schizo_safarierr_intr,0 ,"SCHIZO_SERR" , pbm);if (err) printk(KERN_WARNING "%s: Could not register SERR, "
arch/sparc/kernel/power.c +1 -1
@@ -36,7 +36,7 @@ static int __devinit has_button_interrupt(unsigned int irq, struct device_node *static int __devinit power_probe (struct of_device *op,const struct of_device_id *match) {struct resource *res = &op->resource[0 ]; -unsigned int irq= op->irqs[0 ]; +unsigned int irq = op->archdata.irqs[0 ]; power_reg =of_ioremap (res,0 ,0x4 ,"power" );
drivers/atm/fore200e.c +1 -1
@@ -2657,7 +2657,7 @@ static int __devinit fore200e_sba_probe(struct of_device *op, fore200e->bus = bus; fore200e->bus_dev = op; - fore200e->irq = op->irqs[0 ]; + fore200e->irq = op->archdata.irqs[0 ]; fore200e->phys_base = op->resource[0 ].start;sprintf (fore200e->name,"%s-%d" , bus->model_name, index);
drivers/input/serio/i8042-sparcio.h +4 -4
@@ -58,9 +58,9 @@ static int __devinit sparc_i8042_probe(struct of_device *op, const struct of_devif (!strcmp (dp->name,OBP_PS2KBD_NAME1 ) || !strcmp (dp->name,OBP_PS2KBD_NAME2 )) {struct of_device *kbd =of_find_device_by_node (dp); -unsigned int irq = kbd->irqs[0 ]; +unsigned int irq = kbd->archdata.irqs[0 ];if (irq ==0xffffffff ) - irq = op->irqs[0 ]; + irq = op->archdata.irqs[0 ]; i8042_kbd_irq = irq; kbd_iobase =of_ioremap (&kbd->resource[0 ],0 ,8 ,"kbd" );
@@ -68,9 +68,9 @@ static int __devinit sparc_i8042_probe(struct of_device *op, const struct of_dev }else if (!strcmp (dp->name,OBP_PS2MS_NAME1 ) || !strcmp (dp->name,OBP_PS2MS_NAME2 )) {struct of_device *ms =of_find_device_by_node (dp); -unsigned int irq = ms->irqs[0 ]; +unsigned int irq = ms->archdata.irqs[0 ];if (irq ==0xffffffff ) - irq = op->irqs[0 ]; + irq = op->archdata.irqs[0 ]; i8042_aux_irq = irq; }
drivers/net/myri_sbus.c +1 -1
@@ -1079,7 +1079,7 @@ static int __devinit myri_sbus_probe(struct of_device *op, const struct of_devic mp->dev = dev; dev->watchdog_timeo =5 *HZ ; - dev->irq = op->irqs[0 ]; + dev->irq = op->archdata.irqs[0 ]; dev->netdev_ops = &myri_ops;/* Register interrupt handler now. */
drivers/net/niu.c +3 -3
@@ -9119,12 +9119,12 @@ static int __devinit niu_n2_irq_init(struct niu *np, u8 *ldg_num_map)if (!int_prop)return -ENODEV ; -for (i =0 ; i < op->num_irqs; i++) { +for (i =0 ; i < op->archdata.num_irqs; i++) { ldg_num_map[i] = int_prop[i]; - np->ldg[i].irq = op->irqs[i]; + np->ldg[i].irq = op->archdata.irqs[i]; } - np->num_ldg = op->num_irqs; + np->num_ldg = op->archdata.num_irqs;return 0 ;#else
drivers/net/sunbmac.c +1 -1
@@ -1201,7 +1201,7 @@ static int __devinit bigmac_ether_init(struct of_device *op, dev->watchdog_timeo =5 *HZ ;/* Finish net device registration. */ - dev->irq = bp->bigmac_op->irqs[0 ]; + dev->irq = bp->bigmac_op->archdata.irqs[0 ]; dev->dma =0 ;if (register_netdev (dev)) {
drivers/net/sunhme.c +3 -3
@@ -2561,7 +2561,7 @@ static int __init quattro_sbus_register_irqs(void)if (skip)continue ; - err =request_irq (op->irqs[0 ], + err =request_irq (op->archdata.irqs[0 ], quattro_sbus_interrupt,IRQF_SHARED ,"Quattro" , qp);
@@ -2590,7 +2590,7 @@ static void quattro_sbus_free_irqs(void)if (skip)continue ; - free_irq(op->irqs[0], qp); + free_irq(op->archdata.irqs[0], qp); } }#endif /* CONFIG_SBUS */
@@ -2790,7 +2790,7 @@ static int __devinit happy_meal_sbus_probe_one(struct of_device *op, int is_qfe)/* Happy Meal can do it all... */ dev->features |=NETIF_F_SG |NETIF_F_HW_CSUM ; - dev->irq = op->irqs[0 ]; + dev->irq = op->archdata.irqs[0 ];#if defined(CONFIG_SBUS ) && defined(CONFIG_PCI )/* Hook up SBUS register/descriptor accessors. */
drivers/net/sunlance.c +1 -1
@@ -1474,7 +1474,7 @@ no_link_test: dev->ethtool_ops = &sparc_lance_ethtool_ops; dev->netdev_ops = &sparc_lance_ops; - dev->irq = op->irqs[0 ]; + dev->irq = op->archdata.irqs[0 ];/* We cannot sleep if the chip is busy during a * multicast list update event, because such events
drivers/net/sunqe.c +3 -3
@@ -803,7 +803,7 @@ static struct sunqec * __devinit get_qec(struct of_device *child)qec_init_once (qecp, op); -if (request_irq (op->irqs[0 ], qec_interrupt, +if (request_irq (op->archdata.irqs[0 ], qec_interrupt,IRQF_SHARED ,"qec" , (void *) qecp)) {printk (KERN_ERR "qec: Can't register irq.\n" ); goto fail;
@@ -901,7 +901,7 @@ static int __devinit qec_ether_init(struct of_device *op)SET_NETDEV_DEV (dev, &op->dev); dev->watchdog_timeo =5 *HZ ; - dev->irq = op->irqs[0 ]; + dev->irq = op->archdata.irqs[0 ]; dev->dma =0 ; dev->ethtool_ops = &qe_ethtool_ops; dev->netdev_ops = &qec_ops;
@@ -999,7 +999,7 @@ static void __exit qec_exit(void)struct sunqec *next = root_qec_dev->next_module;struct of_device *op = root_qec_dev->op; -free_irq (op->irqs[0 ], (void *) root_qec_dev); +free_irq (op->archdata.irqs[0 ], (void *) root_qec_dev);of_iounmap (&op->resource[0 ], root_qec_dev->gregs,GLOB_REG_SIZE );kfree (root_qec_dev);
drivers/parport/parport_sunbpp.c +1 -1
@@ -295,7 +295,7 @@ static int __devinit bpp_probe(struct of_device *op, const struct of_device_id *void __iomem *base;struct parport *p; - irq = op->irqs[0 ]; + irq = op->archdata.irqs[0 ]; base =of_ioremap (&op->resource[0 ],0 ,resource_size (&op->resource[0 ]),"sunbpp" );
drivers/sbus/char/bbc_i2c.c +3 -3
@@ -317,7 +317,7 @@ static struct bbc_i2c_bus * __init attach_one_i2c(struct of_device *op, int inde bp->waiting =0 ;init_waitqueue_head (&bp->wq); -if (request_irq (op->irqs[0 ], bbc_i2c_interrupt, +if (request_irq (op->archdata.irqs[0 ], bbc_i2c_interrupt,IRQF_SHARED ,"bbc_i2c" , bp)) goto fail;
@@ -373,7 +373,7 @@ static int __devinit bbc_i2c_probe(struct of_device *op, err =bbc_envctrl_init (bp);if (err) { -free_irq (op->irqs[0 ], bp); +free_irq (op->archdata.irqs[0 ], bp);if (bp->i2c_bussel_reg)of_iounmap (&op->resource[0 ], bp->i2c_bussel_reg,1 );if (bp->i2c_control_regs)
@@ -392,7 +392,7 @@ static int __devexit bbc_i2c_remove(struct of_device *op)bbc_envctrl_cleanup (bp); -free_irq (op->irqs[0 ], bp); +free_irq (op->archdata.irqs[0 ], bp);if (bp->i2c_bussel_reg)of_iounmap (&op->resource[0 ], bp->i2c_bussel_reg,1 );
drivers/sbus/char/uctrl.c +1 -1
@@ -367,7 +367,7 @@ static int __devinit uctrl_probe(struct of_device *op, goto out_free; } - p->irq = op->irqs[0 ]; + p->irq = op->archdata.irqs[0 ]; err =request_irq (p->irq, uctrl_interrupt,0 ,"uctrl" , p);if (err) {printk (KERN_ERR "uctrl: Unable to register irq.\n" );
drivers/scsi/qlogicpti.c +2 -2
@@ -729,7 +729,7 @@ static int __devinit qpti_register_irq(struct qlogicpti *qpti) {struct of_device *op = qpti->op; - qpti->qhost->irq = qpti->irq = op->irqs[0 ]; + qpti->qhost->irq = qpti->irq = op->archdata.irqs[0 ];/* We used to try various overly-clever things to * reduce the interrupt processing overhead on
@@ -1302,7 +1302,7 @@ static int __devinit qpti_sbus_probe(struct of_device *op, const struct of_devic/* Sometimes Antares cards come up not completely * setup, and we get a report of a zero IRQ. */ -if (op->irqs[0 ] ==0 ) +if (op->archdata.irqs[0 ] ==0 )return -ENODEV ; host =scsi_host_alloc (tpnt,sizeof (struct qlogicpti ));
drivers/scsi/sun_esp.c +1 -1
@@ -116,7 +116,7 @@ static int __devinit esp_sbus_register_irq(struct esp *esp)struct Scsi_Host *host = esp->host;struct of_device *op = esp->dev; - host->irq = op->irqs[0 ]; + host->irq = op->archdata.irqs[0 ];return request_irq (host->irq, scsi_esp_intr,IRQF_SHARED ,"ESP" , esp); }
drivers/serial/sunhv.c +2 -2
@@ -525,7 +525,7 @@ static int __devinit hv_probe(struct of_device *op, const struct of_device_id *munsigned long minor;int err; -if (op->irqs[0 ] ==0xffffffff ) +if (op->archdata.irqs[0 ] ==0xffffffff )return -ENODEV ; port =kzalloc (sizeof (struct uart_port ),GFP_KERNEL );
@@ -557,7 +557,7 @@ static int __devinit hv_probe(struct of_device *op, const struct of_device_id *m port->membase = (unsigned char __iomem *)__pa (port); - port->irq = op->irqs[0 ]; + port->irq = op->archdata.irqs[0 ]; port->dev = &op->dev;
drivers/serial/sunsab.c +1 -1
@@ -969,7 +969,7 @@ static int __devinit sunsab_init_one(struct uart_sunsab_port *up,return -ENOMEM ; up->regs = (union sab82532_async_regs __iomem *) up->port.membase; - up->port.irq = op->irqs[0 ]; + up->port.irq = op->archdata.irqs[0 ]; up->port.fifosize =SAB82532_XMIT_FIFO_SIZE ; up->port.iotype =UPIO_MEM ;
drivers/serial/sunsu.c +1 -1
@@ -1443,7 +1443,7 @@ static int __devinit su_probe(struct of_device *op, const struct of_device_id *mreturn -ENOMEM ; } - up->port.irq = op->irqs[0 ]; + up->port.irq = op->archdata.irqs[0 ]; up->port.dev = &op->dev;
drivers/serial/sunzilog.c +5 -5
@@ -1426,7 +1426,7 @@ static int __devinit zs_probe(struct of_device *op, const struct of_device_id *m rp = sunzilog_chip_regs[inst];if (zilog_irq ==-1 ) - zilog_irq = op->irqs[0 ]; + zilog_irq = op->archdata.irqs[0 ]; up = &sunzilog_port_table[inst *2 ];
@@ -1434,7 +1434,7 @@ static int __devinit zs_probe(struct of_device *op, const struct of_device_id *m up[0 ].port.mapbase = op->resource[0 ].start +0x00 ; up[0 ].port.membase = (void __iomem *) &rp->channelA; up[0 ].port.iotype =UPIO_MEM ; - up[0 ].port.irq = op->irqs[0 ]; + up[0 ].port.irq = op->archdata.irqs[0 ]; up[0 ].port.uartclk =ZS_CLOCK ; up[0 ].port.fifosize =1 ; up[0 ].port.ops = &sunzilog_pops;
@@ -1451,7 +1451,7 @@ static int __devinit zs_probe(struct of_device *op, const struct of_device_id *m up[1 ].port.mapbase = op->resource[0 ].start +0x04 ; up[1 ].port.membase = (void __iomem *) &rp->channelB; up[1 ].port.iotype =UPIO_MEM ; - up[1 ].port.irq = op->irqs[0 ]; + up[1 ].port.irq = op->archdata.irqs[0 ]; up[1 ].port.uartclk =ZS_CLOCK ; up[1 ].port.fifosize =1 ; up[1 ].port.ops = &sunzilog_pops;
@@ -1492,12 +1492,12 @@ static int __devinit zs_probe(struct of_device *op, const struct of_device_id *m"is a %s\n" ,dev_name (&op->dev), (unsigned long long ) up[0 ].port.mapbase, - op->irqs[0], sunzilog_type(&up[0].port)); + op->archdata.irqs[0], sunzilog_type(&up[0].port));printk (KERN_INFO "%s: Mouse at MMIO 0x%llx (irq = %d) " "is a %s\n" ,dev_name (&op->dev), (unsigned long long ) up[1 ].port.mapbase, - op->irqs[0 ],sunzilog_type (&up[1 ].port)); + op->archdata.irqs[0 ],sunzilog_type (&up[1 ].port)); kbm_inst++; }
drivers/watchdog/cpwd.c +1 -1
@@ -545,7 +545,7 @@ static int __devinit cpwd_probe(struct of_device *op, goto out; } - p->irq = op->irqs[0 ]; + p->irq = op->archdata.irqs[0 ];spin_lock_init (&p->lock);
sound/sparc/amd7930.c +1 -1
@@ -1010,7 +1010,7 @@ static int __devinit amd7930_sbus_probe(struct of_device *op, const struct of_destruct snd_amd7930 *amd;int err, irq; - irq = op->irqs[0 ]; + irq = op->archdata.irqs[0 ];if (dev_num >=SNDRV_CARDS )return -ENODEV ;
sound/sparc/cs4231.c +7 -7
@@ -1832,14 +1832,14 @@ static int __devinit snd_cs4231_sbus_create(struct snd_card *card, chip->c_dma.request = sbus_dma_request; chip->c_dma.address = sbus_dma_addr; -if (request_irq (op->irqs[0 ], snd_cs4231_sbus_interrupt, +if (request_irq (op->archdata.irqs[0 ], snd_cs4231_sbus_interrupt,IRQF_SHARED ,"cs4231" , chip)) {snd_printdd ("cs4231-%d: Unable to grab SBUS IRQ %d\n" , - dev, op->irqs[0 ]); + dev, op->archdata.irqs[0 ]);snd_cs4231_sbus_free (chip);return -EBUSY ; } - chip->irq[0 ] = op->irqs[0 ]; + chip->irq[0 ] = op->archdata.irqs[0 ];if (snd_cs4231_probe (chip) <0 ) {snd_cs4231_sbus_free (chip);
@@ -1870,7 +1870,7 @@ static int __devinit cs4231_sbus_probe(struct of_device *op, const struct of_dev card->shortname, rp->flags &0xffL , (unsigned long long )rp->start, - op->irqs[0]); + op->archdata.irqs[0]); err =snd_cs4231_sbus_create (card, op, dev);if (err <0 ) {
@@ -1979,12 +1979,12 @@ static int __devinit snd_cs4231_ebus_create(struct snd_card *card, chip->c_dma.ebus_info.flags =EBUS_DMA_FLAG_USE_EBDMA_HANDLER ; chip->c_dma.ebus_info.callback = snd_cs4231_ebus_capture_callback; chip->c_dma.ebus_info.client_cookie = chip; - chip->c_dma.ebus_info.irq = op->irqs[0 ]; + chip->c_dma.ebus_info.irq = op->archdata.irqs[0 ];strcpy (chip->p_dma.ebus_info.name,"cs4231(play)" ); chip->p_dma.ebus_info.flags =EBUS_DMA_FLAG_USE_EBDMA_HANDLER ; chip->p_dma.ebus_info.callback = snd_cs4231_ebus_play_callback; chip->p_dma.ebus_info.client_cookie = chip; - chip->p_dma.ebus_info.irq = op->irqs[1 ]; + chip->p_dma.ebus_info.irq = op->archdata.irqs[1 ]; chip->p_dma.prepare = _ebus_dma_prepare; chip->p_dma.enable = _ebus_dma_enable;
@@ -2060,7 +2060,7 @@ static int __devinit cs4231_ebus_probe(struct of_device *op, const struct of_devsprintf (card->longname,"%s at 0x%llx, irq %d" , card->shortname, op->resource[0 ].start, - op->irqs[0 ]); + op->archdata.irqs[0 ]); err =snd_cs4231_ebus_create (card, op, dev);if (err <0 ) {
sound/sparc/dbri.c +1 -1
@@ -2608,7 +2608,7 @@ static int __devinit dbri_probe(struct of_device *op, const struct of_device_idreturn -ENOENT ; } - irq = op->irqs[0 ]; + irq = op->archdata.irqs[0 ];if (irq <=0 ) {printk (KERN_ERR "DBRI-%d: No IRQ.\n" , dev);return -ENODEV ;
From: Grant Likely <[email protected]>
Date: Fri, 04 Jun 2010 15:11:33 -0600
Quoted 17 lines
This patch moves SPARC architecture specific data members out of struct
of_deviceand into thepdev_archdatastructure. The reason for this change is to unify the structof_devicedefinition amongst all the architectures. It also remvoes the .sysdata, .slot, .portid and .clock_freq properties because they aren't actually used by anything.A subsequent patch will replace struct
of_deviceentirely with structplatform_deviceand theof_platformsupport code will share common routines with the platform bus (but the bus instances themselves can remain separate).This patch also adds 'struct resources *resource' and
num_resourcesto match the fields defined in structplatform_device. After this change, 'structplatform_device' can be used as a drop-in replacement for 'structof_platform'.
Quoted 4 lines
This change is in preparation for merging the
of_platform_bus_typewith theplatform_bus_type.Signed-off-by Grant Likely <[email protected]>
PATCH 2/2 of: kill struct of_device
In reply to a message not in the archiveNow that the device tree node pointer has been moved out of struct of_device and into the common struct device, there isn't anything unique about of_device anymore. In fact, there isn't much need for a separate of_bus when all busses have access to OF style probing.
arch/powerpc and arch/microblaze are moving away from using the of_bus and using the regular platform bus instead for mmio devices. This patch makes of_device the same as platform_device as a stepping stone in migrating of_platform_drivers over to the platform bus.
--- arch/microblaze/include/asm/of_device.h | 10 ---------- arch/powerpc/include/asm/of_device.h | 11 ----------- arch/powerpc/include/asm/smu.h | 4 ++-- arch/sparc/include/asm/device.h | 4 ++-- arch/sparc/include/asm/of_device.h | 14 -------------- drivers/net/niu.h | 4 ++-- include/linux/of_device.h | 17 +++++++++++++++++ 7 files changed, 23 insertions(+), 41 deletions(-)
arch/microblaze/include/asm/of_device.h +0 -10
@@ -15,16 +15,6 @@#include <linux/device.h> #include <linux/of.h> -/* -* The of_device is a kind of "base class" that is a superset of -* struct device for use by devices attached to an OF node and -* probed using OF properties. -*/ -struct of_device { -struct device dev;/* Generic device interface */ -struct pdev_archdata archdata; -}; -extern ssize_t of_device_get_modalias (struct of_device *ofdev,char *str,ssize_t len);
arch/powerpc/include/asm/of_device.h +0 -11
@@ -5,17 +5,6 @@#include <linux/device.h> #include <linux/of.h> -/* -* The of_device is a kind of "base class" that is a superset of -* struct device for use by devices attached to an OF node and -* probed using OF properties. -*/ -struct of_device -{ -struct device dev;/* Generic device interface */ -struct pdev_archdata archdata; -}; -extern struct of_device *of_device_alloc (struct device_node *np,const char *bus_id,struct device *parent);
arch/powerpc/include/asm/smu.h +2 -2
@@ -457,8 +457,8 @@ extern void smu_poll(void);*/ extern int smu_init (void );extern int smu_present (void ); -struct of_device ; -extern struct of_device *smu_get_ofdev (void ); +struct platform_device ; +extern struct platform_device *smu_get_ofdev (void );/*
arch/sparc/include/asm/device.h +2 -2
@@ -9,13 +9,13 @@#include <asm/openprom.h> struct device_node ; -struct of_device ; +struct platform_device ;struct dev_archdata {void *iommu;void *stc;void *host_controller; -struct of_device *op; +struct platform_device *op;int numa_node; };
arch/sparc/include/asm/of_device.h +0 -14
@@ -7,20 +7,6 @@#include <linux/mod_devicetable.h> #include <asm/openprom.h> -/* -* The of_device is a kind of "base class" that is a superset of -* struct device for use by devices attached to an OF node and -* probed using OF properties. -*/ -struct of_device -{ -struct device dev; -u32 num_resources; -struct resource *resource; - -struct pdev_archdata archdata; -}; -extern void __iomem *of_ioremap (struct resource *res,unsigned long offset,unsigned long size,char *name);extern void of_iounmap (struct resource *res,void __iomem *base,unsigned long size);
drivers/net/niu.h +2 -2
@@ -3236,7 +3236,7 @@ struct niu_phy_ops {int (*link_status)(struct niu *np,int *); }; -struct of_device ; +struct platform_device ;struct niu {void __iomem *regs;struct net_device *dev;
@@ -3297,7 +3297,7 @@ struct niu {struct niu_vpd vpd;u32 eeprom_len; -struct of_device *op; +struct platform_device *op;void __iomem *vir_regs_1;void __iomem *vir_regs_2; };
include/linux/of_device.h +17 -0
@@ -3,9 +3,26 @@#ifdef CONFIG_OF_DEVICE #include <linux/device.h> +#include <linux/platform_device.h> #include <linux/of.h> #include <linux/mod_devicetable.h> + +/* +* The of_device *was* a kind of "base class" that was a superset of +* struct device for use by devices attached to an OF node and probed +* using OF properties. However, the important bit of OF-style +* probing, namely the device node pointer, has been moved into the +* common struct device when CONFIG_OF is set to make OF-style probing +* available to all bus types. So now, just make of_device and +* platform_device equivalent so that current of_platform bus users +* can be transparently migrated over to using the platform bus. +* +* This line will go away once all references to of_device are removed +* from the kernel. +*/ +#define of_device platform_device +#include <asm/of_device.h> #define to_of_device (d) container_of(d, struct of_device, dev)
Re: [PATCH 2/2] of: kill struct of_device
From: Grant Likely <[email protected]>
Date: Fri, 04 Jun 2010 15:11:38 -0600
Quoted 6 lines
Now that the device tree node pointer has been moved out of struct
of_deviceand into the common struct device, there isn't anything unique aboutof_deviceanymore. In fact, there isn't much need for a separateof_buswhen all busses have access to OF style probing.
Quoted 6 lines
arch/powerpcandarch/microblazeare moving away from using theof_busand using the regular platform bus instead for mmio devices. This patch makesof_devicethe same asplatform_deviceas a stepping stone in migratingof_platform_driversover to the platform bus.Signed-off-by Grant Likely <[email protected]>
cover Replace of_device with platform_device
In reply to a message not in the archiveThis series is based on Linus' current tree. It eliminate struct of_device in preparation for the merge of of_platform_bus_type and platform_bus_type.
Assuming there are no objections, I'll be putting these to linux-next to stew sometime next week.
g.
---
Grant Likely (2):
sparc/of: Move of_device fields into struct pdev_archdata
of: kill struct of_device
arch/microblaze/include/asm/of_device.h | 10 ---------- arch/powerpc/include/asm/of_device.h | 11 ----------- arch/powerpc/include/asm/smu.h | 4 ++-- arch/sparc/include/asm/device.h | 9 +++++++-- arch/sparc/include/asm/floppy_64.h | 4 ++-- arch/sparc/include/asm/of_device.h | 19 -------------------
arch/sparc/include/asm/parport.h | 4 ++-- arch/sparc/kernel/of_device_32.c | 28 ++++++++++++---------------- arch/sparc/kernel/of_device_64.c | 24 ++++++++++-------------- arch/sparc/kernel/of_device_common.c | 4 ++-- arch/sparc/kernel/pci.c | 2 +- arch/sparc/kernel/pci_psycho.c | 8 ++++---- arch/sparc/kernel/pci_sabre.c | 8 ++++---- arch/sparc/kernel/pci_schizo.c | 20 ++++++++++----------
arch/sparc/kernel/power.c | 2 +- drivers/atm/fore200e.c | 2 +- drivers/input/serio/i8042-sparcio.h | 8 ++++---- drivers/net/myri_sbus.c | 2 +- drivers/net/niu.c | 6 +++--- drivers/net/niu.h | 4 ++-- drivers/net/sunbmac.c | 2 +- drivers/net/sunhme.c | 6 +++--- drivers/net/sunlance.c | 2 +- drivers/net/sunqe.c | 6 +++--- drivers/parport/parport_sunbpp.c | 2 +- drivers/sbus/char/bbc_i2c.c | 6 +++--- drivers/sbus/char/uctrl.c | 2 +- drivers/scsi/qlogicpti.c | 4 ++-- drivers/scsi/sun_esp.c | 2 +- drivers/serial/sunhv.c | 4 ++-- drivers/serial/sunsab.c | 2 +- drivers/serial/sunsu.c | 2 +- drivers/serial/sunzilog.c | 10 +++++----- drivers/watchdog/cpwd.c | 2 +- include/linux/of_device.h | 17 +++++++++++++++++ sound/sparc/amd7930.c | 2 +- sound/sparc/cs4231.c | 14 +++++++------- sound/sparc/dbri.c | 2 +-
38 files changed, 120 insertions(+), 146 deletions(-)
--
Signature
Signature · 2 lines
Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd.
Re: [PATCH 0/2] Replace of_device with platform_device
Quoted 6 lines · Grant Likely
This series is based on Linus' current tree. It eliminate struct
of_devicein preparation for the merge ofof_platform_bus_typeandplatform_bus_type.Assuming there are no objections, I'll be putting these to linux-next to stew sometime next week.
I don't see any update to the macio stuff... have you fixed that separately or are you up to breaking it -again- ? :-)
You should do build tests with a pmac32 or g5 defconfig every now and then.
Cheers,
Ben.
Re: [PATCH 0/2] Replace of_device with platform_device
Quoted 10 lines · Benjamin Herrenschmidt
Quoted 6 lines · Grant Likely
This series is based on Linus' current tree. It eliminate struct
of_devicein preparation for the merge ofof_platform_bus_typeandplatform_bus_type.Assuming there are no objections, I'll be putting these to linux-next to stew sometime next week.
I don't see any update to the macio stuff... have you fixed that separately or are you up to breaking it -again- ? :-)
It shouldn't need any fixing because I'm not touching the driver side of the equation (unlike the last breakage where macio_driver had its own copy of the match table which I missed). In fact, there aren't even any logic changes other than dealing with moving some of the structure members in the sparc arch code. If I did miss anything, then it should show up in build testing.
I will try to dig out an mac machine and fire it up though.
Quoted 3 lines
You should do build tests with a pmac32 or g5 defconfig every now and then.
I frequently build tested on many platforms:
http://kisskb.ellerman.id.au/kisskb/branch/13/
g.
Signature · 2 lines
Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd.
Re: [PATCH 0/2] Replace of_device with platform_device
Quoted 7 lines · Grant Likely
It shouldn't need any fixing because I'm not touching the driver side of the equation (unlike the last breakage where
macio_driverhad its own copy of the match table which I missed). In fact, there aren't even any logic changes other than dealing with moving some of the structure members in the sparc arch code. If I did miss anything, then it should show up in build testing.
Ok, but I though you were actually replacing occurences of "of_device" with "platform_device", and so was wondering why you aren't changing the ones in macio. But yes, the #define you did might do the trick as long as the resources are still named the same etc...
Cheers,
Ben.
Re: [PATCH 0/2] Replace of_device with platform_device
Quoted 9 lines · Benjamin Herrenschmidt
Quoted 7 lines · Grant Likely
It shouldn't need any fixing because I'm not touching the driver side of the equation (unlike the last breakage where
macio_driverhad its own copy of the match table which I missed). In fact, there aren't even any logic changes other than dealing with moving some of the structure members in the sparc arch code. If I did miss anything, then it should show up in build testing.
Quoted 4 lines
Ok, but I though you were actually replacing occurences of "
of_device" with "platform_device", and so was wondering why you aren't changing the ones in macio. But yes, the #define you did might do the trick as long as the resources are still named the same etc...
I will, but it is a big job, so the #define lets me do it in chunks. I made sure the member names in of_device were identical to platform_device so that it works as a drop-in.
g.