linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Dwaipayan Ray <dwaipayanray1@gmail.com>,
	corbet@lwn.net, lukas.bulwahn@gmail.com
Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] docs: checkpatch: Document and segregate more checkpatch message types
Date: Fri, 04 Jun 2021 23:26:35 -0700	[thread overview]
Message-ID: <eab0487d7b4e68badbbe0505b2a7903b9d8931c4.camel@perches.com> (raw)
In-Reply-To: <20210605055932.18393-1-dwaipayanray1@gmail.com>

On Sat, 2021-06-05 at 11:29 +0530, Dwaipayan Ray wrote:
> Add and document more checkpatch message types. About 50% of all
> message types are documented now.
[]
> diff --git a/Documentation/dev-tools/checkpatch.rst b/Documentation/dev-tools/checkpatch.rst
[]
> +  **DEVICE_ATTR_FUNCTIONS**
> +    The function names used in DEVICE_ATTR is unusual.
> +    Typically, the store and show functions are named as name_store and
> +    name_show, where name is the device name.

No, it's the variable name of an attribute of a device, not the device name.

    Typically, the store and show functions are used with <attr>_store and
    <attr>_show, where <attr> is a named attribute variable of the device.

> +    Consider the following examples::
> +
> +      static DEVICE_ATTR(type, 0444, type_show, NULL);
> +      static DEVICE_ATTR(power, 0644, power_show, power_store);
> +
> +    The function names should preferably follow the above pattern.
> +
> +    See: https://www.kernel.org/doc/html/latest/driver-api/driver-model/device.html#attributes
> +
> +  **DEVICE_ATTR_RO**
> +    The DEVICE_ATTR_RO(name) helper macro can be used in place of
> +    DEVICE_ATTR(name, 0444, name_show, NULL);
> +
> +    Note that the macro automatically appends _show to the device name
> +    for the show method.

attribute, etc...

> +  **ENOSYS**
> +    ENOSYS means that a nonexistent system call was called.  We have a
> +    bad habit of using it for things like invalid operations on
> +    otherwise valid syscalls.  This should be avoided in new code.

Please do not use terms like "we".  Just use passive voice and not
any first person/collective words.

> +
> +    See: https://lore.kernel.org/lkml/5eb299021dec23c1a48fa7d9f2c8b794e967766d.1408730669.git.luto@amacapital.net/
> +
> +  **ENOTSUPP**
> +    ENOTSUPP is not a standard error code and should be avoided in new patches.
> +    EOPNOTSUPP should be used instead.

Better word choice is like this section above.



      reply	other threads:[~2021-06-05  6:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-05  5:59 [PATCH] docs: checkpatch: Document and segregate more checkpatch message types Dwaipayan Ray
2021-06-05  6:26 ` Joe Perches [this message]

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=eab0487d7b4e68badbbe0505b2a7903b9d8931c4.camel@perches.com \
    --to=joe@perches.com \
    --cc=corbet@lwn.net \
    --cc=dwaipayanray1@gmail.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas.bulwahn@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).