Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C61DDC001B0 for ; Sun, 13 Aug 2023 14:28:41 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 23C5786983; Sun, 13 Aug 2023 16:27:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="YtrCyGdO"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CEFE18609B; Sun, 13 Aug 2023 16:27:34 +0200 (CEST) Received: from mail-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C1A6D8692C for ; Sun, 13 Aug 2023 16:27:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x131.google.com with SMTP id e9e14a558f8ab-3492c49c649so10887105ab.3 for ; Sun, 13 Aug 2023 07:27:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1691936851; x=1692541651; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OEGOUghlBFg3ebLmSahkjfn9QRgdGXXsaTN8MOWckAg=; b=YtrCyGdOnJ5R/4EMiMbeGb6ImwHfjktTaa5w5EVMr/o4Y2C+7ugMhtNjeFz+nQmzMc eqs4rfK6KTrntfspu8YPT+BGD3OnimPMhj3E+pffiClsiWtJxLv2NuPbgxh2Qdk27X3Z OSsgsH4AItxKDR0st2DjrSZyN9P/ZzdyhtaWA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691936851; x=1692541651; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OEGOUghlBFg3ebLmSahkjfn9QRgdGXXsaTN8MOWckAg=; b=LoGX7h+3+QOivDNOU8m1zpLIMmOLLqETGbETD0y5mU2O1ARe7MNGnkyBsa2OOhBsVd NoSMEF4CQ640X1+oGVC4t51aOxkLVIWr/q19DrsBDBobwz29QHhVN3knOyP2unu/tEAt YayQ4abyGs13mdylm8WWXGm4s3xblzHPZ0fg/LVK8qMXJnXZC7FLnmOcIt+f2s5AYLs6 JymcQCfj1C1LZcT9YmW10s8J6TmkWUExWPP8DirBPQjdt0hGuXpzD89NpzBGZLzH1ON4 EvIUpxvTutdSJZlupUpKSncvewgRFAsHBN1iUW+I939aB2tESIMdFjjYX1h8UhvfZuci 0Sew== X-Gm-Message-State: AOJu0Yxu81nctYcEUvuQBhdPFHttvg+XCvI2tVQGmTrueVX9iRAorpHg d7DmvIAaZBK/J6HgD45pZibqKGTQaZNq7b2We5o= X-Google-Smtp-Source: AGHT+IHiKJdgkrDEptjxdcvUY33OF96ym7ZZRHs+SEeg2+QSoaEi7tx06Jpvhu8YlaeRjIM4UzNXeQ== X-Received: by 2002:a92:c6c9:0:b0:349:8bd3:b5cb with SMTP id v9-20020a92c6c9000000b003498bd3b5cbmr8295905ilm.3.1691936851433; Sun, 13 Aug 2023 07:27:31 -0700 (PDT) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id w7-20020a02cf87000000b00430cf006d9bsm2280952jar.30.2023.08.13.07.27.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Aug 2023 07:27:31 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Heinrich Schuchardt , Joshua Watt , Stefan Herbrechtsmeier , Tobias Waldekranz Subject: [PATCH 07/24] part: Add comments for static functions Date: Sun, 13 Aug 2023 08:26:35 -0600 Message-ID: <20230813142708.361456-8-sjg@chromium.org> X-Mailer: git-send-email 2.41.0.640.ga95def55d0-goog In-Reply-To: <20230813142708.361456-1-sjg@chromium.org> References: <20230813142708.361456-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Some internal functions could do with a few comments, to explain what they do. Add these, to make the code easier to follow. Signed-off-by: Simon Glass --- disk/part.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/disk/part.c b/disk/part.c index 8035dcb8a429..9190e8806187 100644 --- a/disk/part.c +++ b/disk/part.c @@ -26,6 +26,12 @@ /* Check all partition types */ #define PART_TYPE_ALL -1 +/** + * part_driver_get_type() - Get a driver given its type + * + * @part_type: Partition type to find the driver for + * Return: Driver for that type, or NULL if none + */ static struct part_driver *part_driver_get_type(int part_type) { struct part_driver *drv = @@ -42,6 +48,22 @@ static struct part_driver *part_driver_get_type(int part_type) return NULL; } +/** + * part_driver_lookup_type() - Look up the partition driver for a blk device + * + * If @desc->part_type is PART_TYPE_UNKNOWN, this checks each parition driver + * against the blk device to see if there is a valid partition table acceptable + * to that driver. + * + * If @desc->part_type is already set, it just returns the driver for that + * type, without testing if the driver can find a valid partition on the + * descriptor. + * + * On success it updates @desc->part_type if set to PART_TYPE_UNKNOWN on entry + * + * @dev_desc: Device descriptor + * Return: Driver found, or NULL if none + */ static struct part_driver *part_driver_lookup_type(struct blk_desc *desc) { struct part_driver *drv = @@ -83,6 +105,16 @@ int part_get_type_by_name(const char *name) return PART_TYPE_UNKNOWN; } +/** + * get_dev_hwpart() - Get the descriptor for a device with hardware partitions + * + * @ifname: Interface name (e.g. "ide", "scsi") + * @dev: Device number (0 for first device on that interface, 1 for + * second, etc. + * @hwpart: Hardware partition, or 0 if none (used for MMC) + * Return: pointer to the block device, or NULL if not available, or an + * error occurred. + */ static struct blk_desc *get_dev_hwpart(const char *ifname, int dev, int hwpart) { struct blk_desc *desc; -- 2.41.0.640.ga95def55d0-goog