public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Gollub <dgollub@suse.de>
To: linux-pm@lists.osdl.org
Subject: RTPM allowing trailing newline in state_store()
Date: Wed, 28 Sep 2005 18:12:16 +0200	[thread overview]
Message-ID: <20050928181216.4fe42a8a@yang-old.suse.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 1275 bytes --]

hi,

is there a special way reserved for writing on power/state in the device
directories?
a simple echo {0,1,2,3} doesn't work, because of the trailing newline.
only with echo -n it works.
i was very confused about that... i needed two days to figure this out
:)
maybe it's a good idea to allow an value with \n  .. because other state
files like /sys/power/state also allows trailing newlines.

can you please give me a hint, if there is another special way to set a
single device in suspend. or is there a reason for ignoring trailing
newline?

thanks,
daniel

simple patch for allowing trailing newlines in state_strore in sysfs.c :

--- linux/drivers/base/power/sysfs.c.orig       2005-09-20
17:07:42.000000000 +0200
+++ linux/drivers/base/power/sysfs.c    2005-09-20 17:09:42.000000000
+0200
@@ -36,7 +36,7 @@ static ssize_t state_store(struct device
        int error = 0;
 
        state = simple_strtoul(buf, &rest, 10);
-       if (*rest)
+       if (*rest && *rest != '\n')
                return -EINVAL;
        if (state)
                error = dpm_runtime_suspend(dev, state);

_______________________________________________
linux-pm mailing list
linux-pm@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/linux-pm

[-- Attachment #2: SpamAssassinReport.txt --]
[-- Type: text/plain, Size: 1132 bytes --]

Spam detection software, running on the system "fire-1.osdl.org", has
identified this incoming email as possible spam.  The original message
has been attached to this so you can view it (if it isn't spam) or block
similar future email.  If you have any questions, see
the administrator of that system for details.

Content preview:  hi, is there a special way reserved for writing on
  power/state in the device directories? a simple echo {0,1,2,3} doesn't
  work, because of the trailing newline. only with echo -n it works. i
  was very confused about that... i needed two days to figure this out :)
  maybe it's a good idea to allow an value with \n .. because other state
  files like /sys/power/state also allows trailing newlines. [...] 

Content analysis details:   (6.0 points, 5.0 required)

 pts rule name              description
---- ---------------------- --------------------------------------------------
 2.0 OSDL_HIGH_ASCII_6      BODY: 6 high-ASCII characters in a row
 2.0 OSDL_HIGH_ASCII_7      BODY: 7 high-ASCII characters in a row
 2.0 OSDL_HIGH_ASCII_15     BODY: 15 or more high-ASCII characters in a row



                 reply	other threads:[~2005-09-28 16:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20050928181216.4fe42a8a@yang-old.suse.de \
    --to=dgollub@suse.de \
    --cc=linux-pm@lists.osdl.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox