From: Sam Ravnborg <sam@ravnborg.org>
To: "Jonathan Neuschäfer" <j.neuschaefer@gmx.net>,
"Mauro Carvalho Chehab" <mchehab+samsung@kernel.org>,
"Jonathan Corbet" <corbet@lwn.net>
Cc: dri-devel@lists.freedesktop.org,
Maxime Ripard <maxime.ripard@bootlin.com>,
linux-kernel@vger.kernel.org, David Airlie <airlied@linux.ie>,
Sean Paul <sean@poorly.run>
Subject: Best practice for embedded code samles? [Was: drm/drv: Use // for comments in example code]
Date: Sun, 11 Aug 2019 23:32:15 +0200 [thread overview]
Message-ID: <20190811213215.GA26468@ravnborg.org> (raw)
In-Reply-To: <20190808163629.14280-1-j.neuschaefer@gmx.net>
On Thu, Aug 08, 2019 at 06:36:28PM +0200, Jonathan Neuschäfer wrote:
> This improves Sphinx output in two ways:
>
> - It avoids an unmatched single-quote ('), about which Sphinx complained:
>
> /.../Documentation/gpu/drm-internals.rst:298:
> WARNING: Could not lex literal_block as "c". Highlighting skipped.
>
> An alternative approach would be to replace "can't" with a word that
> doesn't have a single-quote.
>
> - It lets Sphinx format the comments in italics and grey, making the
> code slightly easier to read.
>
> Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
The result looks much better now - thanks.
I wonder if there is a better way to embed a code sample
than reverting to // style comments.
As the kernel do not like // comments we should try to avoid them in
examples.
Mauro/Jon?
Sam
> ---
> drivers/gpu/drm/drm_drv.c | 14 ++++++--------
> 1 file changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 9d00947ca447..769feefeeeef 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -328,11 +328,9 @@ void drm_minor_release(struct drm_minor *minor)
> * struct drm_device *drm;
> * int ret;
> *
> - * [
> - * devm_kzalloc() can't be used here because the drm_device
> - * lifetime can exceed the device lifetime if driver unbind
> - * happens when userspace still has open file descriptors.
> - * ]
> + * // devm_kzalloc() can't be used here because the drm_device '
> + * // lifetime can exceed the device lifetime if driver unbind
> + * // happens when userspace still has open file descriptors.
> * priv = kzalloc(sizeof(*priv), GFP_KERNEL);
> * if (!priv)
> * return -ENOMEM;
> @@ -355,7 +353,7 @@ void drm_minor_release(struct drm_minor *minor)
> * if (IS_ERR(priv->pclk))
> * return PTR_ERR(priv->pclk);
> *
> - * [ Further setup, display pipeline etc ]
> + * // Further setup, display pipeline etc
> *
> * platform_set_drvdata(pdev, drm);
> *
> @@ -370,7 +368,7 @@ void drm_minor_release(struct drm_minor *minor)
> * return 0;
> * }
> *
> - * [ This function is called before the devm_ resources are released ]
> + * // This function is called before the devm_ resources are released
> * static int driver_remove(struct platform_device *pdev)
> * {
> * struct drm_device *drm = platform_get_drvdata(pdev);
> @@ -381,7 +379,7 @@ void drm_minor_release(struct drm_minor *minor)
> * return 0;
> * }
> *
> - * [ This function is called on kernel restart and shutdown ]
> + * // This function is called on kernel restart and shutdown
> * static void driver_shutdown(struct platform_device *pdev)
> * {
> * drm_atomic_helper_shutdown(platform_get_drvdata(pdev));
> --
> 2.20.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2019-08-11 21:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-08 16:36 [PATCH] drm/drv: Use // for comments in example code Jonathan Neuschäfer
2019-08-11 21:32 ` Sam Ravnborg [this message]
2019-08-13 22:07 ` Best practice for embedded code samles? [Was: drm/drv: Use // for comments in example code] Jonathan Corbet
2019-08-13 22:07 ` Jonathan Corbet
2019-08-14 7:37 ` Jani Nikula
2019-08-19 17:06 ` [PATCH] drm/drv: Use // for comments in example code Sam Ravnborg
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=20190811213215.GA26468@ravnborg.org \
--to=sam@ravnborg.org \
--cc=airlied@linux.ie \
--cc=corbet@lwn.net \
--cc=dri-devel@lists.freedesktop.org \
--cc=j.neuschaefer@gmx.net \
--cc=linux-kernel@vger.kernel.org \
--cc=maxime.ripard@bootlin.com \
--cc=mchehab+samsung@kernel.org \
--cc=sean@poorly.run \
/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.