Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp315324pxu; Tue, 6 Oct 2020 07:09:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvatYzSOH3moyJ/cEib/deczXjTueHhN2He6ITCyNIA2bCTaEGriZHTGnBQ1FIo2KcrWNQ X-Received: by 2002:a50:d7d8:: with SMTP id m24mr5527625edj.388.1601993349935; Tue, 06 Oct 2020 07:09:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601993349; cv=none; d=google.com; s=arc-20160816; b=W2Ujf7rF+pKb1T+1biKHByWVQ9RR6tURjAK5FMGty0RKTkXi9c24RN+YOZy4R4gOVZ Ihx7Mj/w9vtDt4HpEgg5C77f1YkgyqjKsU3RC1csXnshr5TtER7prrTMBSlHjQPvHT7i ZmObXCzvZ2pP6AUklc+XdAohIRJDd/9inDyxsabZndOsJXub2099uL+5rqSykSwKIkUn xtn4wq7CvO5A3c1jKnABhifuGx2eJd0JavXp+7nOY/7ctiq4Hbt/+S33f7Zv8oa7CFVh TvJ89AxHpam7/4dyEmO4SYBmpZEFPX4CpfM7URchnD1I6xRRLQBfiMb/TgY4/f43qctC o10w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=k5v7xldwGYnqIzCmH5MLej51T5/TCSUtOyuObT+fvdE=; b=IZjGz2PPuRifVQI22Cegu93fYy486kFc3E5nk3gSMiAgzaufDRCAwWv3wxg2LgnyLw kiPV4n7NF2prcV18xjbvygAkmF+bYbMOgidbAis829hkpr97Dx9wXdxghhB/ToXkmkL0 FSQwwIUSBbxC5F2I4yHpvQlUA5RCFZoEee+Limj47oAMPomaHd2mR4nJtZq8ERtFuKKM W9g7cKmWYbrhbLF7u/glBODpgVCHquQbaZsEuutl+3vGtat6HBISnYjlTx4E5ANC+qq6 IVROlX41Fi2kj2WEBBCNiyQmWIB+1U/qp0rWyBjO1sszs2n8lAeOpkuiCp6mkjh73+D9 /opQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PEFhanrW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn22si2920211edb.231.2020.10.06.07.08.43; Tue, 06 Oct 2020 07:09:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PEFhanrW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726837AbgJFOFY (ORCPT + 99 others); Tue, 6 Oct 2020 10:05:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:33338 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726525AbgJFOD4 (ORCPT ); Tue, 6 Oct 2020 10:03:56 -0400 Received: from mail.kernel.org (ip5f5ad5bd.dynamic.kabel-deutschland.de [95.90.213.189]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0F9B820866; Tue, 6 Oct 2020 14:03:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601993035; bh=P6xz8KUdTSHt+tU0hrt3ccZ4JQH52NPEJDhTztH0y+E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PEFhanrWBen5TBYLafM8BE8CbU9kVJ2PoP0kxpgsJjQwK24YK55SIxTi8GsbbXo5t xKABiL+xbh5jHLCN/gn4Ak/Y+MH1GQHgk1Qs/A+MF5gKa7TtLI8ywCR/s4Zv9YvVUn /Hyq5Rvz/yhshbQObQnPBixvhAl7tbY1heFLyzI0= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kPnZJ-0019Go-53; Tue, 06 Oct 2020 16:03:53 +0200 From: Mauro Carvalho Chehab To: Linux Doc Mailing List , Jonathan Corbet Cc: Mauro Carvalho Chehab , linux-kernel@vger.kernel.org Subject: [PATCH v5 50/52] scripts: kernel-doc: try to use c:function if possible Date: Tue, 6 Oct 2020 16:03:47 +0200 Message-Id: <62b87762d9747e9aa5064f70dd216858c721ba41.1601992016.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Mauro Carvalho Chehab Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are a few namespace clashes by using c:macro everywhere: basically, when using it, we can't have something like: .. c:struct:: pwm_capture .. c:macro:: pwm_capture So, we need to use, instead: .. c:function:: int pwm_capture (struct pwm_device * pwm, struct pwm_capture * result, unsigned long timeout) for the function declaration. The kernel-doc change was proposed by Jakob Lykke Andersen here: https://github.com/jakobandersen/linux_docs/commit/6fd2076ec001cca7466857493cd678df4dfe4a65 Although I did a different implementation. Signed-off-by: Mauro Carvalho Chehab --- scripts/kernel-doc | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 9881f08cf75c..a3453de4495c 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc @@ -913,6 +913,7 @@ sub output_function_rst(%) { my ($parameter, $section); my $oldprefix = $lineprefix; my $start = ""; + my $is_macro = 0; if ($sphinx_major < 3) { if ($args{'typedef'}) { @@ -922,11 +923,17 @@ sub output_function_rst(%) { $lineprefix = ""; output_highlight_rst($args{'purpose'}); $start = "\n\n**Syntax**\n\n ``"; + $is_macro = 1; } else { print ".. c:function:: "; } } else { - print ".. c:macro:: ". $args{'function'} . "\n\n"; + if ($args{'typedef'} || $args{'functiontype'} eq "") { + $is_macro = 1; + print ".. c:macro:: ". $args{'function'} . "\n\n"; + } else { + print ".. c:function:: "; + } if ($args{'typedef'}) { print_lineno($declaration_start_line); @@ -935,7 +942,7 @@ sub output_function_rst(%) { output_highlight_rst($args{'purpose'}); $start = "\n\n**Syntax**\n\n ``"; } else { - print "``"; + print "``" if ($is_macro); } } if ($args{'functiontype'} ne "") { @@ -960,14 +967,12 @@ sub output_function_rst(%) { print $type; } } - if ($args{'typedef'}) { - print ");``\n\n"; + if ($is_macro) { + print ")``\n\n"; } else { - if ($sphinx_major < 3) { - print ")\n\n"; - } else { - print ")``\n"; - } + print ")\n\n"; + } + if (!$args{'typedef'}) { print_lineno($declaration_start_line); $lineprefix = " "; output_highlight_rst($args{'purpose'}); -- 2.26.2