Skip to content

Commit aaa24ee

Browse files
Bartosz Golaszewskigregkh
authored andcommitted
gpiolib: rename GPIO chip printk macros
[ Upstream commit d4f335b ] The chip_$level() macros take struct gpio_chip as argument so make it follow the convention of using the 'gpiochip_' prefix. Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Stable-dep-of: a7ac22d ("gpiolib: fix race condition for gdev->srcu") Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 97531f8 commit aaa24ee

4 files changed

Lines changed: 45 additions & 47 deletions

File tree

drivers/gpio/gpiolib-cdev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2828,7 +2828,7 @@ int gpiolib_cdev_register(struct gpio_device *gdev, dev_t devt)
28282828
if (!gc)
28292829
return -ENODEV;
28302830

2831-
chip_dbg(gc, "added GPIO chardev (%d:%d)\n", MAJOR(devt), gdev->id);
2831+
gpiochip_dbg(gc, "added GPIO chardev (%d:%d)\n", MAJOR(devt), gdev->id);
28322832

28332833
return 0;
28342834
}

drivers/gpio/gpiolib-sysfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1091,7 +1091,7 @@ static int gpiofind_sysfs_register(struct gpio_chip *gc, const void *data)
10911091

10921092
ret = gpiochip_sysfs_register(gdev);
10931093
if (ret)
1094-
chip_err(gc, "failed to register the sysfs entry: %d\n", ret);
1094+
gpiochip_err(gc, "failed to register the sysfs entry: %d\n", ret);
10951095

10961096
return 0;
10971097
}

drivers/gpio/gpiolib.c

Lines changed: 39 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -921,8 +921,8 @@ static void gpiochip_machine_hog(struct gpio_chip *gc, struct gpiod_hog *hog)
921921

922922
desc = gpiochip_get_desc(gc, hog->chip_hwnum);
923923
if (IS_ERR(desc)) {
924-
chip_err(gc, "%s: unable to get GPIO desc: %ld\n", __func__,
925-
PTR_ERR(desc));
924+
gpiochip_err(gc, "%s: unable to get GPIO desc: %ld\n",
925+
__func__, PTR_ERR(desc));
926926
return;
927927
}
928928

@@ -1124,7 +1124,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
11241124

11251125
ret = gpiodev_add_to_list_unlocked(gdev);
11261126
if (ret) {
1127-
chip_err(gc, "GPIO integer space overlap, cannot add chip\n");
1127+
gpiochip_err(gc, "GPIO integer space overlap, cannot add chip\n");
11281128
goto err_free_label;
11291129
}
11301130
}
@@ -1528,8 +1528,7 @@ static void gpiochip_set_hierarchical_irqchip(struct gpio_chip *gc,
15281528
&parent_hwirq,
15291529
&parent_type);
15301530
if (ret) {
1531-
chip_err(gc, "skip set-up on hwirq %d\n",
1532-
i);
1531+
gpiochip_err(gc, "skip set-up on hwirq %d\n", i);
15331532
continue;
15341533
}
15351534

@@ -1542,15 +1541,14 @@ static void gpiochip_set_hierarchical_irqchip(struct gpio_chip *gc,
15421541
ret = irq_domain_alloc_irqs(gc->irq.domain, 1,
15431542
NUMA_NO_NODE, &fwspec);
15441543
if (ret < 0) {
1545-
chip_err(gc,
1546-
"can not allocate irq for GPIO line %d parent hwirq %d in hierarchy domain: %d\n",
1547-
i, parent_hwirq,
1548-
ret);
1544+
gpiochip_err(gc,
1545+
"can not allocate irq for GPIO line %d parent hwirq %d in hierarchy domain: %d\n",
1546+
i, parent_hwirq, ret);
15491547
}
15501548
}
15511549
}
15521550

1553-
chip_err(gc, "%s unknown fwnode type proceed anyway\n", __func__);
1551+
gpiochip_err(gc, "%s unknown fwnode type proceed anyway\n", __func__);
15541552

15551553
return;
15561554
}
@@ -1602,15 +1600,15 @@ static int gpiochip_hierarchy_irq_domain_alloc(struct irq_domain *d,
16021600
if (ret)
16031601
return ret;
16041602

1605-
chip_dbg(gc, "allocate IRQ %d, hwirq %lu\n", irq, hwirq);
1603+
gpiochip_dbg(gc, "allocate IRQ %d, hwirq %lu\n", irq, hwirq);
16061604

16071605
ret = girq->child_to_parent_hwirq(gc, hwirq, type,
16081606
&parent_hwirq, &parent_type);
16091607
if (ret) {
1610-
chip_err(gc, "can't look up hwirq %lu\n", hwirq);
1608+
gpiochip_err(gc, "can't look up hwirq %lu\n", hwirq);
16111609
return ret;
16121610
}
1613-
chip_dbg(gc, "found parent hwirq %u\n", parent_hwirq);
1611+
gpiochip_dbg(gc, "found parent hwirq %u\n", parent_hwirq);
16141612

16151613
/*
16161614
* We set handle_bad_irq because the .set_type() should
@@ -1631,8 +1629,8 @@ static int gpiochip_hierarchy_irq_domain_alloc(struct irq_domain *d,
16311629
if (ret)
16321630
return ret;
16331631

1634-
chip_dbg(gc, "alloc_irqs_parent for %d parent hwirq %d\n",
1635-
irq, parent_hwirq);
1632+
gpiochip_dbg(gc, "alloc_irqs_parent for %d parent hwirq %d\n",
1633+
irq, parent_hwirq);
16361634
irq_set_lockdep_class(irq, gc->irq.lock_key, gc->irq.request_key);
16371635
ret = irq_domain_alloc_irqs_parent(d, irq, 1, &gpio_parent_fwspec);
16381636
/*
@@ -1642,9 +1640,9 @@ static int gpiochip_hierarchy_irq_domain_alloc(struct irq_domain *d,
16421640
if (irq_domain_is_msi(d->parent) && (ret == -EEXIST))
16431641
ret = 0;
16441642
if (ret)
1645-
chip_err(gc,
1646-
"failed to allocate parent hwirq %d for hwirq %lu\n",
1647-
parent_hwirq, hwirq);
1643+
gpiochip_err(gc,
1644+
"failed to allocate parent hwirq %d for hwirq %lu\n",
1645+
parent_hwirq, hwirq);
16481646

16491647
return ret;
16501648
}
@@ -1720,7 +1718,7 @@ static struct irq_domain *gpiochip_hierarchy_create_domain(struct gpio_chip *gc)
17201718

17211719
if (!gc->irq.child_to_parent_hwirq ||
17221720
!gc->irq.fwnode) {
1723-
chip_err(gc, "missing irqdomain vital data\n");
1721+
gpiochip_err(gc, "missing irqdomain vital data\n");
17241722
return ERR_PTR(-EINVAL);
17251723
}
17261724

@@ -1993,7 +1991,7 @@ static void gpiochip_set_irq_hooks(struct gpio_chip *gc)
19931991
if (irqchip->flags & IRQCHIP_IMMUTABLE)
19941992
return;
19951993

1996-
chip_warn(gc, "not an immutable chip, please consider fixing it!\n");
1994+
gpiochip_warn(gc, "not an immutable chip, please consider fixing it!\n");
19971995

19981996
if (!irqchip->irq_request_resources &&
19991997
!irqchip->irq_release_resources) {
@@ -2009,8 +2007,8 @@ static void gpiochip_set_irq_hooks(struct gpio_chip *gc)
20092007
* ...and if so, give a gentle warning that this is bad
20102008
* practice.
20112009
*/
2012-
chip_info(gc,
2013-
"detected irqchip that is shared with multiple gpiochips: please fix the driver.\n");
2010+
gpiochip_info(gc,
2011+
"detected irqchip that is shared with multiple gpiochips: please fix the driver.\n");
20142012
return;
20152013
}
20162014

@@ -2039,7 +2037,8 @@ static int gpiochip_irqchip_add_allocated_domain(struct gpio_chip *gc,
20392037
return -EINVAL;
20402038

20412039
if (gc->to_irq)
2042-
chip_warn(gc, "to_irq is redefined in %s and you shouldn't rely on it\n", __func__);
2040+
gpiochip_warn(gc, "to_irq is redefined in %s and you shouldn't rely on it\n",
2041+
__func__);
20432042

20442043
gc->to_irq = gpiochip_to_irq;
20452044
gc->irq.domain = domain;
@@ -2080,7 +2079,7 @@ static int gpiochip_add_irqchip(struct gpio_chip *gc,
20802079
return 0;
20812080

20822081
if (gc->irq.parent_handler && gc->can_sleep) {
2083-
chip_err(gc, "you cannot have chained interrupts on a chip that may sleep\n");
2082+
gpiochip_err(gc, "you cannot have chained interrupts on a chip that may sleep\n");
20842083
return -EINVAL;
20852084
}
20862085

@@ -2336,7 +2335,7 @@ int gpiochip_add_pingroup_range(struct gpio_chip *gc,
23362335

23372336
pinctrl_add_gpio_range(pctldev, &pin_range->range);
23382337

2339-
chip_dbg(gc, "created GPIO range %d->%d ==> %s PINGRP %s\n",
2338+
gpiochip_dbg(gc, "created GPIO range %d->%d ==> %s PINGRP %s\n",
23402339
gpio_offset, gpio_offset + pin_range->range.npins - 1,
23412340
pinctrl_dev_get_devname(pctldev), pin_group);
23422341

@@ -2392,19 +2391,18 @@ int gpiochip_add_pin_range_with_pins(struct gpio_chip *gc,
23922391
&pin_range->range);
23932392
if (IS_ERR(pin_range->pctldev)) {
23942393
ret = PTR_ERR(pin_range->pctldev);
2395-
chip_err(gc, "could not create pin range\n");
2394+
gpiochip_err(gc, "could not create pin range\n");
23962395
kfree(pin_range);
23972396
return ret;
23982397
}
23992398
if (pin_range->range.pins)
2400-
chip_dbg(gc, "created GPIO range %d->%d ==> %s %d sparse PIN range { %d, ... }",
2401-
gpio_offset, gpio_offset + npins - 1,
2402-
pinctl_name, npins, pins[0]);
2399+
gpiochip_dbg(gc, "created GPIO range %d->%d ==> %s %d sparse PIN range { %d, ... }",
2400+
gpio_offset, gpio_offset + npins - 1,
2401+
pinctl_name, npins, pins[0]);
24032402
else
2404-
chip_dbg(gc, "created GPIO range %d->%d ==> %s PIN %d->%d\n",
2405-
gpio_offset, gpio_offset + npins - 1,
2406-
pinctl_name,
2407-
pin_offset, pin_offset + npins - 1);
2403+
gpiochip_dbg(gc, "created GPIO range %d->%d ==> %s PIN %d->%d\n",
2404+
gpio_offset, gpio_offset + npins - 1, pinctl_name,
2405+
pin_offset, pin_offset + npins - 1);
24082406

24092407
list_add_tail(&pin_range->node, &gdev->pin_ranges);
24102408

@@ -2614,7 +2612,7 @@ struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *gc,
26142612
int ret;
26152613

26162614
if (IS_ERR(desc)) {
2617-
chip_err(gc, "failed to get GPIO %s descriptor\n", name);
2615+
gpiochip_err(gc, "failed to get GPIO %s descriptor\n", name);
26182616
return desc;
26192617
}
26202618

@@ -2625,7 +2623,7 @@ struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *gc,
26252623
ret = gpiod_configure_flags(desc, label, lflags, dflags);
26262624
if (ret) {
26272625
gpiod_free_commit(desc);
2628-
chip_err(gc, "setup of own GPIO %s failed\n", name);
2626+
gpiochip_err(gc, "setup of own GPIO %s failed\n", name);
26292627
return ERR_PTR(ret);
26302628
}
26312629

@@ -4052,18 +4050,18 @@ int gpiochip_lock_as_irq(struct gpio_chip *gc, unsigned int offset)
40524050
int dir = gpiod_get_direction(desc);
40534051

40544052
if (dir < 0) {
4055-
chip_err(gc, "%s: cannot get GPIO direction\n",
4056-
__func__);
4053+
gpiochip_err(gc, "%s: cannot get GPIO direction\n",
4054+
__func__);
40574055
return dir;
40584056
}
40594057
}
40604058

40614059
/* To be valid for IRQ the line needs to be input or open drain */
40624060
if (test_bit(GPIOD_FLAG_IS_OUT, &desc->flags) &&
40634061
!test_bit(GPIOD_FLAG_OPEN_DRAIN, &desc->flags)) {
4064-
chip_err(gc,
4065-
"%s: tried to flag a GPIO set as output for IRQ\n",
4066-
__func__);
4062+
gpiochip_err(gc,
4063+
"%s: tried to flag a GPIO set as output for IRQ\n",
4064+
__func__);
40674065
return -EIO;
40684066
}
40694067

@@ -4140,7 +4138,7 @@ int gpiochip_reqres_irq(struct gpio_chip *gc, unsigned int offset)
41404138

41414139
ret = gpiochip_lock_as_irq(gc, offset);
41424140
if (ret) {
4143-
chip_err(gc, "unable to lock HW IRQ %u for IRQ\n", offset);
4141+
gpiochip_err(gc, "unable to lock HW IRQ %u for IRQ\n", offset);
41444142
module_put(gc->gpiodev->owner);
41454143
return ret;
41464144
}

drivers/gpio/gpiolib.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,13 +309,13 @@ do { \
309309

310310
/* With chip prefix */
311311

312-
#define chip_err(gc, fmt, ...) \
312+
#define gpiochip_err(gc, fmt, ...) \
313313
dev_err(&gc->gpiodev->dev, "(%s): " fmt, gc->label, ##__VA_ARGS__)
314-
#define chip_warn(gc, fmt, ...) \
314+
#define gpiochip_warn(gc, fmt, ...) \
315315
dev_warn(&gc->gpiodev->dev, "(%s): " fmt, gc->label, ##__VA_ARGS__)
316-
#define chip_info(gc, fmt, ...) \
316+
#define gpiochip_info(gc, fmt, ...) \
317317
dev_info(&gc->gpiodev->dev, "(%s): " fmt, gc->label, ##__VA_ARGS__)
318-
#define chip_dbg(gc, fmt, ...) \
318+
#define gpiochip_dbg(gc, fmt, ...) \
319319
dev_dbg(&gc->gpiodev->dev, "(%s): " fmt, gc->label, ##__VA_ARGS__)
320320

321321
#endif /* GPIOLIB_H */

0 commit comments

Comments
 (0)