public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* First release of NAND flash device driver...
@ 2000-09-29  7:17 Steven J. Hill
  2000-10-03 11:50 ` First release of NAND flash device driver... / Comments Bjorn Eriksson
  0 siblings, 1 reply; 2+ messages in thread
From: Steven J. Hill @ 2000-09-29  7:17 UTC (permalink / raw)
  To: MTD List

Greetings.

I have released my first version of a NAND flash driver. While
it is written for my specific board, a person should easily be
able to simply tailor the 'nand_send_command' function to their
platform and be ready to go. I also have not put code in to
deal with the NAND devices that have 256 byte wide pages. Please
note that you may not modify the ECC algorithms in 'nand_ecc.c'
as I am still working with Toshiba on licensing terms. Comments
are welcome. I will be implementing the write functions tomorrow
and then begin modifications to JFFS! Well, I have been up for
21 hours straight and I'm off to bed. Cheers.

-Steve

-- 
 Steven J. Hill - Embedded SW Engineer
 Public Key: 'finger sjhill@mail.cotw.com'
 FPR1: E124 6E1C AF8E 7802 A815
 FPR2: 7D72 829C 3386 4C4A E17D


To unsubscribe, send "unsubscribe mtd" to majordomo@infradead.org

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: First release of NAND flash device driver... / Comments
  2000-09-29  7:17 First release of NAND flash device driver Steven J. Hill
@ 2000-10-03 11:50 ` Bjorn Eriksson
  0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Eriksson @ 2000-10-03 11:50 UTC (permalink / raw)
  To: Steven J. Hill, MTD List


 I've had quick peek at your code this morning. I hope to spend some more
time on this issue this week. I started out trying to understand why you
want a 'static u_char *ecc_read_buf;' (uppercase initial-letter or some such
would be nice IMHO) but instead stumbled upon spia_init() (which is 'void'
BTW, perhaps it should be 'int' and return -ENOMEM etc.).

 Small change suggestion: [I know this will forever mark me as a wanker who
can't read others code...]

The code in question: (spia_init())
	/* Allocate memory for MTD device structure and private data */
	spia_mtd = kmalloc(sizeof(struct mtd_info) + sizeof(struct nand_info),
				GFP_KERNEL);
	if (!spia_mtd) {
		printk("Unable to allocate SPIA NAND MTD device structure.\n");
		return;
	}

	/* Get pointer to private data */
	this = (struct nand_info *) (&spia_mtd[1]);

	/* Initialize structures */
	memset((char *) spia_mtd, 0, sizeof(struct mtd_info));
	memset((char *) this, 0, sizeof(struct nand_info));

	/* Link the private data with the MTD structure */
	spia_mtd->priv = this;

I think this makes the intent clearer:

	/* Allocate memory for MTD device structure and private data */
	struct combined_kmalloc_struct {		/* Struct for combined kmalloc()
		struct mtd_info mtd_info_struct;	 * of mtd_info_struct and ...
		struct nand_info nand_info_struct;	 * nand_info_struct. */
	} *p = kmalloc(sizeof(struct combined_kmalloc_struct), GFP_KERNEL);

	if (!p) {
		printk("Unable to allocate SPIA NAND MTD device structure.\n");
		return -ENOMEM;
	}

	/* Initialize structures */
	memset((char *)p, 0, sizeof(*p));

	/* Get pointers to private data */
	spia_mtd = &p->mtd_info_struct;
	spia_mtd->priv = this = &p->nand_info_struct;

 I assume (never a good idea) that the intent is to reduce the kmalloc()
overhead.


--
//Björnen [I'll go into hiding now...]




To unsubscribe, send "unsubscribe mtd" to majordomo@infradead.org

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-10-03 11:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-09-29  7:17 First release of NAND flash device driver Steven J. Hill
2000-10-03 11:50 ` First release of NAND flash device driver... / Comments Bjorn Eriksson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox