Message ID | 20230628153211.52988-3-andriy.shevchenko@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp9021917vqr; Wed, 28 Jun 2023 08:44:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5+PWVZT4Ty8vVfPf/5SgVLkYsvRKz8RBg00abqXnUeIdAAidig/Ld3+ZVZH6UYFev0rNxX X-Received: by 2002:a17:906:18:b0:992:c9d:fa6e with SMTP id 24-20020a170906001800b009920c9dfa6emr4705092eja.0.1687967061116; Wed, 28 Jun 2023 08:44:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687967061; cv=none; d=google.com; s=arc-20160816; b=kUacmeRRlr6NXpNcAJXzMlRVgsIcPNxmPq2dFdLG6zi6fplB/jk22zCOl6p4CoBinX SmruttlX5Y2hs7bJl/vbpsH4zU/5JxWEV1B2D4lP3+CuKU+98fcA45P38P7WQJcYYpRe RMh/itLq9j1q8fkaCQKFQJiiKV139RxU7HNxhHLXIEHWIDIopKrS53+hYHKe54ygOFYK G/rojT0TAZjdJyRwzpmDwWtzSL/j6TQ7Pqed0eGqOrcaOihTHbR68YF9umsHEe/R95gA Tx+z8RGRCjTALfSFaRi9wh8tZhED+AlpPvDqNoU8FYZhH89YZuguKBqQife4h6/U5uak 8zKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Gwb6f/frdoyDhlugn/dkbRaRWLY3CZfwAk6iNWws4+c=; fh=XrA2ku+PA66OSRadqxacVu9ngzn45Ll5WReP+bMahIs=; b=Ca9modu1WHGi14h862MDPoheQsGz8CLP2hQUT478fVaUQTt94b0EDC/gw3IZKb+4vd 4o4qw+muRgtOukjhRFPkp3uFZSNHss1jbnHN8X1ml4gZHnvKwwol17NVpmvsZSfZa9A7 zoAtjXyuubsUCrwb3QFs++K/9htpAXSYrKk6W8Go01VHWY6zgR2rOIUvy+AiruHzVClc vdpT4jJuNR1TJgGtyp8dPmshWWADT5UMXfDnXzikmND+nXEkKtzPF9eel5BJcE0s7Xm1 OPKaGQeHgtgoy2m3XYlOWuEffZj5A0wji3pHXoo5saV6IRO97JTfs/quPfNVTJWhFnn1 FOMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Pe4JDV6h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e6-20020a170906248600b009829ede9296si5160514ejb.83.2023.06.28.08.43.33; Wed, 28 Jun 2023 08:44:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Pe4JDV6h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232345AbjF1Pcm (ORCPT <rfc822;ivan.orlov0322@gmail.com> + 99 others); Wed, 28 Jun 2023 11:32:42 -0400 Received: from mga09.intel.com ([134.134.136.24]:19763 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232246AbjF1PcZ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 28 Jun 2023 11:32:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687966345; x=1719502345; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ICZEGmnjo8mIWqvcZaLyV+IHFzcjkKGkir9xoI+1F50=; b=Pe4JDV6hj+t1pbcIG166ayBe1LxLcekIvU0GVBDZPgQHgc724ZKeJGdd NqtufppbfzFRrOEYRHgDEv+hKCnmEZPYeJG55DTZEpo971gGfja5X57ye GdULcXQrxQzGgSKNBblr0hDwRRicqhcbRpI+X4CCbeu0CkJv2kK6QdzaI 4J77zu67GDvCqejQU1OAgGiEU6wHwuzOXFPWi6XtLuFIsvKdlswo8FcjQ 1nHqqcn1GApCU8wV9P1ZewlTl1qDX8niBqYx6p6hS+0Dq9XC0v1rIMpw8 ELLY+gm+NfoCZI42izQCEnNcnI6cQQMBzweWCOEN1t7rNR478AO58GZdP w==; X-IronPort-AV: E=McAfee;i="6600,9927,10755"; a="364426989" X-IronPort-AV: E=Sophos;i="6.01,165,1684825200"; d="scan'208";a="364426989" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jun 2023 08:32:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10755"; a="782344681" X-IronPort-AV: E=Sophos;i="6.01,165,1684825200"; d="scan'208";a="782344681" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 28 Jun 2023 08:32:13 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 967CE4DA; Wed, 28 Jun 2023 18:32:14 +0300 (EEST) From: Andy Shevchenko <andriy.shevchenko@linux.intel.com> To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Saravana Kannan <saravanak@google.com>, Andy Shevchenko <andriy.shevchenko@linux.intel.com>, Stephen Boyd <sboyd@kernel.org>, Dario Binacchi <dario.binacchi@amarulasolutions.com>, Tony Lindgren <tony@atomide.com>, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-tegra@vger.kernel.org, linux-omap@vger.kernel.org Cc: "Rafael J. Wysocki" <rafael@kernel.org>, Peter De Schrijver <pdeschrijver@nvidia.com>, Prashant Gaikwad <pgaikwad@nvidia.com>, Michael Turquette <mturquette@baylibre.com>, Thierry Reding <thierry.reding@gmail.com>, Jonathan Hunter <jonathanh@nvidia.com>, Tero Kristo <kristo@kernel.org>, Andy Shevchenko <andy@kernel.org> Subject: [PATCH v1 2/4] driver core: Replace kstrdup() + strreplace() with kstrdup_and_replace() Date: Wed, 28 Jun 2023 18:32:09 +0300 Message-Id: <20230628153211.52988-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230628153211.52988-1-andriy.shevchenko@linux.intel.com> References: <20230628153211.52988-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769961749061434623?= X-GMAIL-MSGID: =?utf-8?q?1769961749061434623?= |
Series |
clk: Add kstrdup_and_replace() helper and use it
|
|
Commit Message
Andy Shevchenko
June 28, 2023, 3:32 p.m. UTC
Replace open coded functionalify of kstrdup_and_replace() with a call.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/base/core.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
Comments
On Wed, Jun 28, 2023 at 06:32:09PM +0300, Andy Shevchenko wrote: > Replace open coded functionalify of kstrdup_and_replace() with a call. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > --- > drivers/base/core.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/base/core.c b/drivers/base/core.c > index 3dff5037943e..af0ee691520a 100644 > --- a/drivers/base/core.c > +++ b/drivers/base/core.c > @@ -17,7 +17,6 @@ > #include <linux/kstrtox.h> > #include <linux/module.h> > #include <linux/slab.h> > -#include <linux/string.h> > #include <linux/kdev_t.h> > #include <linux/notifier.h> > #include <linux/of.h> > @@ -28,6 +27,7 @@ > #include <linux/netdevice.h> > #include <linux/sched/signal.h> > #include <linux/sched/mm.h> > +#include <linux/string_helpers.h> > #include <linux/swiotlb.h> > #include <linux/sysfs.h> > #include <linux/dma-map-ops.h> /* for dma_default_coherent */ > @@ -3910,10 +3910,9 @@ const char *device_get_devnode(const struct device *dev, > return dev_name(dev); > > /* replace '!' in the name with '/' */ > - s = kstrdup(dev_name(dev), GFP_KERNEL); > + s = kstrdup_and_replace(dev_name(dev), '!', '/', GFP_KERNEL); > if (!s) > return NULL; > - strreplace(s, '!', '/'); > return *tmp = s; > } > > -- > 2.40.0.1.gaa8946217a0b > Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
On Fri, Aug 4, 2023 at 5:10 PM Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote: > > On Wed, Jun 28, 2023 at 06:32:09PM +0300, Andy Shevchenko wrote: > > Replace open coded functionalify of kstrdup_and_replace() with a call. Oh, here is a typo. ... > Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Thank you, Greg! Stephen, can you take the series now (okay, I think I need to send a new version with all tags and typos fixed)?
On Fri, Aug 04, 2023 at 05:30:49PM +0300, Andy Shevchenko wrote: > On Fri, Aug 4, 2023 at 5:10 PM Greg Kroah-Hartman > <gregkh@linuxfoundation.org> wrote: > > On Wed, Jun 28, 2023 at 06:32:09PM +0300, Andy Shevchenko wrote: ... > Stephen, can you take the series now (okay, I think I need to send a > new version with all tags and typos fixed)? v2 has been sent: 20230804143910.15504-1-andriy.shevchenko@linux.intel.com
diff --git a/drivers/base/core.c b/drivers/base/core.c index 3dff5037943e..af0ee691520a 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -17,7 +17,6 @@ #include <linux/kstrtox.h> #include <linux/module.h> #include <linux/slab.h> -#include <linux/string.h> #include <linux/kdev_t.h> #include <linux/notifier.h> #include <linux/of.h> @@ -28,6 +27,7 @@ #include <linux/netdevice.h> #include <linux/sched/signal.h> #include <linux/sched/mm.h> +#include <linux/string_helpers.h> #include <linux/swiotlb.h> #include <linux/sysfs.h> #include <linux/dma-map-ops.h> /* for dma_default_coherent */ @@ -3910,10 +3910,9 @@ const char *device_get_devnode(const struct device *dev, return dev_name(dev); /* replace '!' in the name with '/' */ - s = kstrdup(dev_name(dev), GFP_KERNEL); + s = kstrdup_and_replace(dev_name(dev), '!', '/', GFP_KERNEL); if (!s) return NULL; - strreplace(s, '!', '/'); return *tmp = s; }