LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* Re: [PATCH 158/196] Driver core: convert block from raw kobjects
@ 2008-01-25 23:23 Alexander van Heukelum
2008-01-26 7:31 ` Greg KH
2008-01-27 19:41 ` Greg KH
0 siblings, 2 replies; 3+ messages in thread
From: Alexander van Heukelum @ 2008-01-25 23:23 UTC (permalink / raw)
To: Alexander van Heukelum, Kay Sievers, Greg Kroah-Hartman, linux-kernel
Cc: Linus Torvalds
Fix build with CONFIG_BLOCK off.
Building git-2d94dfc with CONFIG_BLOCK turned off gives me:
drivers/base/core.c: In function 'device_add_class_symlinks':
drivers/base/core.c:704: error: 'part_type' undeclared (first use in this function)
drivers/base/core.c:704: error: (Each undeclared identifier is reported only once
drivers/base/core.c:704: error: for each function it appears in.)
drivers/base/core.c: In function 'device_remove_class_symlinks':
drivers/base/core.c:743: error: 'part_type' undeclared (first use in this function)
git-blame points to Kay Sievers.
The problem is obvious. I think te solution is too ;).
Tested with a silly configuration that contains just enough wits to boot
and get to the prompt of klibc-dash on the built-in initramfs using:
qemu -m 8 -cpu pentium -serial stdio -cdrom arch/x86/boot/image.iso
Compile-tested i386-defconfig.
Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
Oh, and the compile-problem still exists in git-99f1c97. The git-tree is
changing faster than I can test the patch and write an e-mail :-/.
diff --git a/drivers/base/core.c b/drivers/base/core.c
index edf3bbe..3751843 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -75,6 +75,15 @@ static ssize_t dev_attr_store(struct kobject *kobj, struct attribute *attr,
return ret;
}
+static int dev_needs_link(struct device *dev)
+{
+#ifdef CONFIG_BLOCK
+ return dev->type != &part_type;
+#else
+ return 1;
+#endif
+}
+
static struct sysfs_ops dev_sysfs_ops = {
.show = dev_attr_show,
.store = dev_attr_store,
@@ -652,14 +661,14 @@ static int device_add_class_symlinks(struct device *dev)
#ifdef CONFIG_SYSFS_DEPRECATED
/* stacked class devices need a symlink in the class directory */
if (dev->kobj.parent != &dev->class->subsys.kobj &&
- dev->type != &part_type) {
+ dev_needs_link(dev)) {
error = sysfs_create_link(&dev->class->subsys.kobj, &dev->kobj,
dev->bus_id);
if (error)
goto out_subsys;
}
- if (dev->parent && dev->type != &part_type) {
+ if (dev->parent && dev_needs_link(dev)) {
struct device *parent = dev->parent;
char *class_name;
@@ -688,11 +697,11 @@ static int device_add_class_symlinks(struct device *dev)
return 0;
out_device:
- if (dev->parent && dev->type != &part_type)
+ if (dev->parent && dev_needs_link(dev))
sysfs_remove_link(&dev->kobj, "device");
out_busid:
if (dev->kobj.parent != &dev->class->subsys.kobj &&
- dev->type != &part_type)
+ dev_needs_link(dev))
sysfs_remove_link(&dev->class->subsys.kobj, dev->bus_id);
#else
/* link in the class directory pointing to the device */
@@ -701,7 +710,7 @@ out_busid:
if (error)
goto out_subsys;
- if (dev->parent && dev->type != &part_type) {
+ if (dev->parent && dev_needs_link(dev)) {
error = sysfs_create_link(&dev->kobj, &dev->parent->kobj,
"device");
if (error)
@@ -725,7 +734,7 @@ static void device_remove_class_symlinks(struct device *dev)
return;
#ifdef CONFIG_SYSFS_DEPRECATED
- if (dev->parent && dev->type != &part_type) {
+ if (dev->parent && dev_needs_link(dev)) {
char *class_name;
class_name = make_class_name(dev->class->name, &dev->kobj);
@@ -737,10 +746,10 @@ static void device_remove_class_symlinks(struct device *dev)
}
if (dev->kobj.parent != &dev->class->subsys.kobj &&
- dev->type != &part_type)
+ dev_needs_link(dev))
sysfs_remove_link(&dev->class->subsys.kobj, dev->bus_id);
#else
- if (dev->parent && dev->type != &part_type)
+ if (dev->parent && dev_needs_link(dev))
sysfs_remove_link(&dev->kobj, "device");
sysfs_remove_link(&dev->class->subsys.kobj, dev->bus_id);
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 158/196] Driver core: convert block from raw kobjects
2008-01-25 23:23 [PATCH 158/196] Driver core: convert block from raw kobjects Alexander van Heukelum
@ 2008-01-26 7:31 ` Greg KH
2008-01-27 19:41 ` Greg KH
1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2008-01-26 7:31 UTC (permalink / raw)
To: Alexander van Heukelum
Cc: Alexander van Heukelum, Kay Sievers, linux-kernel, Linus Torvalds
On Sat, Jan 26, 2008 at 12:23:18AM +0100, Alexander van Heukelum wrote:
> Fix build with CONFIG_BLOCK off.
>
> Building git-2d94dfc with CONFIG_BLOCK turned off gives me:
>
> drivers/base/core.c: In function 'device_add_class_symlinks':
> drivers/base/core.c:704: error: 'part_type' undeclared (first use in this function)
> drivers/base/core.c:704: error: (Each undeclared identifier is reported only once
> drivers/base/core.c:704: error: for each function it appears in.)
> drivers/base/core.c: In function 'device_remove_class_symlinks':
> drivers/base/core.c:743: error: 'part_type' undeclared (first use in this function)
>
> git-blame points to Kay Sievers.
>
> The problem is obvious. I think te solution is too ;).
Heh, thanks, I'll test this in the morning, it's been a long day...
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 158/196] Driver core: convert block from raw kobjects
2008-01-25 23:23 [PATCH 158/196] Driver core: convert block from raw kobjects Alexander van Heukelum
2008-01-26 7:31 ` Greg KH
@ 2008-01-27 19:41 ` Greg KH
1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2008-01-27 19:41 UTC (permalink / raw)
To: Alexander van Heukelum
Cc: Alexander van Heukelum, Kay Sievers, linux-kernel, Linus Torvalds
On Sat, Jan 26, 2008 at 12:23:18AM +0100, Alexander van Heukelum wrote:
> Fix build with CONFIG_BLOCK off.
>
> Building git-2d94dfc with CONFIG_BLOCK turned off gives me:
>
> drivers/base/core.c: In function 'device_add_class_symlinks':
> drivers/base/core.c:704: error: 'part_type' undeclared (first use in this function)
> drivers/base/core.c:704: error: (Each undeclared identifier is reported only once
> drivers/base/core.c:704: error: for each function it appears in.)
> drivers/base/core.c: In function 'device_remove_class_symlinks':
> drivers/base/core.c:743: error: 'part_type' undeclared (first use in this function)
>
> git-blame points to Kay Sievers.
>
> The problem is obvious. I think te solution is too ;).
>
> Tested with a silly configuration that contains just enough wits to boot
> and get to the prompt of klibc-dash on the built-in initramfs using:
> qemu -m 8 -cpu pentium -serial stdio -cdrom arch/x86/boot/image.iso
>
> Compile-tested i386-defconfig.
>
> Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
>
> Oh, and the compile-problem still exists in git-99f1c97. The git-tree is
> changing faster than I can test the patch and write an e-mail :-/.
>
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index edf3bbe..3751843 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -75,6 +75,15 @@ static ssize_t dev_attr_store(struct kobject *kobj, struct attribute *attr,
> return ret;
> }
>
> +static int dev_needs_link(struct device *dev)
> +{
> +#ifdef CONFIG_BLOCK
> + return dev->type != &part_type;
> +#else
> + return 1;
> +#endif
> +}
Ick. Close, but still messy, let me try to do something cleaner here...
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-01-27 19:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-25 23:23 [PATCH 158/196] Driver core: convert block from raw kobjects Alexander van Heukelum
2008-01-26 7:31 ` Greg KH
2008-01-27 19:41 ` Greg KH
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).