Skip to content

Commit bced554

Browse files
inochisaKAGA-KOKO
authored andcommitted
irqchip/sg2042-msi: Rename functions and data structures to be SG2042 agnostic
As the driver logic can be used in both SG2042 and SG2044 SoCs, rename functions and data structures, which are not SG2042 specific, to SG204x*. Signed-off-by: Inochi Amaoto <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Chen Wang <[email protected]> # SG2042 Reviewed-by: Chen Wang <[email protected]> Link: https://lore.kernel.org/all/[email protected]
1 parent 9fe5a07 commit bced554

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

drivers/irqchip/irq-sg2042-msi.c

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
#define SG2042_MAX_MSI_VECTOR 32
2323

24-
struct sg2042_msi_chipdata {
24+
struct sg204x_msi_chipdata {
2525
void __iomem *reg_clr; // clear reg, see TRM, 10.1.33, GP_INTR0_CLR
2626

2727
phys_addr_t doorbell_addr; // see TRM, 10.1.32, GP_INTR0_SET
@@ -33,7 +33,7 @@ struct sg2042_msi_chipdata {
3333
struct mutex msi_map_lock; // lock for msi_map
3434
};
3535

36-
static int sg2042_msi_allocate_hwirq(struct sg2042_msi_chipdata *data, int num_req)
36+
static int sg204x_msi_allocate_hwirq(struct sg204x_msi_chipdata *data, int num_req)
3737
{
3838
int first;
3939

@@ -43,15 +43,15 @@ static int sg2042_msi_allocate_hwirq(struct sg2042_msi_chipdata *data, int num_r
4343
return first >= 0 ? first : -ENOSPC;
4444
}
4545

46-
static void sg2042_msi_free_hwirq(struct sg2042_msi_chipdata *data, int hwirq, int num_req)
46+
static void sg204x_msi_free_hwirq(struct sg204x_msi_chipdata *data, int hwirq, int num_req)
4747
{
4848
guard(mutex)(&data->msi_map_lock);
4949
bitmap_release_region(data->msi_map, hwirq, get_count_order(num_req));
5050
}
5151

5252
static void sg2042_msi_irq_ack(struct irq_data *d)
5353
{
54-
struct sg2042_msi_chipdata *data = irq_data_get_irq_chip_data(d);
54+
struct sg204x_msi_chipdata *data = irq_data_get_irq_chip_data(d);
5555
int bit_off = d->hwirq;
5656

5757
writel(1 << bit_off, data->reg_clr);
@@ -61,7 +61,7 @@ static void sg2042_msi_irq_ack(struct irq_data *d)
6161

6262
static void sg2042_msi_irq_compose_msi_msg(struct irq_data *d, struct msi_msg *msg)
6363
{
64-
struct sg2042_msi_chipdata *data = irq_data_get_irq_chip_data(d);
64+
struct sg204x_msi_chipdata *data = irq_data_get_irq_chip_data(d);
6565

6666
msg->address_hi = upper_32_bits(data->doorbell_addr);
6767
msg->address_lo = lower_32_bits(data->doorbell_addr);
@@ -79,9 +79,9 @@ static const struct irq_chip sg2042_msi_middle_irq_chip = {
7979
.irq_compose_msi_msg = sg2042_msi_irq_compose_msi_msg,
8080
};
8181

82-
static int sg2042_msi_parent_domain_alloc(struct irq_domain *domain, unsigned int virq, int hwirq)
82+
static int sg204x_msi_parent_domain_alloc(struct irq_domain *domain, unsigned int virq, int hwirq)
8383
{
84-
struct sg2042_msi_chipdata *data = domain->host_data;
84+
struct sg204x_msi_chipdata *data = domain->host_data;
8585
struct irq_fwspec fwspec;
8686
struct irq_data *d;
8787
int ret;
@@ -99,18 +99,18 @@ static int sg2042_msi_parent_domain_alloc(struct irq_domain *domain, unsigned in
9999
return d->chip->irq_set_type(d, IRQ_TYPE_EDGE_RISING);
100100
}
101101

102-
static int sg2042_msi_middle_domain_alloc(struct irq_domain *domain, unsigned int virq,
102+
static int sg204x_msi_middle_domain_alloc(struct irq_domain *domain, unsigned int virq,
103103
unsigned int nr_irqs, void *args)
104104
{
105-
struct sg2042_msi_chipdata *data = domain->host_data;
105+
struct sg204x_msi_chipdata *data = domain->host_data;
106106
int hwirq, err, i;
107107

108-
hwirq = sg2042_msi_allocate_hwirq(data, nr_irqs);
108+
hwirq = sg204x_msi_allocate_hwirq(data, nr_irqs);
109109
if (hwirq < 0)
110110
return hwirq;
111111

112112
for (i = 0; i < nr_irqs; i++) {
113-
err = sg2042_msi_parent_domain_alloc(domain, virq + i, hwirq + i);
113+
err = sg204x_msi_parent_domain_alloc(domain, virq + i, hwirq + i);
114114
if (err)
115115
goto err_hwirq;
116116

@@ -121,25 +121,25 @@ static int sg2042_msi_middle_domain_alloc(struct irq_domain *domain, unsigned in
121121
return 0;
122122

123123
err_hwirq:
124-
sg2042_msi_free_hwirq(data, hwirq, nr_irqs);
124+
sg204x_msi_free_hwirq(data, hwirq, nr_irqs);
125125
irq_domain_free_irqs_parent(domain, virq, i);
126126

127127
return err;
128128
}
129129

130-
static void sg2042_msi_middle_domain_free(struct irq_domain *domain, unsigned int virq,
130+
static void sg204x_msi_middle_domain_free(struct irq_domain *domain, unsigned int virq,
131131
unsigned int nr_irqs)
132132
{
133133
struct irq_data *d = irq_domain_get_irq_data(domain, virq);
134-
struct sg2042_msi_chipdata *data = irq_data_get_irq_chip_data(d);
134+
struct sg204x_msi_chipdata *data = irq_data_get_irq_chip_data(d);
135135

136136
irq_domain_free_irqs_parent(domain, virq, nr_irqs);
137-
sg2042_msi_free_hwirq(data, d->hwirq, nr_irqs);
137+
sg204x_msi_free_hwirq(data, d->hwirq, nr_irqs);
138138
}
139139

140-
static const struct irq_domain_ops sg2042_msi_middle_domain_ops = {
141-
.alloc = sg2042_msi_middle_domain_alloc,
142-
.free = sg2042_msi_middle_domain_free,
140+
static const struct irq_domain_ops sg204x_msi_middle_domain_ops = {
141+
.alloc = sg204x_msi_middle_domain_alloc,
142+
.free = sg204x_msi_middle_domain_free,
143143
.select = msi_lib_irq_domain_select,
144144
};
145145

@@ -157,14 +157,14 @@ static const struct msi_parent_ops sg2042_msi_parent_ops = {
157157
.init_dev_msi_info = msi_lib_init_dev_msi_info,
158158
};
159159

160-
static int sg2042_msi_init_domains(struct sg2042_msi_chipdata *data,
160+
static int sg204x_msi_init_domains(struct sg204x_msi_chipdata *data,
161161
struct irq_domain *plic_domain, struct device *dev)
162162
{
163163
struct fwnode_handle *fwnode = dev_fwnode(dev);
164164
struct irq_domain *middle_domain;
165165

166166
middle_domain = irq_domain_create_hierarchy(plic_domain, 0, data->num_irqs, fwnode,
167-
&sg2042_msi_middle_domain_ops, data);
167+
&sg204x_msi_middle_domain_ops, data);
168168
if (!middle_domain) {
169169
pr_err("Failed to create the MSI middle domain\n");
170170
return -ENOMEM;
@@ -181,13 +181,13 @@ static int sg2042_msi_init_domains(struct sg2042_msi_chipdata *data,
181181
static int sg2042_msi_probe(struct platform_device *pdev)
182182
{
183183
struct fwnode_reference_args args = { };
184-
struct sg2042_msi_chipdata *data;
184+
struct sg204x_msi_chipdata *data;
185185
struct device *dev = &pdev->dev;
186186
struct irq_domain *plic_domain;
187187
struct resource *res;
188188
int ret;
189189

190-
data = devm_kzalloc(dev, sizeof(struct sg2042_msi_chipdata), GFP_KERNEL);
190+
data = devm_kzalloc(dev, sizeof(struct sg204x_msi_chipdata), GFP_KERNEL);
191191
if (!data)
192192
return -ENOMEM;
193193

@@ -231,7 +231,7 @@ static int sg2042_msi_probe(struct platform_device *pdev)
231231

232232
mutex_init(&data->msi_map_lock);
233233

234-
return sg2042_msi_init_domains(data, plic_domain, dev);
234+
return sg204x_msi_init_domains(data, plic_domain, dev);
235235
}
236236

237237
static const struct of_device_id sg2042_msi_of_match[] = {

0 commit comments

Comments
 (0)