On Thu, Nov 14, 2024 at 10:58:20AM +0800, zhangjiao2 wrote: > From: zhang jiao <zhangjiao2@xxxxxxxxxxxxxxxxxxxx> > > The format specifier of "unsigned long" in sprintf() > should be "%lu", not "%ld". > > Signed-off-by: zhang jiao <zhangjiao2@xxxxxxxxxxxxxxxxxxxx> > --- > net/bridge/br_sysfs_br.c | 8 ++++---- > net/bridge/br_sysfs_if.c | 6 +++--- > 2 files changed, 7 insertions(+), 7 deletions(-) > Hi, I think this patch is unnecessary (also should be targeted at net-next). We may change the return value of br_timer_value to clock_t to be consistent with jiffies_delta_to_clock_t(). It cannot return more than a long, so %ld is fine here. A simple patch like [1] can be considered to better show what is being returned. Thanks, Nik [1] diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index f317d8295bf4..fbdadef68854 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -1986,7 +1986,7 @@ void br_stp_rcv(const struct stp_proto *proto, struct sk_buff *skb, /* br_stp_timer.c */ void br_stp_timer_init(struct net_bridge *br); void br_stp_port_timer_init(struct net_bridge_port *p); -unsigned long br_timer_value(const struct timer_list *timer); +clock_t br_timer_value(const struct timer_list *timer); /* br.c */ #if IS_ENABLED(CONFIG_ATM_LANE) diff --git a/net/bridge/br_stp_timer.c b/net/bridge/br_stp_timer.c index 27bf1979b909..7b09fe3abd22 100644 --- a/net/bridge/br_stp_timer.c +++ b/net/bridge/br_stp_timer.c @@ -154,7 +154,7 @@ void br_stp_port_timer_init(struct net_bridge_port *p) } /* Report ticks left (in USER_HZ) used for API */ -unsigned long br_timer_value(const struct timer_list *timer) +clock_t br_timer_value(const struct timer_list *timer) { return timer_pending(timer) ? jiffies_delta_to_clock_t(timer->expires - jiffies) : 0; > diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c > index ea733542244c..0edab3910d46 100644 > --- a/net/bridge/br_sysfs_br.c > +++ b/net/bridge/br_sysfs_br.c > @@ -266,7 +266,7 @@ static ssize_t hello_timer_show(struct device *d, > struct device_attribute *attr, char *buf) > { > struct net_bridge *br = to_bridge(d); > - return sprintf(buf, "%ld\n", br_timer_value(&br->hello_timer)); > + return sprintf(buf, "%lu\n", br_timer_value(&br->hello_timer)); > } > static DEVICE_ATTR_RO(hello_timer); > > @@ -274,7 +274,7 @@ static ssize_t tcn_timer_show(struct device *d, struct device_attribute *attr, > char *buf) > { > struct net_bridge *br = to_bridge(d); > - return sprintf(buf, "%ld\n", br_timer_value(&br->tcn_timer)); > + return sprintf(buf, "%lu\n", br_timer_value(&br->tcn_timer)); > } > static DEVICE_ATTR_RO(tcn_timer); > > @@ -283,7 +283,7 @@ static ssize_t topology_change_timer_show(struct device *d, > char *buf) > { > struct net_bridge *br = to_bridge(d); > - return sprintf(buf, "%ld\n", br_timer_value(&br->topology_change_timer)); > + return sprintf(buf, "%lu\n", br_timer_value(&br->topology_change_timer)); > } > static DEVICE_ATTR_RO(topology_change_timer); > > @@ -291,7 +291,7 @@ static ssize_t gc_timer_show(struct device *d, struct device_attribute *attr, > char *buf) > { > struct net_bridge *br = to_bridge(d); > - return sprintf(buf, "%ld\n", br_timer_value(&br->gc_work.timer)); > + return sprintf(buf, "%lu\n", br_timer_value(&br->gc_work.timer)); > } > static DEVICE_ATTR_RO(gc_timer); > > diff --git a/net/bridge/br_sysfs_if.c b/net/bridge/br_sysfs_if.c > index 74fdd8105dca..08ad4580e645 100644 > --- a/net/bridge/br_sysfs_if.c > +++ b/net/bridge/br_sysfs_if.c > @@ -155,21 +155,21 @@ static BRPORT_ATTR(state, 0444, show_port_state, NULL); > static ssize_t show_message_age_timer(struct net_bridge_port *p, > char *buf) > { > - return sprintf(buf, "%ld\n", br_timer_value(&p->message_age_timer)); > + return sprintf(buf, "%lu\n", br_timer_value(&p->message_age_timer)); > } > static BRPORT_ATTR(message_age_timer, 0444, show_message_age_timer, NULL); > > static ssize_t show_forward_delay_timer(struct net_bridge_port *p, > char *buf) > { > - return sprintf(buf, "%ld\n", br_timer_value(&p->forward_delay_timer)); > + return sprintf(buf, "%lu\n", br_timer_value(&p->forward_delay_timer)); > } > static BRPORT_ATTR(forward_delay_timer, 0444, show_forward_delay_timer, NULL); > > static ssize_t show_hold_timer(struct net_bridge_port *p, > char *buf) > { > - return sprintf(buf, "%ld\n", br_timer_value(&p->hold_timer)); > + return sprintf(buf, "%lu\n", br_timer_value(&p->hold_timer)); > } > static BRPORT_ATTR(hold_timer, 0444, show_hold_timer, NULL); > > -- > 2.33.0 > > >