From: "O.Sezer" <sezeroz@ttnet.net.tr>
To: linux-kernel@vger.kernel.org
Cc: marcelo.tosatti@cyclades.com
Subject: [PATCH] [2.4.28-pre1] more gcc3.4 inline fixes [5/10]
Date: Tue, 17 Aug 2004 18:14:51 +0300 [thread overview]
Message-ID: <412220EB.7090909@ttnet.net.tr> (raw)
[-- Attachment #1: Type: text/plain, Size: 0 bytes --]
[-- Attachment #2: gcc34_inline_05.diff --]
[-- Type: text/plain, Size: 5260 bytes --]
--- 28p1/drivers/mtd/devices/doc1000.c~ 2003-06-13 17:51:34.000000000 +0300
+++ 28p1/drivers/mtd/devices/doc1000.c 2004-08-16 22:33:26.000000000 +0300
@@ -137,6 +137,119 @@
return 0;
}
+static inline int suspend_erase(volatile u_char *addr)
+{
+ __u16 status;
+ u_long i = 0;
+
+ writew(IF_ERASE_SUSPEND, addr);
+ writew(IF_READ_CSR, addr);
+
+ do {
+ status = readw(addr);
+ if ((status & CSR_WR_READY) == CSR_WR_READY)
+ return 0;
+ i++;
+ } while(i < max_tries);
+
+ printk(KERN_NOTICE "flashcard: suspend_erase timed out, status 0x%x\n", status);
+ return -EIO;
+
+}
+
+static inline void resume_erase(volatile u_char *addr)
+{
+ __u16 status;
+
+ writew(IF_READ_CSR, addr);
+ status = readw(addr);
+
+ /* Only give resume signal if the erase is really suspended */
+ if (status & CSR_ERA_SUSPEND)
+ writew(IF_CONFIRM, addr);
+}
+
+static inline int byte_write (volatile u_char *addr, u_char byte)
+{
+ register u_char status;
+ register u_short i = 0;
+
+ do {
+ status = readb(addr);
+ if (status & CSR_WR_READY)
+ {
+ writeb(IF_WRITE & 0xff, addr);
+ writeb(byte, addr);
+ return 0;
+ }
+ i++;
+ } while(i < max_tries);
+
+
+ printk(KERN_NOTICE "flashcard: byte_write timed out, status 0x%x\n",status);
+ return -EIO;
+}
+
+static inline int word_write (volatile u_char *addr, __u16 word)
+{
+ register u_short status;
+ register u_short i = 0;
+
+ do {
+ status = readw(addr);
+ if ((status & CSR_WR_READY) == CSR_WR_READY)
+ {
+ writew(IF_WRITE, addr);
+ writew(word, addr);
+ return 0;
+ }
+ i++;
+ } while(i < max_tries);
+
+ printk(KERN_NOTICE "flashcard: word_write timed out at %p, status 0x%x\n", addr, status);
+ return -EIO;
+}
+
+static inline void reset_block(volatile u_char *addr)
+{
+ u_short i;
+ __u16 status;
+
+ writew(IF_CLEAR_CSR, addr);
+
+ for (i = 0; i < 100; i++) {
+ writew(IF_READ_CSR, addr);
+ status = readw(addr);
+ if (status != 0xffff) break;
+ udelay(1000);
+ }
+
+ writew(IF_READ_CSR, addr);
+}
+
+static inline int check_write(volatile u_char *addr)
+{
+ u_short status, i = 0;
+
+ writew(IF_READ_CSR, addr);
+
+ do {
+ status = readw(addr);
+ if (status & (CSR_WR_ERR | CSR_VPP_LOW))
+ {
+ printk(KERN_NOTICE "flashcard: write failure at %p, status 0x%x\n", addr, status);
+ reset_block(addr);
+ return -EIO;
+ }
+ if ((status & CSR_WR_READY) == CSR_WR_READY)
+ return 0;
+ i++;
+ } while (i < max_tries);
+
+ printk(KERN_NOTICE "flashcard: write timed out at %p, status 0x%x\n", addr, status);
+ return -EIO;
+}
+
int flashcard_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf)
{
@@ -281,47 +394,6 @@
/*====================================================================*/
-static inline int byte_write (volatile u_char *addr, u_char byte)
-{
- register u_char status;
- register u_short i = 0;
-
- do {
- status = readb(addr);
- if (status & CSR_WR_READY)
- {
- writeb(IF_WRITE & 0xff, addr);
- writeb(byte, addr);
- return 0;
- }
- i++;
- } while(i < max_tries);
-
-
- printk(KERN_NOTICE "flashcard: byte_write timed out, status 0x%x\n",status);
- return -EIO;
-}
-
-static inline int word_write (volatile u_char *addr, __u16 word)
-{
- register u_short status;
- register u_short i = 0;
-
- do {
- status = readw(addr);
- if ((status & CSR_WR_READY) == CSR_WR_READY)
- {
- writew(IF_WRITE, addr);
- writew(word, addr);
- return 0;
- }
- i++;
- } while(i < max_tries);
-
- printk(KERN_NOTICE "flashcard: word_write timed out at %p, status 0x%x\n", addr, status);
- return -EIO;
-}
-
static inline void block_erase (volatile u_char *addr)
{
writew(IF_BLOCK_ERASE, addr);
@@ -350,79 +422,6 @@
return 0;
}
-static inline int suspend_erase(volatile u_char *addr)
-{
- __u16 status;
- u_long i = 0;
-
- writew(IF_ERASE_SUSPEND, addr);
- writew(IF_READ_CSR, addr);
-
- do {
- status = readw(addr);
- if ((status & CSR_WR_READY) == CSR_WR_READY)
- return 0;
- i++;
- } while(i < max_tries);
-
- printk(KERN_NOTICE "flashcard: suspend_erase timed out, status 0x%x\n", status);
- return -EIO;
-
-}
-
-static inline void resume_erase(volatile u_char *addr)
-{
- __u16 status;
-
- writew(IF_READ_CSR, addr);
- status = readw(addr);
-
- /* Only give resume signal if the erase is really suspended */
- if (status & CSR_ERA_SUSPEND)
- writew(IF_CONFIRM, addr);
-}
-
-static inline void reset_block(volatile u_char *addr)
-{
- u_short i;
- __u16 status;
-
- writew(IF_CLEAR_CSR, addr);
-
- for (i = 0; i < 100; i++) {
- writew(IF_READ_CSR, addr);
- status = readw(addr);
- if (status != 0xffff) break;
- udelay(1000);
- }
-
- writew(IF_READ_CSR, addr);
-}
-
-static inline int check_write(volatile u_char *addr)
-{
- u_short status, i = 0;
-
- writew(IF_READ_CSR, addr);
-
- do {
- status = readw(addr);
- if (status & (CSR_WR_ERR | CSR_VPP_LOW))
- {
- printk(KERN_NOTICE "flashcard: write failure at %p, status 0x%x\n", addr, status);
- reset_block(addr);
- return -EIO;
- }
- if ((status & CSR_WR_READY) == CSR_WR_READY)
- return 0;
- i++;
- } while (i < max_tries);
-
- printk(KERN_NOTICE "flashcard: write timed out at %p, status 0x%x\n", addr, status);
- return -EIO;
-}
-
-
/*====================================================================*/
reply other threads:[~2004-08-17 15:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=412220EB.7090909@ttnet.net.tr \
--to=sezeroz@ttnet.net.tr \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.tosatti@cyclades.com \
/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