From mboxrd@z Thu Jan 1 00:00:00 1970 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 462AAC433F5 for ; Wed, 19 Jan 2022 01:44:28 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D103982F5E; Wed, 19 Jan 2022 02:44:04 +0100 (CET) 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="kXQKvhda"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B2F09801EA; Wed, 19 Jan 2022 02:43:50 +0100 (CET) Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com [IPv6:2607:f8b0:4864:20::d30]) (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 C2ED183563 for ; Wed, 19 Jan 2022 02:43:44 +0100 (CET) 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-io1-xd30.google.com with SMTP id y22so957770iof.7 for ; Tue, 18 Jan 2022 17:43:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tPETFA/JjlffbQl9ut23/SDQrwhirkUj8rK6m21fi/A=; b=kXQKvhdaFnPw806kmKHjzfNzt5sk1WpdoEeoU4mzwugsc9IOEDBSdGhTRCg9hOXO/+ bGPha5Qv5OaEcxyV59YcOeNWIUQ9yIzM/wzvQ9G12/2w7+Tfg6iqE+JKdaOO8ShvVYtZ LqvJKDWQIfahjX+bGh7oPk8LOgwiAFsgGbPlY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tPETFA/JjlffbQl9ut23/SDQrwhirkUj8rK6m21fi/A=; b=DF4K/UWDPLjABeK7J1i6lTICwn6mb8tCP/LoGB+q5bGwFlmlvh05k/3lvmz7hrGzqC lsToYi07XqGCxB0zRgUEm6oa4gimyGceIElWzCvFq/0DmnmsGUhEn6Clg7S5TbaNfWpW xJNUGl0BG+2IbMxAlZzIkjuKaMTxQFlQo+caEUXdltJP9Gi7VYywijfR5fv8At+necCu kUVaqz39ZcZGkPNe5RpVL8vxP621/iuzl+BADBFfbdPSamcRAT/JMbFrOW1RQ4N4q0eZ PxZ098dx81ave17RGXk7b8HlMuloCdo8d5AyE28xJgzxUGeFDOZA3Ef1r92e5KeKEDD7 KbTg== X-Gm-Message-State: AOAM532Ce3kx6Hls32yPGtXYXpf4HvKVb/IQhiW/zF6x1uPi7ZxBsqVU u29ET7rAWmwK5nJgz8SlcbOAV8IstqXNTA== X-Google-Smtp-Source: ABdhPJzFeCDFbwi0maIDvYp2joJH05lGE+q3W8b1z2tM/ECymH7rM4QD/pox7LUsUWhFmsppCIWPYQ== X-Received: by 2002:a05:6602:200b:: with SMTP id y11mr14104858iod.121.1642556623367; Tue, 18 Jan 2022 17:43:43 -0800 (PST) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id j18sm10546314ila.86.2022.01.18.17.43.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jan 2022 17:43:43 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Daniel Schwierzeck , Dennis Gilmore , Steffen Jaeckel , Lukas Auer , Michal Simek , Tom Rini , Heinrich Schuchardt , Simon Glass , Marek Vasut , Pavel Herrmann Subject: [PATCH v3 05/31] dm: core: Rename uclass_get_by_name_len() Date: Tue, 18 Jan 2022 18:42:49 -0700 Message-Id: <20220119014315.1938157-6-sjg@chromium.org> X-Mailer: git-send-email 2.34.1.703.g22d0c6ccf7-goog In-Reply-To: <20220119014315.1938157-1-sjg@chromium.org> References: <20220119014315.1938157-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.2 at phobos.denx.de X-Virus-Status: Clean It seems that namelen is more common in U-Boot. Rename this function to fit in better. Signed-off-by: Simon Glass --- Changes in v3: - Add new patch to rename uclass_get_by_name_len() drivers/core/uclass.c | 7 ++++--- include/dm/uclass.h | 8 ++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c index 336ea8d243d..563ff9b2856 100644 --- a/drivers/core/uclass.c +++ b/drivers/core/uclass.c @@ -180,14 +180,15 @@ void uclass_set_priv(struct uclass *uc, void *priv) uc->priv_ = priv; } -enum uclass_id uclass_get_by_name_len(const char *name, int len) +enum uclass_id uclass_get_by_namelen(const char *name, int len) { int i; for (i = 0; i < UCLASS_COUNT; i++) { struct uclass_driver *uc_drv = lists_uclass_lookup(i); - if (uc_drv && !strncmp(uc_drv->name, name, len)) + if (uc_drv && !strncmp(uc_drv->name, name, len) && + strlen(uc_drv->name) == len) return i; } @@ -196,7 +197,7 @@ enum uclass_id uclass_get_by_name_len(const char *name, int len) enum uclass_id uclass_get_by_name(const char *name) { - return uclass_get_by_name_len(name, strlen(name)); + return uclass_get_by_namelen(name, strlen(name)); } int dev_get_uclass_index(struct udevice *dev, struct uclass **ucp) diff --git a/include/dm/uclass.h b/include/dm/uclass.h index 7f33c34214e..7876e9175e7 100644 --- a/include/dm/uclass.h +++ b/include/dm/uclass.h @@ -173,13 +173,13 @@ int uclass_get(enum uclass_id key, struct uclass **ucp); const char *uclass_get_name(enum uclass_id id); /** - * uclass_get_by_name_len() - Look up a uclass by its partial driver name + * uclass_get_by_namelen() - Look up a uclass by its driver name * * @name: Name to look up - * @len: Length of the partial name - * Return: the associated uclass ID, or UCLASS_INVALID if not found + * @len: Length of @name (the uclass driver name must have the same length) + * @returns the associated uclass ID, or UCLASS_INVALID if not found */ -enum uclass_id uclass_get_by_name_len(const char *name, int len); +enum uclass_id uclass_get_by_namelen(const char *name, int len); /** * uclass_get_by_name() - Look up a uclass by its driver name -- 2.34.1.703.g22d0c6ccf7-goog