public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* add_mtd_partition question
@ 2002-07-05  7:32 Clive Davies
  0 siblings, 0 replies; 9+ messages in thread
From: Clive Davies @ 2002-07-05  7:32 UTC (permalink / raw)
  To: linux-mtd

Is there a reason why when you add a partition with add_mtd_partition 
master->priv doesn't get copied into slave->priv ? If not, does anyone object 
if I add it in? I'm trying to fix the read_user_prot_reg accesses which no 
longer seem to work for me. 

Clive

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

* Re: add_mtd_partition question
@ 2002-07-05  7:58 Clive Davies
  0 siblings, 0 replies; 9+ messages in thread
From: Clive Davies @ 2002-07-05  7:58 UTC (permalink / raw)
  To: linux-mtd

Sorry, I meant slave->mtd.priv 
On Friday 05 July 2002 8:32 am, Clive Davies wrote:
> Is there a reason why when you add a partition with add_mtd_partition
> master->priv doesn't get copied into slave->priv ? If not, does anyone
> object if I add it in? I'm trying to fix the read_user_prot_reg accesses
> which no longer seem to work for me.
>
> Clive

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

* Re: add_mtd_partition question
@ 2002-07-09 10:32 Clive Davies
  2002-07-09 12:18 ` David Woodhouse
  0 siblings, 1 reply; 9+ messages in thread
From: Clive Davies @ 2002-07-09 10:32 UTC (permalink / raw)
  To: linux-mtd

So if there are no objections, I'll commit the following change...

Index: drivers/mtd/mtdpart.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtdpart.c,v
retrieving revision 1.27
diff -r1.27 mtdpart.c
231a232
>               slave->mtd.priv=master->priv;

----------  Forwarded Message  ----------

Subject: Re: add_mtd_partition question
Date: Fri, 5 Jul 2002 08:58:27 +0100
From: Clive Davies <cdavies@altera.com>
To: linux-mtd@lists.infradead.org

Sorry, I meant slave->mtd.priv

On Friday 05 July 2002 8:32 am, Clive Davies wrote:
> Is there a reason why when you add a partition with add_mtd_partition
> master->priv doesn't get copied into slave->priv ? If not, does anyone
> object if I add it in? I'm trying to fix the read_user_prot_reg accesses
> which no longer seem to work for me.
>
> Clive

-------------------------------------------------------

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

* Re: add_mtd_partition question
  2002-07-09 10:32 add_mtd_partition question Clive Davies
@ 2002-07-09 12:18 ` David Woodhouse
  2002-07-09 13:40   ` Clive Davies
  2002-07-10  7:23   ` Clive Davies
  0 siblings, 2 replies; 9+ messages in thread
From: David Woodhouse @ 2002-07-09 12:18 UTC (permalink / raw)
  To: Clive Davies; +Cc: linux-mtd

cdavies@altera.com said:
> So if there are no objections, I'll commit the following change... 

Er, why? It's private to the underlying MTD driver, and all the partition
wrappers should be passing the _original_ mtd_info to the underlying driver,
shouldn't they?

--
dwmw2

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

* Re: add_mtd_partition question
  2002-07-09 12:18 ` David Woodhouse
@ 2002-07-09 13:40   ` Clive Davies
  2002-07-10  7:23   ` Clive Davies
  1 sibling, 0 replies; 9+ messages in thread
From: Clive Davies @ 2002-07-09 13:40 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linux-mtd

> Er, why? It's private to the underlying MTD driver, and all the partition
> wrappers should be passing the _original_ mtd_info to the underlying
> driver, shouldn't they?

Ok, I think I see where I've gone wrong. I'll try and fix it properly and 
then submit the changes for you to check for sanity.

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

* Re: add_mtd_partition question
  2002-07-09 12:18 ` David Woodhouse
  2002-07-09 13:40   ` Clive Davies
@ 2002-07-10  7:23   ` Clive Davies
  2002-07-10  8:12     ` David Woodhouse
  1 sibling, 1 reply; 9+ messages in thread
From: Clive Davies @ 2002-07-10  7:23 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linux-mtd

I think this is probably a more correct fix. If you could let me know if it 
looks ok, if so then I'll commit it.

Index: mtdpart.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtdpart.c,v
retrieving revision 1.27
diff -r1.27 mtdpart.c
72a73,88
> static int part_read_user_prot_reg (struct mtd_info *mtd, loff_t from, 
size_t len,
>                       size_t *retlen, u_char *buf)
> {
>       struct mtd_part *part = PART(mtd);
>       return part->master->read_user_prot_reg (part->master, from,
>                                       len, retlen, buf);
> }
>
> static int part_read_fact_prot_reg (struct mtd_info *mtd, loff_t from, 
size_t len,
>                       size_t *retlen, u_char *buf)
> {
>       struct mtd_part *part = PART(mtd);
>       return part->master->read_user_prot_reg (part->master, from,
>                                       len, retlen, buf);
> }
>
100a117,124
> static int part_write_user_prot_reg (struct mtd_info *mtd, loff_t from, 
size_t len,
>                       size_t *retlen, u_char *buf)
> {
>       struct mtd_part *part = PART(mtd);
>       return part->master->write_user_prot_reg (part->master, from,
>                                       len, retlen, buf);
> }
>
229,231d252
<               slave->mtd.read_user_prot_reg = master->read_user_prot_reg;
<               slave->mtd.read_fact_prot_reg = master->read_fact_prot_reg;
<               slave->mtd.write_user_prot_reg = master->write_user_prot_reg;
243a265,270
>               if(master->read_user_prot_reg)
>                       slave->mtd.read_user_prot_reg = 
part_read_user_prot_reg;
>               if(master->read_fact_prot_reg)
>                       slave->mtd.read_fact_prot_reg = 
part_read_fact_prot_reg;
>               if(master->write_user_prot_reg)
>                       slave->mtd.write_user_prot_reg = 
part_write_user_prot_reg;

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

* Re: add_mtd_partition question
  2002-07-10  7:23   ` Clive Davies
@ 2002-07-10  8:12     ` David Woodhouse
  2002-07-10  8:22       ` Clive Davies
  0 siblings, 1 reply; 9+ messages in thread
From: David Woodhouse @ 2002-07-10  8:12 UTC (permalink / raw)
  To: Clive Davies; +Cc: linux-mtd

cdavies@altera.com said:
> I think this is probably a more correct fix. If you could let me know
> if it  looks ok, if so then I'll commit it.

Please resend after
	echo "diff -up"  >> ~/.cvsrc 

--
dwmw2

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

* Re: add_mtd_partition question
  2002-07-10  8:12     ` David Woodhouse
@ 2002-07-10  8:22       ` Clive Davies
  2002-07-10  8:24         ` David Woodhouse
  0 siblings, 1 reply; 9+ messages in thread
From: Clive Davies @ 2002-07-10  8:22 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linux-mtd

> Please resend after
> 	echo "diff -up"  >> ~/.cvsrc


Index: mtdpart.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtdpart.c,v
retrieving revision 1.27
diff -u -p -r1.27 mtdpart.c
--- mtdpart.c   8 Mar 2002 16:34:35 -0000       1.27
+++ mtdpart.c   10 Jul 2002 08:22:04 -0000
@@ -70,6 +70,22 @@ static int part_read_oob (struct mtd_inf
                                        len, retlen, buf);
 }

+static int part_read_user_prot_reg (struct mtd_info *mtd, loff_t from, 
size_t len,
+                       size_t *retlen, u_char *buf)
+{
+       struct mtd_part *part = PART(mtd);
+       return part->master->read_user_prot_reg (part->master, from,
+                                       len, retlen, buf);
+}
+
+static int part_read_fact_prot_reg (struct mtd_info *mtd, loff_t from, 
size_t len,
+                       size_t *retlen, u_char *buf)
+{
+       struct mtd_part *part = PART(mtd);
+       return part->master->read_user_prot_reg (part->master, from,
+                                       len, retlen, buf);
+}
+
 static int part_write (struct mtd_info *mtd, loff_t to, size_t len,
                        size_t *retlen, const u_char *buf)
 {
@@ -98,6 +114,14 @@ static int part_write_oob (struct mtd_in
                                        len, retlen, buf);
 }

+static int part_write_user_prot_reg (struct mtd_info *mtd, loff_t from, 
size_t len,
+                       size_t *retlen, u_char *buf)
+{
+       struct mtd_part *part = PART(mtd);
+       return part->master->write_user_prot_reg (part->master, from,
+                                       len, retlen, buf);
+}
+
 static int part_writev (struct mtd_info *mtd,  const struct iovec *vecs,
                         unsigned long count, loff_t to, size_t *retlen)
 {
@@ -226,9 +250,6 @@ int add_mtd_partitions(struct mtd_info *
                slave->mtd.oobsize = master->oobsize;
                slave->mtd.ecctype = master->ecctype;
                slave->mtd.eccsize = master->eccsize;
-               slave->mtd.read_user_prot_reg = master->read_user_prot_reg;
-               slave->mtd.read_fact_prot_reg = master->read_fact_prot_reg;
-               slave->mtd.write_user_prot_reg = master->write_user_prot_reg;

                slave->mtd.name = parts[i].name;
                slave->mtd.bank_size = master->bank_size;
@@ -241,6 +262,12 @@ int add_mtd_partitions(struct mtd_info *
                        slave->mtd.read_oob = part_read_oob;
                if (master->write_oob)
                        slave->mtd.write_oob = part_write_oob;
+               if(master->read_user_prot_reg)
+                       slave->mtd.read_user_prot_reg = 
part_read_user_prot_reg;
+               if(master->read_fact_prot_reg)
+                       slave->mtd.read_fact_prot_reg = 
part_read_fact_prot_reg;
+               if(master->write_user_prot_reg)
+                       slave->mtd.write_user_prot_reg = 
part_write_user_prot_reg;
                if (master->sync)
                        slave->mtd.sync = part_sync;
                if (!i && master->suspend && master->resume) {

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

* Re: add_mtd_partition question
  2002-07-10  8:22       ` Clive Davies
@ 2002-07-10  8:24         ` David Woodhouse
  0 siblings, 0 replies; 9+ messages in thread
From: David Woodhouse @ 2002-07-10  8:24 UTC (permalink / raw)
  To: Clive Davies; +Cc: linux-mtd

cdavies@altera.com said:
> Please resend after
> 	echo "diff -up"  >> ~/.cvsrc
> Index: mtdpart.c

Oh, right -- yeah, now I can read it, it looks fine. Go ahead; thanks.

--
dwmw2

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

end of thread, other threads:[~2002-07-10  8:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-09 10:32 add_mtd_partition question Clive Davies
2002-07-09 12:18 ` David Woodhouse
2002-07-09 13:40   ` Clive Davies
2002-07-10  7:23   ` Clive Davies
2002-07-10  8:12     ` David Woodhouse
2002-07-10  8:22       ` Clive Davies
2002-07-10  8:24         ` David Woodhouse
  -- strict thread matches above, loose matches on Subject: below --
2002-07-05  7:58 Clive Davies
2002-07-05  7:32 Clive Davies

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