* [2.6.6-rc3-mm2] genhd-unregister warn handling
@ 2004-05-06 18:02 FabF
2004-05-06 21:40 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: FabF @ 2004-05-06 18:02 UTC (permalink / raw)
To: Andrew Morton; +Cc: lkml
[-- Attachment #1: Type: text/plain, Size: 223 bytes --]
Andrew,
Here's a patch against 2.6.6-rc3-mm2 genhd.c unregister_blkdev
-Standardize function for void xxx
-Split uncorresponding return
-Add printks
-Merge kfree to positive case
Could you apply ?
Regards,
Fabian
[-- Attachment #2: genhd1.diff --]
[-- Type: text/x-patch, Size: 1876 bytes --]
diff -Naur orig/drivers/block/genhd.c edited/drivers/block/genhd.c
--- orig/drivers/block/genhd.c 2004-04-04 05:37:06.000000000 +0200
+++ edited/drivers/block/genhd.c 2004-05-06 19:52:56.000000000 +0200
@@ -116,31 +116,33 @@
EXPORT_SYMBOL(register_blkdev);
-/* todo: make void - error printk here */
-int unregister_blkdev(unsigned int major, const char *name)
+void unregister_blkdev(unsigned int major, const char *name)
{
struct blk_major_name **n;
struct blk_major_name *p = NULL;
int index = major_to_index(major);
unsigned long flags;
- int ret = 0;
down_write(&block_subsys.rwsem);
spin_lock_irqsave(&major_names_lock, flags);
for (n = &major_names[index]; *n; n = &(*n)->next)
if ((*n)->major == major)
break;
- if (!*n || strcmp((*n)->name, name))
- ret = -EINVAL;
+ if (!*n)
+ printk(KERN_WARNING "Unable to unregister block device with major %d", major);
else {
- p = *n;
- *n = p->next;
+ if (strcmp((*n)->name, name))
+ printk(KERN_WARNING "Unable to unregister %s.Major name does not correspond", name);
+ else {
+ /*name was found in blk_major_name table.Skip it*/
+ p = *n;
+ *n = p->next;
+ kfree(p);
+ }
}
spin_unlock_irqrestore(&major_names_lock, flags);
up_write(&block_subsys.rwsem);
- kfree(p);
- return ret;
}
EXPORT_SYMBOL(unregister_blkdev);
diff -Naur orig/include/linux/fs.h edited/include/linux/fs.h
--- orig/include/linux/fs.h 2004-05-05 17:58:57.000000000 +0200
+++ edited/include/linux/fs.h 2004-05-06 19:19:26.000000000 +0200
@@ -1216,7 +1216,7 @@
#endif
extern int register_blkdev(unsigned int, const char *);
-extern int unregister_blkdev(unsigned int, const char *);
+extern void unregister_blkdev(unsigned int, const char *);
extern struct block_device *bdget(dev_t);
extern void bd_set_size(struct block_device *, loff_t size);
extern void bd_forget(struct inode *inode);
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [2.6.6-rc3-mm2] genhd-unregister warn handling
2004-05-06 18:02 [2.6.6-rc3-mm2] genhd-unregister warn handling FabF
@ 2004-05-06 21:40 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2004-05-06 21:40 UTC (permalink / raw)
To: FabF; +Cc: linux-kernel
FabF <Fabian.Frederick@skynet.be> wrote:
>
> Here's a patch against 2.6.6-rc3-mm2 genhd.c unregister_blkdev
>
> -Standardize function for void xxx
> -Split uncorresponding return
> -Add printks
> -Merge kfree to positive case
>
> Could you apply ?
It seems to be a gratuitous change to the modules API.
A quick grep shows that a lot of drivers are currently testing the
unregister_blkdev() return value - your patch breaks them all.
I don't see much point in making changes in this area.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-05-06 21:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-06 18:02 [2.6.6-rc3-mm2] genhd-unregister warn handling FabF
2004-05-06 21:40 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®