From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>,
rtc-linux@googlegroups.com,
Alessandro Zummo <a.zummo@towertech.it>,
linux-kernel@vger.kernel.org
Subject: Re: [rtc-linux] [PATCH 4/4] RTC: switch to using is_visible() to control sysfs attributes
Date: Wed, 22 Jul 2015 22:57:35 +0200 [thread overview]
Message-ID: <20150722205735.GP2853@piout.net> (raw)
In-Reply-To: <CAJKOXPevQGGwCYgcH9zJ6b9c4u=XV6pO2tzne0Ub3uinDjLqvQ@mail.gmail.com>
(Krzysztof, be careful, Dmitry was not in copy of your maili, you should
probably check your mailer config)
On 21/07/2015 at 10:21:11 +0900, Krzysztof Kozlowski wrote :
> 2015-07-21 8:02 GMT+09:00 Dmitry Torokhov <dmitry.torokhov@gmail.com>:
> > static ssize_t
> > -rtc_sysfs_set_wakealarm(struct device *dev, struct device_attribute *attr,
> > +wakealarm_store(struct device *dev, struct device_attribute *attr,
> > const char *buf, size_t n)
> > {
> > ssize_t retval;
> > @@ -221,45 +209,58 @@ rtc_sysfs_set_wakealarm(struct device *dev, struct device_attribute *attr,
> > retval = rtc_set_alarm(rtc, &alm);
> > return (retval < 0) ? retval : n;
> > }
> > -static DEVICE_ATTR(wakealarm, S_IRUGO | S_IWUSR,
> > - rtc_sysfs_show_wakealarm, rtc_sysfs_set_wakealarm);
> > +static DEVICE_ATTR_RW(wakealarm);
>
> This and renaming of show/store functions look unrelated
>
I don't really mind that one but I would also prefer if it could be
separated.
> >
> > +static struct attribute *rtc_attrs[] = {
> > + &dev_attr_name.attr,
> > + &dev_attr_date.attr,
> > + &dev_attr_time.attr,
> > + &dev_attr_since_epoch.attr,
> > + &dev_attr_max_user_freq.attr,
> > + &dev_attr_hctosys.attr,
> > + &dev_attr_wakealarm.attr,
> > + NULL,
> > +};
> >
> > -/* The reason to trigger an alarm with no process watching it (via sysfs)
> > +/*
> > + * The reason to trigger an alarm with no process watching it (via sysfs)
> > * is its side effect: waking from a system state like suspend-to-RAM or
> > * suspend-to-disk. So: no attribute unless that side effect is possible.
> > * (Userspace may disable that mechanism later.)
> > */
> > -static inline int rtc_does_wakealarm(struct rtc_device *rtc)
> > +static bool rtc_does_wakealarm(struct rtc_device *rtc)
> > {
> > if (!device_can_wakeup(rtc->dev.parent))
> > - return 0;
> > + return false;
> > +
> > return rtc->ops->set_alarm != NULL;
> > }
>
> This looks unrelated too and confuses me. Could you split such cleanup
> from main goal of the patch?
>
That one is bothering me too.
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
--
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
WARNING: multiple messages have this Message-ID (diff)
From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>,
rtc-linux@googlegroups.com,
Alessandro Zummo <a.zummo@towertech.it>,
linux-kernel@vger.kernel.org
Subject: Re: [rtc-linux] [PATCH 4/4] RTC: switch to using is_visible() to control sysfs attributes
Date: Wed, 22 Jul 2015 22:57:35 +0200 [thread overview]
Message-ID: <20150722205735.GP2853@piout.net> (raw)
In-Reply-To: <CAJKOXPevQGGwCYgcH9zJ6b9c4u=XV6pO2tzne0Ub3uinDjLqvQ@mail.gmail.com>
(Krzysztof, be careful, Dmitry was not in copy of your maili, you should
probably check your mailer config)
On 21/07/2015 at 10:21:11 +0900, Krzysztof Kozlowski wrote :
> 2015-07-21 8:02 GMT+09:00 Dmitry Torokhov <dmitry.torokhov@gmail.com>:
> > static ssize_t
> > -rtc_sysfs_set_wakealarm(struct device *dev, struct device_attribute *attr,
> > +wakealarm_store(struct device *dev, struct device_attribute *attr,
> > const char *buf, size_t n)
> > {
> > ssize_t retval;
> > @@ -221,45 +209,58 @@ rtc_sysfs_set_wakealarm(struct device *dev, struct device_attribute *attr,
> > retval = rtc_set_alarm(rtc, &alm);
> > return (retval < 0) ? retval : n;
> > }
> > -static DEVICE_ATTR(wakealarm, S_IRUGO | S_IWUSR,
> > - rtc_sysfs_show_wakealarm, rtc_sysfs_set_wakealarm);
> > +static DEVICE_ATTR_RW(wakealarm);
>
> This and renaming of show/store functions look unrelated
>
I don't really mind that one but I would also prefer if it could be
separated.
> >
> > +static struct attribute *rtc_attrs[] = {
> > + &dev_attr_name.attr,
> > + &dev_attr_date.attr,
> > + &dev_attr_time.attr,
> > + &dev_attr_since_epoch.attr,
> > + &dev_attr_max_user_freq.attr,
> > + &dev_attr_hctosys.attr,
> > + &dev_attr_wakealarm.attr,
> > + NULL,
> > +};
> >
> > -/* The reason to trigger an alarm with no process watching it (via sysfs)
> > +/*
> > + * The reason to trigger an alarm with no process watching it (via sysfs)
> > * is its side effect: waking from a system state like suspend-to-RAM or
> > * suspend-to-disk. So: no attribute unless that side effect is possible.
> > * (Userspace may disable that mechanism later.)
> > */
> > -static inline int rtc_does_wakealarm(struct rtc_device *rtc)
> > +static bool rtc_does_wakealarm(struct rtc_device *rtc)
> > {
> > if (!device_can_wakeup(rtc->dev.parent))
> > - return 0;
> > + return false;
> > +
> > return rtc->ops->set_alarm != NULL;
> > }
>
> This looks unrelated too and confuses me. Could you split such cleanup
> from main goal of the patch?
>
That one is bothering me too.
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
next prev parent reply other threads:[~2015-07-22 20:57 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-20 23:02 [rtc-linux] [PATCH 1/4] RTC: fix double free in rtc_register_device() error path Dmitry Torokhov
2015-07-20 23:02 ` Dmitry Torokhov
2015-07-20 23:02 ` [rtc-linux] [PATCH 2/4] RTC: remove unnecessary device_get() in rtc_device_unregister Dmitry Torokhov
2015-07-20 23:02 ` Dmitry Torokhov
2015-07-21 0:39 ` [rtc-linux] " Krzysztof Kozlowski
2015-07-21 0:39 ` Krzysztof Kozlowski
2015-07-22 20:33 ` [rtc-linux] " Alexandre Belloni
2015-07-22 20:33 ` Alexandre Belloni
2015-07-20 23:02 ` [rtc-linux] [PATCH 3/4] RTC: properly manage lifetime of dev and cdev in rtc device Dmitry Torokhov
2015-07-20 23:02 ` Dmitry Torokhov
2015-07-21 0:54 ` [rtc-linux] " Krzysztof Kozlowski
2015-07-21 0:54 ` Krzysztof Kozlowski
2015-07-22 20:40 ` [rtc-linux] " Alexandre Belloni
2015-07-22 20:40 ` Alexandre Belloni
2015-07-20 23:02 ` [rtc-linux] [PATCH 4/4] RTC: switch to using is_visible() to control sysfs attributes Dmitry Torokhov
2015-07-20 23:02 ` Dmitry Torokhov
2015-07-21 1:21 ` [rtc-linux] " Krzysztof Kozlowski
2015-07-21 1:21 ` Krzysztof Kozlowski
2015-07-22 20:57 ` Alexandre Belloni [this message]
2015-07-22 20:57 ` Alexandre Belloni
2015-07-22 21:44 ` Dmitry Torokhov
2015-07-22 21:44 ` Dmitry Torokhov
2015-07-23 0:40 ` Krzysztof Kozlowski
2015-07-23 0:40 ` Krzysztof Kozlowski
2015-07-22 20:53 ` [rtc-linux] " Alexandre Belloni
2015-07-22 20:53 ` Alexandre Belloni
2015-07-21 0:32 ` [rtc-linux] [PATCH 1/4] RTC: fix double free in rtc_register_device() error path Krzysztof Kozlowski
2015-07-21 0:32 ` Krzysztof Kozlowski
2015-07-21 0:42 ` Dmitry Torokhov
2015-07-21 0:42 ` Dmitry Torokhov
2015-07-22 20:32 ` [rtc-linux] " Alexandre Belloni
2015-07-22 20:32 ` Alexandre Belloni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150722205735.GP2853@piout.net \
--to=alexandre.belloni@free-electrons.com \
--cc=a.zummo@towertech.it \
--cc=dmitry.torokhov@gmail.com \
--cc=k.kozlowski@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rtc-linux@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.