Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3060471ybl; Sun, 11 Aug 2019 14:33:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqydMXLzGmsbdBm5RhtRsYgKZOzoDh75vctjZhBfyUcVWu04Crb5mGKx724pitlsyiWZhwrc X-Received: by 2002:a17:902:a03:: with SMTP id 3mr29710909plo.302.1565559190458; Sun, 11 Aug 2019 14:33:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565559190; cv=none; d=google.com; s=arc-20160816; b=Hv9XrdoB2oM+18kmUqaKmcKB6DUZkx2h4N7jOd7IqMwogonoVDbbDPBZoLRkqJ9Enr moCEew2ohz8sSWh6JtWnllXWOzFx1QmN45RyyKBd/2LNw7AdpeobfXdzUw7Wwlfjuzko cjJdDCXHixEvS1cCWa/tbV5TJbg9AgUqJpBm6Zzqa6Oppo1G8TQIcVspi8vpoO19/bqk dvNBMUjHhmz9t4gorfxuA9kS6dcVe5q/4O/R2smzft4+/p7IzUbrZM8Z64uKL7onw76v LYuKtZyLd0CdxZq2M5WygPn+HLeG5453sp+Ydm8v1sye1MrBm9gTNTTq4Rg69LMndZIh +v5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=ckTUybBzG/QApWHOzpk5B1UixuQsCVlWxzavqNWjD9w=; b=ld/R4qflppIX0PTrU9HK6furLffYjKSKXwC3QtiI77KsIz7BSK+VD4zSti8jpjQHOo dOIS1vaTNhRJKh+8PaTtqDPHRCoQhVL35o4tcmDSMDOlB2jJb3p7JFMWsWGoy63lptC9 eoV5cHIhn4mRzrR8hsavh+pkkeaMQIZlmdgbSFy+NOZKWF3YZb2t+V1V120+OiR1Fzs9 x8toJ3DV7t8mK9Ic/kFldk+Z21CO1eSmjOA2a+Xw/13J1YARlwU9nPee2Bsz27JlhClZ Mgj1anVD5kPkxpFeo3vPQzynHfBn0EyiHGbC53add0k65/zqXA2PMuF6MgLjvMP0G/7l e+9A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j7si69369425pfi.10.2019.08.11.14.32.54; Sun, 11 Aug 2019 14:33:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726307AbfHKVcV (ORCPT + 99 others); Sun, 11 Aug 2019 17:32:21 -0400 Received: from asavdk4.altibox.net ([109.247.116.15]:37802 "EHLO asavdk4.altibox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726011AbfHKVcV (ORCPT ); Sun, 11 Aug 2019 17:32:21 -0400 Received: from ravnborg.org (unknown [158.248.194.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by asavdk4.altibox.net (Postfix) with ESMTPS id AB9CF803E5; Sun, 11 Aug 2019 23:32:16 +0200 (CEST) Date: Sun, 11 Aug 2019 23:32:15 +0200 From: Sam Ravnborg To: Jonathan =?iso-8859-1?Q?Neusch=E4fer?= , Mauro Carvalho Chehab , Jonathan Corbet Cc: dri-devel@lists.freedesktop.org, Maxime Ripard , linux-kernel@vger.kernel.org, David Airlie , Sean Paul Subject: Best practice for embedded code samles? [Was: drm/drv: Use // for comments in example code] Message-ID: <20190811213215.GA26468@ravnborg.org> References: <20190808163629.14280-1-j.neuschaefer@gmx.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190808163629.14280-1-j.neuschaefer@gmx.net> User-Agent: Mutt/1.10.1 (2018-07-13) X-CMAE-Score: 0 X-CMAE-Analysis: v=2.3 cv=VcLZwmh9 c=1 sm=1 tr=0 a=UWs3HLbX/2nnQ3s7vZ42gw==:117 a=UWs3HLbX/2nnQ3s7vZ42gw==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=8nJEP1OIZ-IA:10 a=VVlED5B4AAAA:8 a=e5mUnYsNAAAA:8 a=hR6eB8P5VIS1gKZY23kA:9 a=wPNLvfGTeEIA:10 a=Vxmtnl_E_bksehYqCbjh:22 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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