* [PATCH v2 0/5] gpio: rtd1625: minor cleanups and log improvements
@ 2026-08-14 2:56 Yu-Chun Lin
2026-08-14 2:56 ` [PATCH v2 1/5] gpio: rtd1625: Minor coding style cleanups Yu-Chun Lin
` (4 more replies)
0 siblings, 5 replies; 11+ messages in thread
From: Yu-Chun Lin @ 2026-08-14 2:56 UTC (permalink / raw)
To: linusw, brgl
Cc: andriy.shevchenko, linux-gpio, linux-kernel, tychang,
eleanor.lin, stanley_chang, cy.huang, james.tai
This series splits the previous cleanup patch into smaller, logical
pieces and addresses the review comments from Andy Shevchenko.
Link: https://lore.kernel.org/lkml/anUcSPcJjJkLh0Z-@ashevche-desk.local/
---
Changes in v2:
General:
- Split the v1 patch into a 5-patch series.
Patch 3:
- Add a blank line after the 'irq_hw_number_t hwirq' assignment.
Patch 4:
- Use regmap_get_device(), instead of adding 'struct device' pointer
into 'struct rtd1625_gpio'.
Link to v1: https://lore.kernel.org/lkml/20260812031929.3598364-1-eleanor.lin@realtek.com/
Yu-Chun Lin (5):
gpio: rtd1625: Minor coding style cleanups
gpio: rtd1625: Fix variable type for regmap_read()
gpio: rtd1625: Narrow variable scope in loops
gpio: rtd1625: Replace pr_err_ratelimited() with dev_err_ratelimited()
gpio: rtd1625: Use IRQ_TYPE_DEFAULT macro
drivers/gpio/gpio-rtd1625.c | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 1/5] gpio: rtd1625: Minor coding style cleanups
2026-08-14 2:56 [PATCH v2 0/5] gpio: rtd1625: minor cleanups and log improvements Yu-Chun Lin
@ 2026-08-14 2:56 ` Yu-Chun Lin
2026-08-14 12:05 ` Andy Shevchenko
2026-08-14 2:56 ` [PATCH v2 2/5] gpio: rtd1625: Fix variable type for regmap_read() Yu-Chun Lin
` (3 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Yu-Chun Lin @ 2026-08-14 2:56 UTC (permalink / raw)
To: linusw, brgl
Cc: andriy.shevchenko, linux-gpio, linux-kernel, tychang,
eleanor.lin, stanley_chang, cy.huang, james.tai
Address a few coding style issues:
- Drop redundant initialization.
- Remove an unnecessary blank line in rtd1625_gpio_setup_irq().
- And move the comment closer to the related code for better context.
Link: https://lore.kernel.org/lkml/anUcSPcJjJkLh0Z-@ashevche-desk.local/
Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Yu-Chun Lin <eleanor.lin@realtek.com>
---
drivers/gpio/gpio-rtd1625.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/gpio/gpio-rtd1625.c b/drivers/gpio/gpio-rtd1625.c
index 483e44cf5abc..910004c423df 100644
--- a/drivers/gpio/gpio-rtd1625.c
+++ b/drivers/gpio/gpio-rtd1625.c
@@ -107,10 +107,10 @@ static int rtd1625_reg_mask_xlate(struct gpio_regmap *gpio, enum gpio_regmap_ope
unsigned int base, unsigned int offset, unsigned int *reg,
unsigned int *mask)
{
- /* Each GPIO has its own dedicated 32-bit register */
struct rtd1625_gpio *data = gpio_regmap_get_drvdata(gpio);
- int val = 0, ret = 0;
+ /* Each GPIO has its own dedicated 32-bit register */
*reg = base + offset * 4;
+ int val, ret;
switch (op) {
case GPIO_REGMAP_SET_OP:
@@ -486,7 +486,6 @@ static int rtd1625_gpio_setup_irq(struct platform_device *pdev, struct rtd1625_g
return irq;
num_irqs = (data->info->irq_type_support & IRQ_TYPE_LEVEL_MASK) ? 3 : 2;
-
for (unsigned int i = 0; i < num_irqs; i++) {
irq = platform_get_irq(pdev, i);
if (irq < 0)
--
2.43.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 2/5] gpio: rtd1625: Fix variable type for regmap_read()
2026-08-14 2:56 [PATCH v2 0/5] gpio: rtd1625: minor cleanups and log improvements Yu-Chun Lin
2026-08-14 2:56 ` [PATCH v2 1/5] gpio: rtd1625: Minor coding style cleanups Yu-Chun Lin
@ 2026-08-14 2:56 ` Yu-Chun Lin
2026-08-14 12:05 ` Andy Shevchenko
2026-08-14 2:56 ` [PATCH v2 3/5] gpio: rtd1625: Narrow variable scope in loops Yu-Chun Lin
` (2 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Yu-Chun Lin @ 2026-08-14 2:56 UTC (permalink / raw)
To: linusw, brgl
Cc: andriy.shevchenko, linux-gpio, linux-kernel, tychang,
eleanor.lin, stanley_chang, cy.huang, james.tai
Change the type of 'val' from int to unsigned int. This properly matches
the expected parameter type of regmap_read().
Signed-off-by: Yu-Chun Lin <eleanor.lin@realtek.com>
---
drivers/gpio/gpio-rtd1625.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-rtd1625.c b/drivers/gpio/gpio-rtd1625.c
index 910004c423df..0308d7a052e7 100644
--- a/drivers/gpio/gpio-rtd1625.c
+++ b/drivers/gpio/gpio-rtd1625.c
@@ -110,7 +110,8 @@ static int rtd1625_reg_mask_xlate(struct gpio_regmap *gpio, enum gpio_regmap_ope
struct rtd1625_gpio *data = gpio_regmap_get_drvdata(gpio);
/* Each GPIO has its own dedicated 32-bit register */
*reg = base + offset * 4;
- int val, ret;
+ unsigned int val;
+ int ret;
switch (op) {
case GPIO_REGMAP_SET_OP:
--
2.43.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 3/5] gpio: rtd1625: Narrow variable scope in loops
2026-08-14 2:56 [PATCH v2 0/5] gpio: rtd1625: minor cleanups and log improvements Yu-Chun Lin
2026-08-14 2:56 ` [PATCH v2 1/5] gpio: rtd1625: Minor coding style cleanups Yu-Chun Lin
2026-08-14 2:56 ` [PATCH v2 2/5] gpio: rtd1625: Fix variable type for regmap_read() Yu-Chun Lin
@ 2026-08-14 2:56 ` Yu-Chun Lin
2026-08-14 12:07 ` Andy Shevchenko
2026-08-14 2:56 ` [PATCH v2 4/5] gpio: rtd1625: Replace pr_err_ratelimited() with dev_err_ratelimited() Yu-Chun Lin
2026-08-14 2:56 ` [PATCH v2 5/5] gpio: rtd1625: Use IRQ_TYPE_DEFAULT macro Yu-Chun Lin
4 siblings, 1 reply; 11+ messages in thread
From: Yu-Chun Lin @ 2026-08-14 2:56 UTC (permalink / raw)
To: linusw, brgl
Cc: andriy.shevchenko, linux-gpio, linux-kernel, tychang,
eleanor.lin, stanley_chang, cy.huang, james.tai
Declare 'i' inside the for-loop header and 'hwirq' within the inner block
where it's used to reduce variable visibility.
Link: https://lore.kernel.org/lkml/anUcSPcJjJkLh0Z-@ashevche-desk.local/
Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Yu-Chun Lin <eleanor.lin@realtek.com>
---
drivers/gpio/gpio-rtd1625.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpio/gpio-rtd1625.c b/drivers/gpio/gpio-rtd1625.c
index 0308d7a052e7..8f584287c2e6 100644
--- a/drivers/gpio/gpio-rtd1625.c
+++ b/drivers/gpio/gpio-rtd1625.c
@@ -224,8 +224,7 @@ static void rtd1625_gpio_irq_handle(struct irq_desc *desc)
struct irq_chip *chip = irq_desc_get_chip(desc);
unsigned int irq = irq_desc_get_irq(desc);
struct irq_domain *domain = data->domain;
- unsigned int reg_offset, i, j, val;
- irq_hw_number_t hwirq;
+ unsigned int reg_offset, j, val;
unsigned long status;
u32 irq_type;
int ret;
@@ -241,7 +240,7 @@ static void rtd1625_gpio_irq_handle(struct irq_desc *desc)
chained_irq_enter(chip, desc);
- for (i = 0; i < data->info->num_gpios; i += 32) {
+ for (unsigned int i = 0; i < data->info->num_gpios; i += 32) {
reg_offset = get_reg_offset(data, i);
ret = regmap_read(data->regmap, reg_offset, &val);
if (ret) {
@@ -267,7 +266,8 @@ static void rtd1625_gpio_irq_handle(struct irq_desc *desc)
}
for_each_set_bit(j, &status, 32) {
- hwirq = i + j;
+ irq_hw_number_t hwirq = i + j;
+
irq_type = irq_get_trigger_type(irq_find_mapping(domain, hwirq));
/*
--
2.43.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 4/5] gpio: rtd1625: Replace pr_err_ratelimited() with dev_err_ratelimited()
2026-08-14 2:56 [PATCH v2 0/5] gpio: rtd1625: minor cleanups and log improvements Yu-Chun Lin
` (2 preceding siblings ...)
2026-08-14 2:56 ` [PATCH v2 3/5] gpio: rtd1625: Narrow variable scope in loops Yu-Chun Lin
@ 2026-08-14 2:56 ` Yu-Chun Lin
2026-08-14 12:07 ` Andy Shevchenko
2026-08-14 2:56 ` [PATCH v2 5/5] gpio: rtd1625: Use IRQ_TYPE_DEFAULT macro Yu-Chun Lin
4 siblings, 1 reply; 11+ messages in thread
From: Yu-Chun Lin @ 2026-08-14 2:56 UTC (permalink / raw)
To: linusw, brgl
Cc: andriy.shevchenko, linux-gpio, linux-kernel, tychang,
eleanor.lin, stanley_chang, cy.huang, james.tai
Using dev_* logging macros is preferred over pr_* in device drivers as it
provides proper device context in the kernel log output.
Link: https://lore.kernel.org/lkml/anUcSPcJjJkLh0Z-@ashevche-desk.local/
Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Yu-Chun Lin <eleanor.lin@realtek.com>
---
drivers/gpio/gpio-rtd1625.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/gpio/gpio-rtd1625.c b/drivers/gpio/gpio-rtd1625.c
index 8f584287c2e6..613462614210 100644
--- a/drivers/gpio/gpio-rtd1625.c
+++ b/drivers/gpio/gpio-rtd1625.c
@@ -221,6 +221,7 @@ static void rtd1625_gpio_irq_handle(struct irq_desc *desc)
{
unsigned int (*get_reg_offset)(struct rtd1625_gpio *gpio, unsigned int offset);
struct rtd1625_gpio *data = irq_desc_get_handler_data(desc);
+ struct device *dev = regmap_get_device(data->regmap);
struct irq_chip *chip = irq_desc_get_chip(desc);
unsigned int irq = irq_desc_get_irq(desc);
struct irq_domain *domain = data->domain;
@@ -244,7 +245,8 @@ static void rtd1625_gpio_irq_handle(struct irq_desc *desc)
reg_offset = get_reg_offset(data, i);
ret = regmap_read(data->regmap, reg_offset, &val);
if (ret) {
- pr_err_ratelimited("Failed to read IRQ status for GPIO %u: %d\n", i, ret);
+ dev_err_ratelimited(dev, "Failed to read IRQ status for GPIO %u: %d\n",
+ i, ret);
continue;
}
@@ -261,8 +263,9 @@ static void rtd1625_gpio_irq_handle(struct irq_desc *desc)
if (irq != data->irqs[RTD1625_IRQ_LEVEL]) {
ret = regmap_write(data->regmap, reg_offset, status);
if (ret)
- pr_err_ratelimited("Failed to clear edge IRQ for GPIO %u: %d\n",
- i, ret);
+ dev_err_ratelimited(dev,
+ "Failed to clear edge IRQ for GPIO %u: %d\n",
+ i, ret);
}
for_each_set_bit(j, &status, 32) {
--
2.43.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 5/5] gpio: rtd1625: Use IRQ_TYPE_DEFAULT macro
2026-08-14 2:56 [PATCH v2 0/5] gpio: rtd1625: minor cleanups and log improvements Yu-Chun Lin
` (3 preceding siblings ...)
2026-08-14 2:56 ` [PATCH v2 4/5] gpio: rtd1625: Replace pr_err_ratelimited() with dev_err_ratelimited() Yu-Chun Lin
@ 2026-08-14 2:56 ` Yu-Chun Lin
2026-08-14 12:08 ` Andy Shevchenko
4 siblings, 1 reply; 11+ messages in thread
From: Yu-Chun Lin @ 2026-08-14 2:56 UTC (permalink / raw)
To: linusw, brgl
Cc: andriy.shevchenko, linux-gpio, linux-kernel, tychang,
eleanor.lin, stanley_chang, cy.huang, james.tai
Use the standard IRQ_TYPE_DEFAULT macro instead of explicitly listing all
supported edge and level IRQ type flags.
Link: https://lore.kernel.org/lkml/anUcSPcJjJkLh0Z-@ashevche-desk.local/
Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Yu-Chun Lin <eleanor.lin@realtek.com>
---
drivers/gpio/gpio-rtd1625.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-rtd1625.c b/drivers/gpio/gpio-rtd1625.c
index 613462614210..bebd1b8ede48 100644
--- a/drivers/gpio/gpio-rtd1625.c
+++ b/drivers/gpio/gpio-rtd1625.c
@@ -615,8 +615,7 @@ static const struct rtd1625_gpio_info rtd1625_iso_gpio_info = {
static const struct rtd1625_gpio_info rtd1625_isom_gpio_info = {
.num_gpios = 4,
- .irq_type_support = IRQ_TYPE_EDGE_BOTH | IRQ_TYPE_LEVEL_LOW |
- IRQ_TYPE_LEVEL_HIGH,
+ .irq_type_support = IRQ_TYPE_DEFAULT,
.base_offset = 0x20,
.gpa_offset = 0x00,
.gpda_offset = 0x04,
--
2.43.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 1/5] gpio: rtd1625: Minor coding style cleanups
2026-08-14 2:56 ` [PATCH v2 1/5] gpio: rtd1625: Minor coding style cleanups Yu-Chun Lin
@ 2026-08-14 12:05 ` Andy Shevchenko
0 siblings, 0 replies; 11+ messages in thread
From: Andy Shevchenko @ 2026-08-14 12:05 UTC (permalink / raw)
To: Yu-Chun Lin
Cc: linusw, brgl, linux-gpio, linux-kernel, tychang, stanley_chang,
cy.huang, james.tai
On Fri, Aug 14, 2026 at 10:56:53AM +0800, Yu-Chun Lin wrote:
> Address a few coding style issues:
> - Drop redundant initialization.
> - Remove an unnecessary blank line in rtd1625_gpio_setup_irq().
> - And move the comment closer to the related code for better context.
Not sure if this needs to be split to two patches (the second item doesn't
really belongs to it). With that being split out, the Subject may be corrected
to the point of _this_ change, id est "Drop unneeded 'ret' assignment", and
in the commit message something like "While at it, place correctly the comment
to be just above the referenced code."
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/5] gpio: rtd1625: Fix variable type for regmap_read()
2026-08-14 2:56 ` [PATCH v2 2/5] gpio: rtd1625: Fix variable type for regmap_read() Yu-Chun Lin
@ 2026-08-14 12:05 ` Andy Shevchenko
0 siblings, 0 replies; 11+ messages in thread
From: Andy Shevchenko @ 2026-08-14 12:05 UTC (permalink / raw)
To: Yu-Chun Lin
Cc: linusw, brgl, linux-gpio, linux-kernel, tychang, stanley_chang,
cy.huang, james.tai
On Fri, Aug 14, 2026 at 10:56:54AM +0800, Yu-Chun Lin wrote:
> Change the type of 'val' from int to unsigned int. This properly matches
> the expected parameter type of regmap_read().
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 3/5] gpio: rtd1625: Narrow variable scope in loops
2026-08-14 2:56 ` [PATCH v2 3/5] gpio: rtd1625: Narrow variable scope in loops Yu-Chun Lin
@ 2026-08-14 12:07 ` Andy Shevchenko
0 siblings, 0 replies; 11+ messages in thread
From: Andy Shevchenko @ 2026-08-14 12:07 UTC (permalink / raw)
To: Yu-Chun Lin
Cc: linusw, brgl, linux-gpio, linux-kernel, tychang, stanley_chang,
cy.huang, james.tai
On Fri, Aug 14, 2026 at 10:56:55AM +0800, Yu-Chun Lin wrote:
> Declare 'i' inside the for-loop header and 'hwirq' within the inner block
> where it's used to reduce variable visibility.
Sounds like it also can be split to two.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 4/5] gpio: rtd1625: Replace pr_err_ratelimited() with dev_err_ratelimited()
2026-08-14 2:56 ` [PATCH v2 4/5] gpio: rtd1625: Replace pr_err_ratelimited() with dev_err_ratelimited() Yu-Chun Lin
@ 2026-08-14 12:07 ` Andy Shevchenko
0 siblings, 0 replies; 11+ messages in thread
From: Andy Shevchenko @ 2026-08-14 12:07 UTC (permalink / raw)
To: Yu-Chun Lin
Cc: linusw, brgl, linux-gpio, linux-kernel, tychang, stanley_chang,
cy.huang, james.tai
On Fri, Aug 14, 2026 at 10:56:56AM +0800, Yu-Chun Lin wrote:
> Using dev_* logging macros is preferred over pr_* in device drivers as it
> provides proper device context in the kernel log output.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 5/5] gpio: rtd1625: Use IRQ_TYPE_DEFAULT macro
2026-08-14 2:56 ` [PATCH v2 5/5] gpio: rtd1625: Use IRQ_TYPE_DEFAULT macro Yu-Chun Lin
@ 2026-08-14 12:08 ` Andy Shevchenko
0 siblings, 0 replies; 11+ messages in thread
From: Andy Shevchenko @ 2026-08-14 12:08 UTC (permalink / raw)
To: Yu-Chun Lin
Cc: linusw, brgl, linux-gpio, linux-kernel, tychang, stanley_chang,
cy.huang, james.tai
On Fri, Aug 14, 2026 at 10:56:57AM +0800, Yu-Chun Lin wrote:
> Use the standard IRQ_TYPE_DEFAULT macro instead of explicitly listing all
> supported edge and level IRQ type flags.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2026-08-14 12:08 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-14 2:56 [PATCH v2 0/5] gpio: rtd1625: minor cleanups and log improvements Yu-Chun Lin
2026-08-14 2:56 ` [PATCH v2 1/5] gpio: rtd1625: Minor coding style cleanups Yu-Chun Lin
2026-08-14 12:05 ` Andy Shevchenko
2026-08-14 2:56 ` [PATCH v2 2/5] gpio: rtd1625: Fix variable type for regmap_read() Yu-Chun Lin
2026-08-14 12:05 ` Andy Shevchenko
2026-08-14 2:56 ` [PATCH v2 3/5] gpio: rtd1625: Narrow variable scope in loops Yu-Chun Lin
2026-08-14 12:07 ` Andy Shevchenko
2026-08-14 2:56 ` [PATCH v2 4/5] gpio: rtd1625: Replace pr_err_ratelimited() with dev_err_ratelimited() Yu-Chun Lin
2026-08-14 12:07 ` Andy Shevchenko
2026-08-14 2:56 ` [PATCH v2 5/5] gpio: rtd1625: Use IRQ_TYPE_DEFAULT macro Yu-Chun Lin
2026-08-14 12:08 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®