* [PATCHv3 0/9] mtd: Remove static limit on device numbers
@ 2010-01-29 20:55 Ben Hutchings
2010-01-29 20:57 ` [PATCHv3 1/9] mtd: Introduce and use iteration macro for reading the MTD device table Ben Hutchings
` (9 more replies)
0 siblings, 10 replies; 14+ messages in thread
From: Ben Hutchings @ 2010-01-29 20:55 UTC (permalink / raw)
To: David Woodhouse; +Cc: linux-net-drivers, linux-mtd
This is the third version of this patch series. Please give me some
feedback, David?
Changes since v2:
- Export idr_get_next() to support building mtdcore as a module
- Correct the limit on block device numbers in mtd_blkdevs
- Register the full range of minor numbers in mtdchar
Ben.
Ben Hutchings (9):
mtd: Introduce and use iteration macro for reading the MTD device
table
mtd: Use get_mtd_device_nm() to find named device in get_sb_mtd()
nandsim: Define CONFIG_NANDSIM_MAX_PARTS and use it instead of
MAX_MTD_DEVICES
mtd: Remove unnecessary comparisons with MAX_MTD_DEVICES
mtdblock: Dynamically allocate cache info structures
idr: Export idr_get_next()
mtd: Replace static array of devices with an idr structure
mtd: Raise limit on block device minor numbers
mtdchar: Register the full range of minor numbers
drivers/mtd/devices/pmc551.c | 4 +-
drivers/mtd/mtd_blkdevs.c | 17 ++--
drivers/mtd/mtdblock.c | 74 +++++++---------
drivers/mtd/mtdchar.c | 8 +-
drivers/mtd/mtdcore.c | 205 +++++++++++++++++++++--------------------
drivers/mtd/mtdcore.h | 7 ++-
drivers/mtd/mtdoops.c | 5 -
drivers/mtd/mtdsuper.c | 18 ++---
drivers/mtd/nand/nandsim.c | 7 +-
include/linux/mtd/mtd.h | 1 -
lib/idr.c | 2 +-
11 files changed, 169 insertions(+), 179 deletions(-)
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCHv3 1/9] mtd: Introduce and use iteration macro for reading the MTD device table
2010-01-29 20:55 [PATCHv3 0/9] mtd: Remove static limit on device numbers Ben Hutchings
@ 2010-01-29 20:57 ` Ben Hutchings
2010-01-29 20:57 ` [PATCHv3 2/9] mtd: Use get_mtd_device_nm() to find named device in get_sb_mtd() Ben Hutchings
` (8 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: Ben Hutchings @ 2010-01-29 20:57 UTC (permalink / raw)
To: David Woodhouse; +Cc: linux-net-drivers, linux-mtd
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/mtd/mtd_blkdevs.c | 10 ++++----
drivers/mtd/mtdcore.c | 54 ++++++++++++++++++++------------------------
drivers/mtd/mtdcore.h | 15 ++++++++++++
3 files changed, 45 insertions(+), 34 deletions(-)
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index c82e09b..85a52b3 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -335,7 +335,8 @@ static struct mtd_notifier blktrans_notifier = {
int register_mtd_blktrans(struct mtd_blktrans_ops *tr)
{
- int ret, i;
+ struct mtd_info *mtd;
+ int ret;
/* Register the notifier if/when the first device type is
registered, to prevent the link/init ordering from fucking
@@ -389,10 +390,9 @@ int register_mtd_blktrans(struct mtd_blktrans_ops *tr)
INIT_LIST_HEAD(&tr->devs);
list_add(&tr->list, &blktrans_majors);
- for (i=0; i<MAX_MTD_DEVICES; i++) {
- if (mtd_table[i] && mtd_table[i]->type != MTD_ABSENT)
- tr->add_mtd(tr, mtd_table[i]);
- }
+ mtd_for_each_device(mtd)
+ if (mtd->type != MTD_ABSENT)
+ tr->add_mtd(tr, mtd);
mutex_unlock(&mtd_table_mutex);
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index c356c0a..402d417 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -381,7 +381,7 @@ int del_mtd_device (struct mtd_info *mtd)
void register_mtd_user (struct mtd_notifier *new)
{
- int i;
+ struct mtd_info *mtd;
mutex_lock(&mtd_table_mutex);
@@ -389,9 +389,8 @@ void register_mtd_user (struct mtd_notifier *new)
__module_get(THIS_MODULE);
- for (i=0; i< MAX_MTD_DEVICES; i++)
- if (mtd_table[i])
- new->add(mtd_table[i]);
+ mtd_for_each_device(mtd)
+ new->add(mtd);
mutex_unlock(&mtd_table_mutex);
}
@@ -408,15 +407,14 @@ void register_mtd_user (struct mtd_notifier *new)
int unregister_mtd_user (struct mtd_notifier *old)
{
- int i;
+ struct mtd_info *mtd;
mutex_lock(&mtd_table_mutex);
module_put(THIS_MODULE);
- for (i=0; i< MAX_MTD_DEVICES; i++)
- if (mtd_table[i])
- old->remove(mtd_table[i]);
+ mtd_for_each_device(mtd)
+ old->remove(mtd);
list_del(&old->list);
mutex_unlock(&mtd_table_mutex);
@@ -438,15 +436,18 @@ int unregister_mtd_user (struct mtd_notifier *old)
struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num)
{
- struct mtd_info *ret = NULL;
- int i, err = -ENODEV;
+ struct mtd_info *ret = NULL, *other;
+ int err = -ENODEV;
mutex_lock(&mtd_table_mutex);
if (num == -1) {
- for (i=0; i< MAX_MTD_DEVICES; i++)
- if (mtd_table[i] == mtd)
- ret = mtd_table[i];
+ mtd_for_each_device(other) {
+ if (other == mtd) {
+ ret = mtd;
+ break;
+ }
+ }
} else if (num >= 0 && num < MAX_MTD_DEVICES) {
ret = mtd_table[num];
if (mtd && mtd != ret)
@@ -487,14 +488,14 @@ out_unlock:
struct mtd_info *get_mtd_device_nm(const char *name)
{
- int i, err = -ENODEV;
- struct mtd_info *mtd = NULL;
+ int err = -ENODEV;
+ struct mtd_info *mtd = NULL, *other;
mutex_lock(&mtd_table_mutex);
- for (i = 0; i < MAX_MTD_DEVICES; i++) {
- if (mtd_table[i] && !strcmp(name, mtd_table[i]->name)) {
- mtd = mtd_table[i];
+ mtd_for_each_device(other) {
+ if (!strcmp(name, other->name)) {
+ mtd = other;
break;
}
}
@@ -581,14 +582,9 @@ EXPORT_SYMBOL_GPL(default_mtd_writev);
static struct proc_dir_entry *proc_mtd;
-static inline int mtd_proc_info (char *buf, int i)
+static inline int mtd_proc_info(char *buf, struct mtd_info *this)
{
- struct mtd_info *this = mtd_table[i];
-
- if (!this)
- return 0;
-
- return sprintf(buf, "mtd%d: %8.8llx %8.8x \"%s\"\n", i,
+ return sprintf(buf, "mtd%d: %8.8llx %8.8x \"%s\"\n", this->index,
(unsigned long long)this->size,
this->erasesize, this->name);
}
@@ -596,15 +592,15 @@ static inline int mtd_proc_info (char *buf, int i)
static int mtd_read_proc (char *page, char **start, off_t off, int count,
int *eof, void *data_unused)
{
- int len, l, i;
+ struct mtd_info *mtd;
+ int len, l;
off_t begin = 0;
mutex_lock(&mtd_table_mutex);
len = sprintf(page, "dev: size erasesize name\n");
- for (i=0; i< MAX_MTD_DEVICES; i++) {
-
- l = mtd_proc_info(page + len, i);
+ mtd_for_each_device(mtd) {
+ l = mtd_proc_info(page + len, mtd);
len += l;
if (len+begin > off+count)
goto done;
diff --git a/drivers/mtd/mtdcore.h b/drivers/mtd/mtdcore.h
index a33251f..e2f93a3 100644
--- a/drivers/mtd/mtdcore.h
+++ b/drivers/mtd/mtdcore.h
@@ -9,3 +9,18 @@
extern struct mutex mtd_table_mutex;
extern struct mtd_info *mtd_table[MAX_MTD_DEVICES];
+
+static inline struct mtd_info *__mtd_next_device(int i)
+{
+ while (i < MAX_MTD_DEVICES) {
+ if (mtd_table[i])
+ return mtd_table[i];
+ i++;
+ }
+ return NULL;
+}
+
+#define mtd_for_each_device(mtd) \
+ for ((mtd) = __mtd_next_device(0); \
+ (mtd) != NULL; \
+ (mtd) = __mtd_next_device(mtd->index + 1))
--
1.5.5
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCHv3 2/9] mtd: Use get_mtd_device_nm() to find named device in get_sb_mtd()
2010-01-29 20:55 [PATCHv3 0/9] mtd: Remove static limit on device numbers Ben Hutchings
2010-01-29 20:57 ` [PATCHv3 1/9] mtd: Introduce and use iteration macro for reading the MTD device table Ben Hutchings
@ 2010-01-29 20:57 ` Ben Hutchings
2010-01-29 20:58 ` [PATCHv3 3/9] nandsim: Define CONFIG_NANDSIM_MAX_PARTS and use it instead of MAX_MTD_DEVICES Ben Hutchings
` (7 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: Ben Hutchings @ 2010-01-29 20:57 UTC (permalink / raw)
To: David Woodhouse; +Cc: linux-net-drivers, linux-mtd
This removes the need to know the number of MTD devices.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/mtd/mtdsuper.c | 18 ++++++------------
1 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/drivers/mtd/mtdsuper.c b/drivers/mtd/mtdsuper.c
index af8b42e..d257052 100644
--- a/drivers/mtd/mtdsuper.c
+++ b/drivers/mtd/mtdsuper.c
@@ -150,18 +150,12 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
DEBUG(1, "MTDSB: mtd:%%s, name \"%s\"\n",
dev_name + 4);
- for (mtdnr = 0; mtdnr < MAX_MTD_DEVICES; mtdnr++) {
- mtd = get_mtd_device(NULL, mtdnr);
- if (!IS_ERR(mtd)) {
- if (!strcmp(mtd->name, dev_name + 4))
- return get_sb_mtd_aux(
- fs_type, flags,
- dev_name, data, mtd,
- fill_super, mnt);
-
- put_mtd_device(mtd);
- }
- }
+ mtd = get_mtd_device_nm(dev_name + 4);
+ if (!IS_ERR(mtd))
+ return get_sb_mtd_aux(
+ fs_type, flags,
+ dev_name, data, mtd,
+ fill_super, mnt);
printk(KERN_NOTICE "MTD:"
" MTD device with name \"%s\" not found.\n",
--
1.5.5
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCHv3 3/9] nandsim: Define CONFIG_NANDSIM_MAX_PARTS and use it instead of MAX_MTD_DEVICES
2010-01-29 20:55 [PATCHv3 0/9] mtd: Remove static limit on device numbers Ben Hutchings
2010-01-29 20:57 ` [PATCHv3 1/9] mtd: Introduce and use iteration macro for reading the MTD device table Ben Hutchings
2010-01-29 20:57 ` [PATCHv3 2/9] mtd: Use get_mtd_device_nm() to find named device in get_sb_mtd() Ben Hutchings
@ 2010-01-29 20:58 ` Ben Hutchings
2010-01-29 20:58 ` [PATCHv3 4/9] mtd: Remove unnecessary comparisons with MAX_MTD_DEVICES Ben Hutchings
` (6 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: Ben Hutchings @ 2010-01-29 20:58 UTC (permalink / raw)
To: David Woodhouse; +Cc: linux-net-drivers, linux-mtd
MAX_MTD_DEVICES is about to be removed.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
This shouldn't really be named CONFIG_anything, but it is consistent
with the other compile-time settings in this driver.
Ben.
drivers/mtd/nand/nandsim.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
index 7281000..58c255e 100644
--- a/drivers/mtd/nand/nandsim.c
+++ b/drivers/mtd/nand/nandsim.c
@@ -80,6 +80,9 @@
#ifndef CONFIG_NANDSIM_DBG
#define CONFIG_NANDSIM_DBG 0
#endif
+#ifndef CONFIG_NANDSIM_MAX_PARTS
+#define CONFIG_NANDSIM_MAX_PARTS 32
+#endif
static uint first_id_byte = CONFIG_NANDSIM_FIRST_ID_BYTE;
static uint second_id_byte = CONFIG_NANDSIM_SECOND_ID_BYTE;
@@ -94,7 +97,7 @@ static uint bus_width = CONFIG_NANDSIM_BUS_WIDTH;
static uint do_delays = CONFIG_NANDSIM_DO_DELAYS;
static uint log = CONFIG_NANDSIM_LOG;
static uint dbg = CONFIG_NANDSIM_DBG;
-static unsigned long parts[MAX_MTD_DEVICES];
+static unsigned long parts[CONFIG_NANDSIM_MAX_PARTS];
static unsigned int parts_num;
static char *badblocks = NULL;
static char *weakblocks = NULL;
@@ -288,7 +291,7 @@ union ns_mem {
* The structure which describes all the internal simulator data.
*/
struct nandsim {
- struct mtd_partition partitions[MAX_MTD_DEVICES];
+ struct mtd_partition partitions[CONFIG_NANDSIM_MAX_PARTS];
unsigned int nbparts;
uint busw; /* flash chip bus width (8 or 16) */
--
1.5.5
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCHv3 4/9] mtd: Remove unnecessary comparisons with MAX_MTD_DEVICES
2010-01-29 20:55 [PATCHv3 0/9] mtd: Remove static limit on device numbers Ben Hutchings
` (2 preceding siblings ...)
2010-01-29 20:58 ` [PATCHv3 3/9] nandsim: Define CONFIG_NANDSIM_MAX_PARTS and use it instead of MAX_MTD_DEVICES Ben Hutchings
@ 2010-01-29 20:58 ` Ben Hutchings
2010-02-25 11:42 ` David Woodhouse
2010-01-29 20:58 ` [PATCHv3 5/9] mtdblock: Dynamically allocate cache info structures Ben Hutchings
` (5 subsequent siblings)
9 siblings, 1 reply; 14+ messages in thread
From: Ben Hutchings @ 2010-01-29 20:58 UTC (permalink / raw)
To: David Woodhouse; +Cc: linux-net-drivers, linux-mtd
MAX_MTD_DEVICES is about to be removed.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/mtd/devices/pmc551.c | 4 ++--
drivers/mtd/mtdchar.c | 3 ---
drivers/mtd/mtdoops.c | 5 -----
3 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/drivers/mtd/devices/pmc551.c b/drivers/mtd/devices/pmc551.c
index d2fd550..fc8ea0a 100644
--- a/drivers/mtd/devices/pmc551.c
+++ b/drivers/mtd/devices/pmc551.c
@@ -668,7 +668,7 @@ static int __init init_pmc551(void)
{
struct pci_dev *PCI_Device = NULL;
struct mypriv *priv;
- int count, found = 0;
+ int found = 0;
struct mtd_info *mtd;
u32 length = 0;
@@ -695,7 +695,7 @@ static int __init init_pmc551(void)
/*
* PCU-bus chipset probe.
*/
- for (count = 0; count < MAX_MTD_DEVICES; count++) {
+ for (;;) {
if ((PCI_Device = pci_get_device(PCI_VENDOR_ID_V3_SEMI,
PCI_DEVICE_ID_V3_SEMI_V370PDC,
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 5b081cb..04fd7e5 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -67,9 +67,6 @@ static int mtd_open(struct inode *inode, struct file *file)
DEBUG(MTD_DEBUG_LEVEL0, "MTD_open\n");
- if (devnum >= MAX_MTD_DEVICES)
- return -ENODEV;
-
/* You can't open the RO devices RW */
if ((file->f_mode & FMODE_WRITE) && (minor & 1))
return -EACCES;
diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c
index 92e12df..328313c 100644
--- a/drivers/mtd/mtdoops.c
+++ b/drivers/mtd/mtdoops.c
@@ -429,11 +429,6 @@ static int __init mtdoops_init(void)
mtd_index = simple_strtoul(mtddev, &endp, 0);
if (*endp == '\0')
cxt->mtd_index = mtd_index;
- if (cxt->mtd_index > MAX_MTD_DEVICES) {
- printk(KERN_ERR "mtdoops: invalid mtd device number (%u) given\n",
- mtd_index);
- return -EINVAL;
- }
cxt->oops_buf = vmalloc(record_size);
if (!cxt->oops_buf) {
--
1.5.5
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCHv3 5/9] mtdblock: Dynamically allocate cache info structures
2010-01-29 20:55 [PATCHv3 0/9] mtd: Remove static limit on device numbers Ben Hutchings
` (3 preceding siblings ...)
2010-01-29 20:58 ` [PATCHv3 4/9] mtd: Remove unnecessary comparisons with MAX_MTD_DEVICES Ben Hutchings
@ 2010-01-29 20:58 ` Ben Hutchings
2010-01-29 20:59 ` [PATCHv3 6/9] idr: Export idr_get_next() Ben Hutchings
` (4 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: Ben Hutchings @ 2010-01-29 20:58 UTC (permalink / raw)
To: David Woodhouse; +Cc: linux-net-drivers, linux-mtd
Since we allocate struct mtd_blktrans_dev for each block device, we
can add our own structure members to the end. Therefore embed
struct mtd_blktrans_dev in struct mtdblk_dev and remove the static
array of struct mtdblk_dev. Also remove the redundant pointer to
struct mtd_info.
This is preparation for removing the static limit on the number of MTD
devices.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/mtd/mtdblock.c | 74 ++++++++++++++++++++----------------------------
1 files changed, 31 insertions(+), 43 deletions(-)
diff --git a/drivers/mtd/mtdblock.c b/drivers/mtd/mtdblock.c
index 9f41b1a..69f6bf2 100644
--- a/drivers/mtd/mtdblock.c
+++ b/drivers/mtd/mtdblock.c
@@ -19,15 +19,15 @@
#include <linux/mutex.h>
-static struct mtdblk_dev {
- struct mtd_info *mtd;
+struct mtdblk_dev {
+ struct mtd_blktrans_dev mbd;
int count;
struct mutex cache_mutex;
unsigned char *cache_data;
unsigned long cache_offset;
unsigned int cache_size;
enum { STATE_EMPTY, STATE_CLEAN, STATE_DIRTY } cache_state;
-} *mtdblks[MAX_MTD_DEVICES];
+};
static struct mutex mtdblks_lock;
@@ -98,7 +98,7 @@ static int erase_write (struct mtd_info *mtd, unsigned long pos,
static int write_cached_data (struct mtdblk_dev *mtdblk)
{
- struct mtd_info *mtd = mtdblk->mtd;
+ struct mtd_info *mtd = mtdblk->mbd.mtd;
int ret;
if (mtdblk->cache_state != STATE_DIRTY)
@@ -128,7 +128,7 @@ static int write_cached_data (struct mtdblk_dev *mtdblk)
static int do_cached_write (struct mtdblk_dev *mtdblk, unsigned long pos,
int len, const char *buf)
{
- struct mtd_info *mtd = mtdblk->mtd;
+ struct mtd_info *mtd = mtdblk->mbd.mtd;
unsigned int sect_size = mtdblk->cache_size;
size_t retlen;
int ret;
@@ -198,7 +198,7 @@ static int do_cached_write (struct mtdblk_dev *mtdblk, unsigned long pos,
static int do_cached_read (struct mtdblk_dev *mtdblk, unsigned long pos,
int len, char *buf)
{
- struct mtd_info *mtd = mtdblk->mtd;
+ struct mtd_info *mtd = mtdblk->mbd.mtd;
unsigned int sect_size = mtdblk->cache_size;
size_t retlen;
int ret;
@@ -244,16 +244,16 @@ static int do_cached_read (struct mtdblk_dev *mtdblk, unsigned long pos,
static int mtdblock_readsect(struct mtd_blktrans_dev *dev,
unsigned long block, char *buf)
{
- struct mtdblk_dev *mtdblk = mtdblks[dev->devnum];
+ struct mtdblk_dev *mtdblk = container_of(dev, struct mtdblk_dev, mbd);
return do_cached_read(mtdblk, block<<9, 512, buf);
}
static int mtdblock_writesect(struct mtd_blktrans_dev *dev,
unsigned long block, char *buf)
{
- struct mtdblk_dev *mtdblk = mtdblks[dev->devnum];
+ struct mtdblk_dev *mtdblk = container_of(dev, struct mtdblk_dev, mbd);
if (unlikely(!mtdblk->cache_data && mtdblk->cache_size)) {
- mtdblk->cache_data = vmalloc(mtdblk->mtd->erasesize);
+ mtdblk->cache_data = vmalloc(mtdblk->mbd.mtd->erasesize);
if (!mtdblk->cache_data)
return -EINTR;
/* -EINTR is not really correct, but it is the best match
@@ -266,37 +266,26 @@ static int mtdblock_writesect(struct mtd_blktrans_dev *dev,
static int mtdblock_open(struct mtd_blktrans_dev *mbd)
{
- struct mtdblk_dev *mtdblk;
- struct mtd_info *mtd = mbd->mtd;
- int dev = mbd->devnum;
+ struct mtdblk_dev *mtdblk = container_of(mbd, struct mtdblk_dev, mbd);
DEBUG(MTD_DEBUG_LEVEL1,"mtdblock_open\n");
mutex_lock(&mtdblks_lock);
- if (mtdblks[dev]) {
- mtdblks[dev]->count++;
+ if (mtdblk->count) {
+ mtdblk->count++;
mutex_unlock(&mtdblks_lock);
return 0;
}
/* OK, it's not open. Create cache info for it */
- mtdblk = kzalloc(sizeof(struct mtdblk_dev), GFP_KERNEL);
- if (!mtdblk) {
- mutex_unlock(&mtdblks_lock);
- return -ENOMEM;
- }
-
mtdblk->count = 1;
- mtdblk->mtd = mtd;
-
mutex_init(&mtdblk->cache_mutex);
mtdblk->cache_state = STATE_EMPTY;
- if ( !(mtdblk->mtd->flags & MTD_NO_ERASE) && mtdblk->mtd->erasesize) {
- mtdblk->cache_size = mtdblk->mtd->erasesize;
+ if (!(mbd->mtd->flags & MTD_NO_ERASE) && mbd->mtd->erasesize) {
+ mtdblk->cache_size = mbd->mtd->erasesize;
mtdblk->cache_data = NULL;
}
- mtdblks[dev] = mtdblk;
mutex_unlock(&mtdblks_lock);
DEBUG(MTD_DEBUG_LEVEL1, "ok\n");
@@ -306,8 +295,7 @@ static int mtdblock_open(struct mtd_blktrans_dev *mbd)
static int mtdblock_release(struct mtd_blktrans_dev *mbd)
{
- int dev = mbd->devnum;
- struct mtdblk_dev *mtdblk = mtdblks[dev];
+ struct mtdblk_dev *mtdblk = container_of(mbd, struct mtdblk_dev, mbd);
DEBUG(MTD_DEBUG_LEVEL1, "mtdblock_release\n");
@@ -318,12 +306,10 @@ static int mtdblock_release(struct mtd_blktrans_dev *mbd)
mutex_unlock(&mtdblk->cache_mutex);
if (!--mtdblk->count) {
- /* It was the last usage. Free the device */
- mtdblks[dev] = NULL;
- if (mtdblk->mtd->sync)
- mtdblk->mtd->sync(mtdblk->mtd);
+ /* It was the last usage. Free the cache */
+ if (mbd->mtd->sync)
+ mbd->mtd->sync(mbd->mtd);
vfree(mtdblk->cache_data);
- kfree(mtdblk);
}
mutex_unlock(&mtdblks_lock);
@@ -335,40 +321,42 @@ static int mtdblock_release(struct mtd_blktrans_dev *mbd)
static int mtdblock_flush(struct mtd_blktrans_dev *dev)
{
- struct mtdblk_dev *mtdblk = mtdblks[dev->devnum];
+ struct mtdblk_dev *mtdblk = container_of(dev, struct mtdblk_dev, mbd);
mutex_lock(&mtdblk->cache_mutex);
write_cached_data(mtdblk);
mutex_unlock(&mtdblk->cache_mutex);
- if (mtdblk->mtd->sync)
- mtdblk->mtd->sync(mtdblk->mtd);
+ if (dev->mtd->sync)
+ dev->mtd->sync(dev->mtd);
return 0;
}
static void mtdblock_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
{
- struct mtd_blktrans_dev *dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ struct mtdblk_dev *dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (!dev)
return;
- dev->mtd = mtd;
- dev->devnum = mtd->index;
+ dev->mbd.mtd = mtd;
+ dev->mbd.devnum = mtd->index;
- dev->size = mtd->size >> 9;
- dev->tr = tr;
+ dev->mbd.size = mtd->size >> 9;
+ dev->mbd.tr = tr;
if (!(mtd->flags & MTD_WRITEABLE))
- dev->readonly = 1;
+ dev->mbd.readonly = 1;
- add_mtd_blktrans_dev(dev);
+ add_mtd_blktrans_dev(&dev->mbd);
}
static void mtdblock_remove_dev(struct mtd_blktrans_dev *dev)
{
+ struct mtdblk_dev *mtdblk = container_of(dev, struct mtdblk_dev, mbd);
+
del_mtd_blktrans_dev(dev);
- kfree(dev);
+ kfree(mtdblk);
}
static struct mtd_blktrans_ops mtdblock_tr = {
--
1.5.5
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCHv3 6/9] idr: Export idr_get_next()
2010-01-29 20:55 [PATCHv3 0/9] mtd: Remove static limit on device numbers Ben Hutchings
` (4 preceding siblings ...)
2010-01-29 20:58 ` [PATCHv3 5/9] mtdblock: Dynamically allocate cache info structures Ben Hutchings
@ 2010-01-29 20:59 ` Ben Hutchings
2010-02-08 15:14 ` Artem Bityutskiy
2010-01-29 20:59 ` [PATCHv3 7/9] mtd: Replace static array of devices with an idr structure Ben Hutchings
` (3 subsequent siblings)
9 siblings, 1 reply; 14+ messages in thread
From: Ben Hutchings @ 2010-01-29 20:59 UTC (permalink / raw)
To: David Woodhouse; +Cc: sf-linux-drivers, linux-mtd, KAMEZAWA Hiroyuki
idr_get_next() was accidentally not exported when added. It is about
to be used by mtdcore, which may be built as a module.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
lib/idr.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/idr.c b/lib/idr.c
index 1cac726..21f9266 100644
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -621,7 +621,7 @@ void *idr_get_next(struct idr *idp, int *nextidp)
}
return NULL;
}
-
+EXPORT_SYMBOL(idr_get_next);
/**
--
1.5.5
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCHv3 7/9] mtd: Replace static array of devices with an idr structure
2010-01-29 20:55 [PATCHv3 0/9] mtd: Remove static limit on device numbers Ben Hutchings
` (5 preceding siblings ...)
2010-01-29 20:59 ` [PATCHv3 6/9] idr: Export idr_get_next() Ben Hutchings
@ 2010-01-29 20:59 ` Ben Hutchings
2010-01-29 20:59 ` [PATCHv3 8/9] mtd: Raise limit on block device minor numbers Ben Hutchings
` (2 subsequent siblings)
9 siblings, 0 replies; 14+ messages in thread
From: Ben Hutchings @ 2010-01-29 20:59 UTC (permalink / raw)
To: David Woodhouse; +Cc: linux-net-drivers, linux-mtd
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/mtd/mtdcore.c | 151 +++++++++++++++++++++++++----------------------
drivers/mtd/mtdcore.h | 12 +----
include/linux/mtd/mtd.h | 1 -
3 files changed, 81 insertions(+), 83 deletions(-)
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 402d417..b3b98d1 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -17,6 +17,7 @@
#include <linux/init.h>
#include <linux/mtd/compatmac.h>
#include <linux/proc_fs.h>
+#include <linux/idr.h>
#include <linux/mtd/mtd.h>
#include "internal.h"
@@ -33,13 +34,18 @@ static struct class mtd_class = {
.resume = mtd_cls_resume,
};
+static DEFINE_IDR(mtd_idr);
+
/* These are exported solely for the purpose of mtd_blkdevs.c. You
should not use them for _anything_ else */
DEFINE_MUTEX(mtd_table_mutex);
-struct mtd_info *mtd_table[MAX_MTD_DEVICES];
-
EXPORT_SYMBOL_GPL(mtd_table_mutex);
-EXPORT_SYMBOL_GPL(mtd_table);
+
+struct mtd_info *__mtd_next_device(int i)
+{
+ return idr_get_next(&mtd_idr, &i);
+}
+EXPORT_SYMBOL_GPL(__mtd_next_device);
static LIST_HEAD(mtd_notifiers);
@@ -235,13 +241,13 @@ static struct device_type mtd_devtype = {
* Add a device to the list of MTD devices present in the system, and
* notify each currently active MTD 'user' of its arrival. Returns
* zero on success or 1 on failure, which currently will only happen
- * if the number of present devices exceeds MAX_MTD_DEVICES (i.e. 16)
- * or there's a sysfs error.
+ * if there is insufficient memory or a sysfs error.
*/
int add_mtd_device(struct mtd_info *mtd)
{
- int i;
+ struct mtd_notifier *not;
+ int i, error;
if (!mtd->backing_dev_info) {
switch (mtd->type) {
@@ -260,70 +266,73 @@ int add_mtd_device(struct mtd_info *mtd)
BUG_ON(mtd->writesize == 0);
mutex_lock(&mtd_table_mutex);
- for (i=0; i < MAX_MTD_DEVICES; i++)
- if (!mtd_table[i]) {
- struct mtd_notifier *not;
-
- mtd_table[i] = mtd;
- mtd->index = i;
- mtd->usecount = 0;
-
- if (is_power_of_2(mtd->erasesize))
- mtd->erasesize_shift = ffs(mtd->erasesize) - 1;
- else
- mtd->erasesize_shift = 0;
-
- if (is_power_of_2(mtd->writesize))
- mtd->writesize_shift = ffs(mtd->writesize) - 1;
- else
- mtd->writesize_shift = 0;
-
- mtd->erasesize_mask = (1 << mtd->erasesize_shift) - 1;
- mtd->writesize_mask = (1 << mtd->writesize_shift) - 1;
-
- /* Some chips always power up locked. Unlock them now */
- if ((mtd->flags & MTD_WRITEABLE)
- && (mtd->flags & MTD_POWERUP_LOCK) && mtd->unlock) {
- if (mtd->unlock(mtd, 0, mtd->size))
- printk(KERN_WARNING
- "%s: unlock failed, "
- "writes may not work\n",
- mtd->name);
- }
+ do {
+ if (!idr_pre_get(&mtd_idr, GFP_KERNEL))
+ goto fail_locked;
+ error = idr_get_new(&mtd_idr, mtd, &i);
+ } while (error == -EAGAIN);
- /* Caller should have set dev.parent to match the
- * physical device.
- */
- mtd->dev.type = &mtd_devtype;
- mtd->dev.class = &mtd_class;
- mtd->dev.devt = MTD_DEVT(i);
- dev_set_name(&mtd->dev, "mtd%d", i);
- dev_set_drvdata(&mtd->dev, mtd);
- if (device_register(&mtd->dev) != 0) {
- mtd_table[i] = NULL;
- break;
- }
+ if (error)
+ goto fail_locked;
- if (MTD_DEVT(i))
- device_create(&mtd_class, mtd->dev.parent,
- MTD_DEVT(i) + 1,
- NULL, "mtd%dro", i);
-
- DEBUG(0, "mtd: Giving out device %d to %s\n",i, mtd->name);
- /* No need to get a refcount on the module containing
- the notifier, since we hold the mtd_table_mutex */
- list_for_each_entry(not, &mtd_notifiers, list)
- not->add(mtd);
-
- mutex_unlock(&mtd_table_mutex);
- /* We _know_ we aren't being removed, because
- our caller is still holding us here. So none
- of this try_ nonsense, and no bitching about it
- either. :) */
- __module_get(THIS_MODULE);
- return 0;
- }
+ mtd->index = i;
+ mtd->usecount = 0;
+
+ if (is_power_of_2(mtd->erasesize))
+ mtd->erasesize_shift = ffs(mtd->erasesize) - 1;
+ else
+ mtd->erasesize_shift = 0;
+
+ if (is_power_of_2(mtd->writesize))
+ mtd->writesize_shift = ffs(mtd->writesize) - 1;
+ else
+ mtd->writesize_shift = 0;
+
+ mtd->erasesize_mask = (1 << mtd->erasesize_shift) - 1;
+ mtd->writesize_mask = (1 << mtd->writesize_shift) - 1;
+
+ /* Some chips always power up locked. Unlock them now */
+ if ((mtd->flags & MTD_WRITEABLE)
+ && (mtd->flags & MTD_POWERUP_LOCK) && mtd->unlock) {
+ if (mtd->unlock(mtd, 0, mtd->size))
+ printk(KERN_WARNING
+ "%s: unlock failed, writes may not work\n",
+ mtd->name);
+ }
+
+ /* Caller should have set dev.parent to match the
+ * physical device.
+ */
+ mtd->dev.type = &mtd_devtype;
+ mtd->dev.class = &mtd_class;
+ mtd->dev.devt = MTD_DEVT(i);
+ dev_set_name(&mtd->dev, "mtd%d", i);
+ dev_set_drvdata(&mtd->dev, mtd);
+ if (device_register(&mtd->dev) != 0)
+ goto fail_added;
+
+ if (MTD_DEVT(i))
+ device_create(&mtd_class, mtd->dev.parent,
+ MTD_DEVT(i) + 1,
+ NULL, "mtd%dro", i);
+
+ DEBUG(0, "mtd: Giving out device %d to %s\n", i, mtd->name);
+ /* No need to get a refcount on the module containing
+ the notifier, since we hold the mtd_table_mutex */
+ list_for_each_entry(not, &mtd_notifiers, list)
+ not->add(mtd);
+
+ mutex_unlock(&mtd_table_mutex);
+ /* We _know_ we aren't being removed, because
+ our caller is still holding us here. So none
+ of this try_ nonsense, and no bitching about it
+ either. :) */
+ __module_get(THIS_MODULE);
+ return 0;
+fail_added:
+ idr_remove(&mtd_idr, i);
+fail_locked:
mutex_unlock(&mtd_table_mutex);
return 1;
}
@@ -344,7 +353,7 @@ int del_mtd_device (struct mtd_info *mtd)
mutex_lock(&mtd_table_mutex);
- if (mtd_table[mtd->index] != mtd) {
+ if (idr_find(&mtd_idr, mtd->index) != mtd) {
ret = -ENODEV;
} else if (mtd->usecount) {
printk(KERN_NOTICE "Removing MTD device #%d (%s) with use count %d\n",
@@ -360,7 +369,7 @@ int del_mtd_device (struct mtd_info *mtd)
list_for_each_entry(not, &mtd_notifiers, list)
not->remove(mtd);
- mtd_table[mtd->index] = NULL;
+ idr_remove(&mtd_idr, mtd->index);
module_put(THIS_MODULE);
ret = 0;
@@ -448,8 +457,8 @@ struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num)
break;
}
}
- } else if (num >= 0 && num < MAX_MTD_DEVICES) {
- ret = mtd_table[num];
+ } else if (num >= 0) {
+ ret = idr_find(&mtd_idr, num);
if (mtd && mtd != ret)
ret = NULL;
}
diff --git a/drivers/mtd/mtdcore.h b/drivers/mtd/mtdcore.h
index e2f93a3..6a64fde 100644
--- a/drivers/mtd/mtdcore.h
+++ b/drivers/mtd/mtdcore.h
@@ -8,17 +8,7 @@
should not use them for _anything_ else */
extern struct mutex mtd_table_mutex;
-extern struct mtd_info *mtd_table[MAX_MTD_DEVICES];
-
-static inline struct mtd_info *__mtd_next_device(int i)
-{
- while (i < MAX_MTD_DEVICES) {
- if (mtd_table[i])
- return mtd_table[i];
- i++;
- }
- return NULL;
-}
+extern struct mtd_info *__mtd_next_device(int i);
#define mtd_for_each_device(mtd) \
for ((mtd) = __mtd_next_device(0); \
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 0f32a9b..ba53ecc 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -20,7 +20,6 @@
#define MTD_CHAR_MAJOR 90
#define MTD_BLOCK_MAJOR 31
-#define MAX_MTD_DEVICES 32
#define MTD_ERASE_PENDING 0x01
#define MTD_ERASING 0x02
--
1.5.5
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCHv3 8/9] mtd: Raise limit on block device minor numbers
2010-01-29 20:55 [PATCHv3 0/9] mtd: Remove static limit on device numbers Ben Hutchings
` (6 preceding siblings ...)
2010-01-29 20:59 ` [PATCHv3 7/9] mtd: Replace static array of devices with an idr structure Ben Hutchings
@ 2010-01-29 20:59 ` Ben Hutchings
2010-01-29 21:00 ` [PATCHv3 9/9] mtdchar: Register the full range of " Ben Hutchings
2010-02-08 15:54 ` [PATCHv3 0/9] mtd: Remove static limit on device numbers Artem Bityutskiy
9 siblings, 0 replies; 14+ messages in thread
From: Ben Hutchings @ 2010-01-29 20:59 UTC (permalink / raw)
To: David Woodhouse; +Cc: linux-net-drivers, linux-mtd
add_mtd_blktrans_dev() imposes a maximum of 257 devices per block
translator. This was presumably meant to prevent overflow back in the
days of 8-bit minor numbers. Instead, check against MINORMASK and the
limits of the partition naming scheme.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/mtd/mtd_blkdevs.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index 85a52b3..2f8c202 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -242,9 +242,12 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
if (new->devnum == -1)
new->devnum = last_devnum+1;
- if ((new->devnum << tr->part_bits) > 256) {
+ /* Check that the device and any partitions will get valid
+ * minor numbers and that the disk naming code below can cope
+ * with this number. */
+ if (new->devnum > (MINORMASK >> tr->part_bits) ||
+ (tr->part_bits && new->devnum >= 27 * 26))
return -EBUSY;
- }
list_add_tail(&new->list, &tr->devs);
added:
--
1.5.5
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCHv3 9/9] mtdchar: Register the full range of minor numbers
2010-01-29 20:55 [PATCHv3 0/9] mtd: Remove static limit on device numbers Ben Hutchings
` (7 preceding siblings ...)
2010-01-29 20:59 ` [PATCHv3 8/9] mtd: Raise limit on block device minor numbers Ben Hutchings
@ 2010-01-29 21:00 ` Ben Hutchings
2010-02-08 15:54 ` [PATCHv3 0/9] mtd: Remove static limit on device numbers Artem Bityutskiy
9 siblings, 0 replies; 14+ messages in thread
From: Ben Hutchings @ 2010-01-29 21:00 UTC (permalink / raw)
To: David Woodhouse; +Cc: linux-net-drivers, linux-mtd
register_chrdev() registers minor numbers up to 255, but we can now
potentially have much larger numbers.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/mtd/mtdchar.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 04fd7e5..09b0ab5 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -955,7 +955,8 @@ static int __init init_mtdchar(void)
{
int status;
- status = register_chrdev(MTD_CHAR_MAJOR, "mtd", &mtd_fops);
+ status = __register_chrdev(MTD_CHAR_MAJOR, 0, 1 << MINORBITS,
+ "mtd", &mtd_fops);
if (status < 0) {
printk(KERN_NOTICE "Can't allocate major number %d for Memory Technology Devices.\n",
MTD_CHAR_MAJOR);
@@ -966,7 +967,7 @@ static int __init init_mtdchar(void)
static void __exit cleanup_mtdchar(void)
{
- unregister_chrdev(MTD_CHAR_MAJOR, "mtd");
+ __unregister_chrdev(MTD_CHAR_MAJOR, 0, 1 << MINORBITS, "mtd");
}
module_init(init_mtdchar);
--
1.5.5
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCHv3 6/9] idr: Export idr_get_next()
2010-01-29 20:59 ` [PATCHv3 6/9] idr: Export idr_get_next() Ben Hutchings
@ 2010-02-08 15:14 ` Artem Bityutskiy
0 siblings, 0 replies; 14+ messages in thread
From: Artem Bityutskiy @ 2010-02-08 15:14 UTC (permalink / raw)
To: Ben Hutchings
Cc: linux-mtd, sf-linux-drivers, David Woodhouse, KAMEZAWA Hiroyuki
On Fri, 2010-01-29 at 20:59 +0000, Ben Hutchings wrote:
> idr_get_next() was accidentally not exported when added. It is about
> to be used by mtdcore, which may be built as a module.
>
> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
It is nicer to add an Ack you got from Hiroyuki. But I'll do this.
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCHv3 0/9] mtd: Remove static limit on device numbers
2010-01-29 20:55 [PATCHv3 0/9] mtd: Remove static limit on device numbers Ben Hutchings
` (8 preceding siblings ...)
2010-01-29 21:00 ` [PATCHv3 9/9] mtdchar: Register the full range of " Ben Hutchings
@ 2010-02-08 15:54 ` Artem Bityutskiy
2010-02-08 16:08 ` Ben Hutchings
9 siblings, 1 reply; 14+ messages in thread
From: Artem Bityutskiy @ 2010-02-08 15:54 UTC (permalink / raw)
To: Ben Hutchings; +Cc: linux-mtd, linux-net-drivers, David Woodhouse
On Fri, 2010-01-29 at 20:55 +0000, Ben Hutchings wrote:
> This is the third version of this patch series. Please give me some
> feedback, David?
>
> Changes since v2:
> - Export idr_get_next() to support building mtdcore as a module
> - Correct the limit on block device numbers in mtd_blkdevs
> - Register the full range of minor numbers in mtdchar
Looks good for me. I did not test mtdblock, but tested that this does
not break UBIFS.
Pushed to my l2-mtd-2.6/master, thanks.
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCHv3 0/9] mtd: Remove static limit on device numbers
2010-02-08 15:54 ` [PATCHv3 0/9] mtd: Remove static limit on device numbers Artem Bityutskiy
@ 2010-02-08 16:08 ` Ben Hutchings
0 siblings, 0 replies; 14+ messages in thread
From: Ben Hutchings @ 2010-02-08 16:08 UTC (permalink / raw)
To: dedekind1; +Cc: linux-mtd, linux-net-drivers, David Woodhouse
On Mon, 2010-02-08 at 17:54 +0200, Artem Bityutskiy wrote:
> On Fri, 2010-01-29 at 20:55 +0000, Ben Hutchings wrote:
> > This is the third version of this patch series. Please give me some
> > feedback, David?
> >
> > Changes since v2:
> > - Export idr_get_next() to support building mtdcore as a module
> > - Correct the limit on block device numbers in mtd_blkdevs
> > - Register the full range of minor numbers in mtdchar
>
> Looks good for me. I did not test mtdblock, but tested that this does
> not break UBIFS.
>
> Pushed to my l2-mtd-2.6/master, thanks.
Thanks a lot, Artem.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCHv3 4/9] mtd: Remove unnecessary comparisons with MAX_MTD_DEVICES
2010-01-29 20:58 ` [PATCHv3 4/9] mtd: Remove unnecessary comparisons with MAX_MTD_DEVICES Ben Hutchings
@ 2010-02-25 11:42 ` David Woodhouse
0 siblings, 0 replies; 14+ messages in thread
From: David Woodhouse @ 2010-02-25 11:42 UTC (permalink / raw)
To: Ben Hutchings; +Cc: linux-net-drivers, linux-mtd
On Fri, 2010-01-29 at 20:58 +0000, Ben Hutchings wrote:
>
> @@ -695,7 +695,7 @@ static int __init init_pmc551(void)
> /*
> * PCU-bus chipset probe.
> */
> - for (count = 0; count < MAX_MTD_DEVICES; count++) {
> + for (;;) {
>
> if ((PCI_Device = pci_get_device(PCI_VENDOR_ID_V3_SEMI,
> PCI_DEVICE_ID_V3_SEMI_V370PDC,
Hm, that looks very overdue for being converted to a proper PCI driver.
--
David Woodhouse Open Source Technology Centre
David.Woodhouse@intel.com Intel Corporation
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2010-02-25 11:42 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-29 20:55 [PATCHv3 0/9] mtd: Remove static limit on device numbers Ben Hutchings
2010-01-29 20:57 ` [PATCHv3 1/9] mtd: Introduce and use iteration macro for reading the MTD device table Ben Hutchings
2010-01-29 20:57 ` [PATCHv3 2/9] mtd: Use get_mtd_device_nm() to find named device in get_sb_mtd() Ben Hutchings
2010-01-29 20:58 ` [PATCHv3 3/9] nandsim: Define CONFIG_NANDSIM_MAX_PARTS and use it instead of MAX_MTD_DEVICES Ben Hutchings
2010-01-29 20:58 ` [PATCHv3 4/9] mtd: Remove unnecessary comparisons with MAX_MTD_DEVICES Ben Hutchings
2010-02-25 11:42 ` David Woodhouse
2010-01-29 20:58 ` [PATCHv3 5/9] mtdblock: Dynamically allocate cache info structures Ben Hutchings
2010-01-29 20:59 ` [PATCHv3 6/9] idr: Export idr_get_next() Ben Hutchings
2010-02-08 15:14 ` Artem Bityutskiy
2010-01-29 20:59 ` [PATCHv3 7/9] mtd: Replace static array of devices with an idr structure Ben Hutchings
2010-01-29 20:59 ` [PATCHv3 8/9] mtd: Raise limit on block device minor numbers Ben Hutchings
2010-01-29 21:00 ` [PATCHv3 9/9] mtdchar: Register the full range of " Ben Hutchings
2010-02-08 15:54 ` [PATCHv3 0/9] mtd: Remove static limit on device numbers Artem Bityutskiy
2010-02-08 16:08 ` Ben Hutchings
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).