public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: "Artem B. Bityutskiy" <dedekind@yandex.ru>
To: "Jörn Engel" <joern@wohnheim.fh-wedel.de>
Cc: Nicolas Pitre <nico@cam.org>,
	linux-mtd@lists.infradead.org,
	David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH,RFC] [MTD] replace MTD_NORFLASH with MTD_GENERIC_TYPE
Date: Thu, 01 Jun 2006 16:57:31 +0400	[thread overview]
Message-ID: <447EE43B.7050705@yandex.ru> (raw)
In-Reply-To: <20060601113319.GA5662@wohnheim.fh-wedel.de>

Jörn Engel wrote:
> I don't understand how that layer would not introduce overhead.  But
> maybe you have some explanation in diff -up format.  That would
> certainly make things easier to understand.

I wrote this already. Sketck:

1. add a 'void *capabilities' field to mtd_info.

2. create mtd_capps.c like this:

#include <mtd_capps.h>

/*
  * Called from mtd_add_device() or like such, i.e., on MTD device
  * initialization.
  */
int mtd_capabilities_init(struct mtd_info *mtd)
{
	struct mtd_capabilities *caps;

	caps = mtd->capabilities = kmalloc(sizeof(struct mtd_capabilities), 
GFP_KERNEL);
	if (!mtd->capabilities)
		return -ENOMEM;

	switch (mtd->type) {
	case MTD_NORFLASH:
		caps->can_milk_goat = 0;
		caps->can_pass_iq_tests = 1;
		/* ETC */
		break;
	case MTD_NANDFLASH:
		/* ETC */
		break;
	/* ETC */
	default:
		return -EINVAL;
	}
	
	return 0;
}

/*
  * Called from mtd_del_device() or like such, i.e., on MTD device
  * de-initialization.
  */
void mtd_capabilities_free(struct mtd_info *mtd)
{
	kfree(mtd->capabilities);
}

3. create mtd_capps.h like this:

struct mtd_capabilities {
	int can_milk_goat;
	int can_pass_iq_tests;
	/* ETC */
};

/* Can this flash milk goats ? */
#define mtd_can_milk_goat(mtd) \
	((struct mtd_capabilities*)(mtd->capabilities))->can_milk_goat

-----

Well, in this case word "layer" becomes not very appropriate. It'll be a 
distinct *unit* within MTD. But the idea to have all the 
application-dependent stuff in one place, not scattered over drivers, stays.

-- 
Best Regards,
Artem B. Bityutskiy,
St.-Petersburg, Russia.

      reply	other threads:[~2006-06-01 12:58 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-30 15:24 [PATCH,RFC] [MTD] replace MTD_NORFLASH with MTD_GENERIC_TYPE Jörn Engel
2006-05-30 15:39 ` Artem B. Bityutskiy
2006-05-30 15:40 ` David Woodhouse
2006-05-30 15:50   ` Jörn Engel
2006-05-30 15:55     ` David Woodhouse
2006-05-30 15:59       ` Jörn Engel
2006-05-30 16:01     ` Artem B. Bityutskiy
2006-05-30 16:10       ` Jörn Engel
2006-05-30 16:32         ` Nicolas Pitre
2006-05-30 16:52           ` Artem B. Bityutskiy
2006-05-30 17:45           ` Jörn Engel
2006-05-30 18:13             ` Nicolas Pitre
2006-05-30 18:27               ` Jörn Engel
2006-05-30 16:37         ` Artem B. Bityutskiy
2006-05-30 16:57         ` David Woodhouse
2006-05-30 17:08           ` Jörn Engel
2006-05-30 16:42     ` Nicolas Pitre
2006-05-30 18:50 ` Jörn Engel
2006-05-30 18:52   ` David Woodhouse
2006-05-30 19:09     ` Jörn Engel
2006-05-30 19:10   ` Nicolas Pitre
2006-05-30 20:06     ` Jörn Engel
2006-05-31  8:09   ` Artem B. Bityutskiy
2006-05-31 14:01     ` Nicolas Pitre
2006-05-31 14:49       ` Artem B. Bityutskiy
2006-05-31 15:59         ` Nicolas Pitre
2006-05-31 16:45           ` Artem B. Bityutskiy
2006-05-31 17:25             ` Nicolas Pitre
2006-06-01  9:03               ` Artem B. Bityutskiy
2006-06-01 11:33                 ` Jörn Engel
2006-06-01 12:57                   ` Artem B. Bityutskiy [this message]

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=447EE43B.7050705@yandex.ru \
    --to=dedekind@yandex.ru \
    --cc=dwmw2@infradead.org \
    --cc=joern@wohnheim.fh-wedel.de \
    --cc=linux-mtd@lists.infradead.org \
    --cc=nico@cam.org \
    /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