public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely@secretlab.ca>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH 9/9] Use "void *" not "unsigned long *" for block dev read/write buffer pointers
Date: Sat, 17 Feb 2007 12:34:54 -0700	[thread overview]
Message-ID: <1171740906690-git-send-email-grant.likely@secretlab.ca> (raw)
In-Reply-To: <1171740906976-git-send-email-grant.likely@secretlab.ca>

Block device read/write is anonymous data; there is no need to use a
typed pointer.  void * is fine.  Also add a hook for block_read functions

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
 common/cmd_ide.c     |    8 ++++----
 common/cmd_scsi.c    |    4 ++--
 common/usb_storage.c |    4 ++--
 cpu/pxa/mmc.c        |    2 +-
 drivers/systemace.c  |    7 +++----
 include/ide.h        |    4 ++--
 include/part.h       |    2 +-
 7 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index ebc080c..2e185cc 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -188,7 +188,7 @@ static void ident_cpy (unsigned char *de
 
 #ifdef CONFIG_ATAPI
 static void	atapi_inquiry(block_dev_desc_t *dev_desc);
-ulong atapi_read (int device, lbaint_t blknr, ulong blkcnt, ulong *buffer);
+ulong atapi_read (int device, lbaint_t blknr, ulong blkcnt, void *buffer);
 #endif
 
 
@@ -1233,7 +1233,7 @@ #endif
 
 /* ------------------------------------------------------------------------- */
 
-ulong ide_read (int device, lbaint_t blknr, ulong blkcnt, ulong *buffer)
+ulong ide_read (int device, lbaint_t blknr, ulong blkcnt, void *buffer)
 {
 	ulong n = 0;
 	unsigned char c;
@@ -1353,7 +1353,7 @@ IDE_READ_E:
 /* ------------------------------------------------------------------------- */
 
 
-ulong ide_write (int device, lbaint_t blknr, ulong blkcnt, ulong *buffer)
+ulong ide_write (int device, lbaint_t blknr, ulong blkcnt, void *buffer)
 {
 	ulong n = 0;
 	unsigned char c;
@@ -2015,7 +2015,7 @@ #define ATAPI_READ_MAX_BYTES	2048	/* we 
 #define ATAPI_READ_BLOCK_SIZE	2048	/* assuming CD part */
 #define ATAPI_READ_MAX_BLOCK ATAPI_READ_MAX_BYTES/ATAPI_READ_BLOCK_SIZE	/* max blocks */
 
-ulong atapi_read (int device, lbaint_t blknr, ulong blkcnt, ulong *buffer)
+ulong atapi_read (int device, lbaint_t blknr, ulong blkcnt, void *buffer)
 {
 	ulong n = 0;
 	unsigned char ccb[12]; /* Command descriptor block */
diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c
index b17bebb..da36ed9 100644
--- a/common/cmd_scsi.c
+++ b/common/cmd_scsi.c
@@ -74,7 +74,7 @@ void scsi_setup_inquiry(ccb * pccb);
 void scsi_ident_cpy (unsigned char *dest, unsigned char *src, unsigned int len);
 
 
-ulong scsi_read(int device, ulong blknr, ulong blkcnt, ulong *buffer);
+ulong scsi_read(int device, ulong blknr, ulong blkcnt, void *buffer);
 
 
 /*********************************************************************************
@@ -424,7 +424,7 @@ int do_scsi (cmd_tbl_t *cmdtp, int flag,
 
 #define SCSI_MAX_READ_BLK 0xFFFF /* almost the maximum amount of the scsi_ext command.. */
 
-ulong scsi_read(int device, ulong blknr, ulong blkcnt, ulong *buffer)
+ulong scsi_read(int device, ulong blknr, ulong blkcnt, void *buffer)
 {
 	ulong start,blks, buf_addr;
 	unsigned short smallblks;
diff --git a/common/usb_storage.c b/common/usb_storage.c
index b4b7914..196ceb7 100644
--- a/common/usb_storage.c
+++ b/common/usb_storage.c
@@ -169,7 +169,7 @@ #define USB_STOR_TRANSPORT_ERROR  -2
 
 int usb_stor_get_info(struct usb_device *dev, struct us_data *us, block_dev_desc_t *dev_desc);
 int usb_storage_probe(struct usb_device *dev, unsigned int ifnum,struct us_data *ss);
-unsigned long usb_stor_read(int device, unsigned long blknr, unsigned long blkcnt, unsigned long *buffer);
+unsigned long usb_stor_read(int device, unsigned long blknr, unsigned long blkcnt, void *buffer);
 struct usb_device * usb_get_dev_index(int index);
 void uhci_show_temp_int_td(void);
 
@@ -941,7 +941,7 @@ #endif /* CONFIG_USB_BIN_FIXUP */
 
 #define USB_MAX_READ_BLK 20
 
-unsigned long usb_stor_read(int device, unsigned long blknr, unsigned long blkcnt, unsigned long *buffer)
+unsigned long usb_stor_read(int device, unsigned long blknr, unsigned long blkcnt, void *buffer)
 {
 	unsigned long start,blks, buf_addr;
 	unsigned short smallblks;
diff --git a/cpu/pxa/mmc.c b/cpu/pxa/mmc.c
index c57d0d5..0fbaa16 100644
--- a/cpu/pxa/mmc.c
+++ b/cpu/pxa/mmc.c
@@ -363,7 +363,7 @@ mmc_write(uchar *src, ulong dst, int siz
 
 ulong
 /****************************************************/
-mmc_bread(int dev_num, ulong blknr, ulong blkcnt, ulong *dst)
+mmc_bread(int dev_num, ulong blknr, ulong blkcnt, void *dst)
 /****************************************************/
 {
 	int mmc_block_size = MMC_BLOCK_SIZE;
diff --git a/drivers/systemace.c b/drivers/systemace.c
index 3f329f9..9502623 100644
--- a/drivers/systemace.c
+++ b/drivers/systemace.c
@@ -73,8 +73,7 @@ #endif
 /* */
 
 static unsigned long systemace_read(int dev, unsigned long start,
-                                    unsigned long blkcnt,
-                                    unsigned long *buffer);
+                                    unsigned long blkcnt, void *buffer);
 
 static block_dev_desc_t systemace_dev = { 0 };
 
@@ -133,11 +132,11 @@ block_dev_desc_t *systemace_get_dev(int 
  * number of blocks read. A zero return indicates an error.
  */
 static unsigned long systemace_read(int dev, unsigned long start,
-                                    unsigned long blkcnt, unsigned long *buffer)
+                                    unsigned long blkcnt, void *buffer)
 {
 	int retry;
 	unsigned blk_countdown;
-	unsigned char *dp = (unsigned char *)buffer;
+	unsigned char *dp = buffer;
 	unsigned val;
 
 	if (get_cf_lock() < 0) {
diff --git a/include/ide.h b/include/ide.h
index e29ed36..6976a6c 100644
--- a/include/ide.h
+++ b/include/ide.h
@@ -49,7 +49,7 @@ #endif
  */
 
 void ide_init(void);
-ulong ide_read(int device, lbaint_t blknr, ulong blkcnt, ulong *buffer);
-ulong ide_write(int device, lbaint_t blknr, ulong blkcnt, ulong *buffer);
+ulong ide_read(int device, lbaint_t blknr, ulong blkcnt, void *buffer);
+ulong ide_write(int device, lbaint_t blknr, ulong blkcnt, void *buffer);
 
 #endif /* _IDE_H */
diff --git a/include/part.h b/include/part.h
index 4f5a570..29c0320 100644
--- a/include/part.h
+++ b/include/part.h
@@ -44,7 +44,7 @@ #endif
 	unsigned long	(*block_read)(int dev,
 				      unsigned long start,
 				      lbaint_t blkcnt,
-				      unsigned long *buffer);
+				      void *buffer);
 	unsigned long	(*block_write)(int dev,
 				       unsigned long start,
 				       lbaint_t blkcnt,
-- 
1.4.3.rc2.g0503

  reply	other threads:[~2007-02-17 19:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-17 19:34 [U-Boot-Users] Second set of miscellaneous patches Grant Likely
2007-02-17 19:34 ` [U-Boot-Users] [PATCH 3/9] Move buffer print code from md command to common function Grant Likely
2007-02-17 19:34   ` [U-Boot-Users] [PATCH 5/9] Whitespace fixup on common/cmd_ace.c (using Lindent) Grant Likely
2007-02-17 19:34     ` [U-Boot-Users] [PATCH 6/9] Move common/cmd_ace.c to drivers/systemace.c Grant Likely
2007-02-17 19:34       ` [U-Boot-Users] [PATCH 7/9] Replace ace_readw/ace_writeb functions with macros Grant Likely
2007-02-17 19:34         ` [U-Boot-Users] [PATCH 8/9] Add block_write hook to block_dev_desc_t Grant Likely
2007-02-17 19:34           ` Grant Likely [this message]
2007-02-26  6:34 ` [U-Boot-Users] Second set of miscellaneous patches Stefan Roese

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=1171740906690-git-send-email-grant.likely@secretlab.ca \
    --to=grant.likely@secretlab.ca \
    --cc=u-boot@lists.denx.de \
    /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