Re: [PATCH] genirq/irqdesc: Use sysfs_emit in the <foo>_show functions

From: Thomas Gleixner
Date: Tue Aug 10 2021 - 17:47:04 EST


Joe!

On Tue, Aug 10 2021 at 10:55, Joe Perches wrote:
> Convert the nominally unbounded sprintf output to use sysfs_emit and the
> scnprintf uses to sysfs_emit_at.

Please use function_name() not function_name as that makes it clear what
this is about.

> Miscellanea:

The point is?

> o sysfs_emit: Use the more common int len not ssize_t ret

You're not changing sysfs_emit(). You change the variables in the irq
functions.

> o hwirq_show: Add a minimum newline output when irq_data.domain is not set
> and remove an unnecessary cast of an unsigned long to int ("%d" ->
> "%lu)

That's a separate change and has nothing to do with $subject

> o name_show: Add a minimum newline output when desc->name is not set

Ditto.

> diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
> index fadb937660202..8d47b8667c989 100644
> --- a/kernel/irq/irqdesc.c
> +++ b/kernel/irq/irqdesc.c
> @@ -147,19 +147,20 @@ static ssize_t per_cpu_count_show(struct kobject *kobj,
> struct kobj_attribute *attr, char *buf)
> {
> struct irq_desc *desc = container_of(kobj, struct irq_desc, kobj);
> - ssize_t ret = 0;
> - char *p = "";
> + int len = 0;
> + const char *p = "";
> int cpu;

Please keep reverse fir tree ordering and stick the two int variables
into one line, i.e.

struct irq_desc *desc = container_of(kobj, struct irq_desc, kobj);
const char *p = "";
int cpu, len = 0;

Please rework against

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip irq/core

Thanks,

tglx