linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Greg KH <greg@kroah.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>,
	Kay Sievers <kay.sievers@vrfy.org>,
	linux-next@vger.kernel.org
Subject: dev_set_name (Was: linux-next: rr/driver-core merge conflicts)
Date: Fri, 30 May 2008 10:21:54 +1000	[thread overview]
Message-ID: <20080530102154.2f9798a5.sfr@canb.auug.org.au> (raw)
In-Reply-To: <20080529160944.GA10595@kroah.com>

Hi Greg,

On Thu, 29 May 2008 09:09:44 -0700 Greg KH <greg@kroah.com> wrote:
>
> On Thu, May 29, 2008 at 03:58:18PM +1000, Stephen Rothwell wrote:
> 
> > Greg, is there some way we could add a version of dev_set_name() to
> > current mainline now so that the conversions can be farmed out (or at
> > least be done in other trees destined for linux-next)?
> 
> Yes, I'll do that today, thanks for the idea.

I was hoping for something really simple that even Linus would take -
like below (compile tested only).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

>From f40fb678c1f10c363297dbfc4c97e913bb7c58a8 Mon Sep 17 00:00:00 2001
From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Fri, 30 May 2008 10:16:40 +1000
Subject: [PATCH] driver-core: preparte for 2.6.27 api change

Create the dev_set_name function now so that various subsystems can
start changing over to it before other changes in 2.6.27 will make it
compulsory.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 drivers/base/core.c    |   15 +++++++++++++++
 include/linux/device.h |    3 +++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index 72eccae..422cfca 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -760,6 +760,21 @@ static void device_remove_class_symlinks(struct device *dev)
 }
 
 /**
+ * dev_set_name - set a device name
+ * @dev: device
+ */
+int dev_set_name(struct device *dev, const char *fmt, ...)
+{
+	va_list vargs;
+
+	va_start(vargs, fmt);
+	vsnprintf(dev->bus_id, sizeof(dev->bus_id), fmt, vargs);
+	va_end(vargs);
+	return 0;
+}
+EXPORT_SYMBOL_GPL(dev_set_name);
+
+/**
  * device_add - add device to device hierarchy.
  * @dev: device.
  *
diff --git a/include/linux/device.h b/include/linux/device.h
index 14616e8..6a2d04c 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -385,6 +385,9 @@ static inline const char *dev_name(struct device *dev)
 	return dev->bus_id;
 }
 
+extern int dev_set_name(struct device *dev, const char *name, ...)
+			__attribute__((format(printf, 2, 3)));
+
 #ifdef CONFIG_NUMA
 static inline int dev_to_node(struct device *dev)
 {
-- 
1.5.5.2


  reply	other threads:[~2008-05-30  0:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-29  5:58 linux-next: rr/driver-core merge conflicts Stephen Rothwell
2008-05-29 16:09 ` Greg KH
2008-05-30  0:21   ` Stephen Rothwell [this message]
2008-05-30  2:37     ` dev_set_name (Was: linux-next: rr/driver-core merge conflicts) Greg KH
2008-05-30  5:44       ` Stephen Rothwell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080530102154.2f9798a5.sfr@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=greg@kroah.com \
    --cc=kay.sievers@vrfy.org \
    --cc=linux-next@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).