Message ID | 20190905105042.27526-2-oohall@gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | [v3,1/4] hw/psi: Add chip ID to interrupt names | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | Successfully applied on branch master (7b12d5489fcfd73ef7ec0cb27eff7f8a5f13b238) |
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot | success | Test snowpatch/job/snowpatch-skiboot on branch master |
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot-dco | success | Signed-off-by present |
On 05/09/2019 12:50, Oliver O'Halloran wrote: > The array of P9 PSI interrupt names is currently a static constant > inside psi_p9_irq_name(). We'd like to use these names in another > function so move it outside. > > Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Reviewed-by: Cédric Le Goater <clg@kaod.org> Thanks, C. > --- > hw/psi.c | 38 +++++++++++++++++++------------------- > 1 file changed, 19 insertions(+), 19 deletions(-) > > diff --git a/hw/psi.c b/hw/psi.c > index a54b503ce463..70cf120a8397 100644 > --- a/hw/psi.c > +++ b/hw/psi.c > @@ -514,6 +514,23 @@ static const struct irq_source_ops psi_p8_irq_ops = { > .name = psi_p8_irq_name, > }; > > +static const char *psi_p9_irq_names[P9_PSI_NUM_IRQS] = { > + "fsp", > + "occ", > + "fsi", > + "lpchc", > + "local_err", > + "global_err", > + "external", > + "lpc_serirq_mux0", /* Have a callback to get name ? */ > + "lpc_serirq_mux1", /* Have a callback to get name ? */ > + "lpc_serirq_mux2", /* Have a callback to get name ? */ > + "lpc_serirq_mux3", /* Have a callback to get name ? */ > + "i2c", > + "dio", > + "psu" > +}; > + > static void psihb_p9_interrupt(struct irq_source *is, uint32_t isn) > { > struct psi *psi = is->data; > @@ -594,28 +611,11 @@ static char *psi_p9_irq_name(struct irq_source *is, uint32_t isn) > uint32_t idx = isn - psi->interrupt; > char tmp[30]; > > - static const char *names[P9_PSI_NUM_IRQS] = { > - "fsp", > - "occ", > - "fsi", > - "lpchc", > - "local_err", > - "global_err", > - "external", > - "lpc_serirq_mux0", /* Have a callback to get name ? */ > - "lpc_serirq_mux1", /* Have a callback to get name ? */ > - "lpc_serirq_mux2", /* Have a callback to get name ? */ > - "lpc_serirq_mux3", /* Have a callback to get name ? */ > - "i2c", > - "dio", > - "psu" > - }; > - > - if (idx >= ARRAY_SIZE(names)) > + if (idx >= ARRAY_SIZE(psi_p9_irq_names)) > return NULL; > > snprintf(tmp, sizeof(tmp), "psi#%x:%s", > - psi->chip_id, names[idx]); > + psi->chip_id, psi_p9_irq_names[idx]); > > return strdup(tmp); > } >
diff --git a/hw/psi.c b/hw/psi.c index a54b503ce463..70cf120a8397 100644 --- a/hw/psi.c +++ b/hw/psi.c @@ -514,6 +514,23 @@ static const struct irq_source_ops psi_p8_irq_ops = { .name = psi_p8_irq_name, }; +static const char *psi_p9_irq_names[P9_PSI_NUM_IRQS] = { + "fsp", + "occ", + "fsi", + "lpchc", + "local_err", + "global_err", + "external", + "lpc_serirq_mux0", /* Have a callback to get name ? */ + "lpc_serirq_mux1", /* Have a callback to get name ? */ + "lpc_serirq_mux2", /* Have a callback to get name ? */ + "lpc_serirq_mux3", /* Have a callback to get name ? */ + "i2c", + "dio", + "psu" +}; + static void psihb_p9_interrupt(struct irq_source *is, uint32_t isn) { struct psi *psi = is->data; @@ -594,28 +611,11 @@ static char *psi_p9_irq_name(struct irq_source *is, uint32_t isn) uint32_t idx = isn - psi->interrupt; char tmp[30]; - static const char *names[P9_PSI_NUM_IRQS] = { - "fsp", - "occ", - "fsi", - "lpchc", - "local_err", - "global_err", - "external", - "lpc_serirq_mux0", /* Have a callback to get name ? */ - "lpc_serirq_mux1", /* Have a callback to get name ? */ - "lpc_serirq_mux2", /* Have a callback to get name ? */ - "lpc_serirq_mux3", /* Have a callback to get name ? */ - "i2c", - "dio", - "psu" - }; - - if (idx >= ARRAY_SIZE(names)) + if (idx >= ARRAY_SIZE(psi_p9_irq_names)) return NULL; snprintf(tmp, sizeof(tmp), "psi#%x:%s", - psi->chip_id, names[idx]); + psi->chip_id, psi_p9_irq_names[idx]); return strdup(tmp); }
The array of P9 PSI interrupt names is currently a static constant inside psi_p9_irq_name(). We'd like to use these names in another function so move it outside. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> --- hw/psi.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-)