Patchwork [U-Boot,3/6] block: constify sect_buf argument of ide_write_data

login
register
mail settings
Submitter Gabor Juhos
Date May 26, 2013, 10:11 a.m.
Message ID <1369563091-21640-4-git-send-email-juhosg@openwrt.org>
Download mbox | patch
Permalink /patch/246379/
State Accepted
Delegated to: Macpaul Lin
Headers show

Comments

Gabor Juhos - May 26, 2013, 10:11 a.m.
Add a const keyword to the sect_buf argument of
ide_write_data to fix the following warning:

  cmd_ide.c: In function '__ide_output_data':
  cmd_ide.c:548: warning: passing argument 2 of 'ide_write_data' discards qualifiers from pointer target type
  /devel/u-boot.git/include/ide.h:76: note: expected 'ulong *' but argument is of type 'const ulong *'

Also modify the driver-model documentation to
match with the new prototype.

Compile tested only.

Cc: Macpaul Lin <macpaul@andestech.com>
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
---
 doc/driver-model/UDM-block.txt |    2 +-
 drivers/block/ftide020.c       |    2 +-
 include/ide.h                  |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
Macpaul Lin - July 24, 2013, 4:44 a.m.
Hi Gabor,

2013/5/26 Gabor Juhos <juhosg@openwrt.org>:
> Add a const keyword to the sect_buf argument of
> ide_write_data to fix the following warning:
>

Applied to u-boot-nds32/master
Thanks for your help!

Patch

diff --git a/doc/driver-model/UDM-block.txt b/doc/driver-model/UDM-block.txt
index 5d5c776..b42ec69 100644
--- a/doc/driver-model/UDM-block.txt
+++ b/doc/driver-model/UDM-block.txt
@@ -93,7 +93,7 @@  I) Overview
       uchar ide_read_register(int dev, unsigned int port);
       void  ide_write_register(int dev, unsigned int port, unsigned char val);
       void  ide_read_data(int dev, ulong *sect_buf, int words);
-      void  ide_write_data(int dev, ulong *sect_buf, int words);
+      void  ide_write_data(int dev, const ulong *sect_buf, int words);
 
     The first two functions are called from ide_inb()/ide_outb(), and will
     default to direct memory access if CONFIG_IDE_AHB is not set, or
diff --git a/drivers/block/ftide020.c b/drivers/block/ftide020.c
index ad8fdad..61900ba 100644
--- a/drivers/block/ftide020.c
+++ b/drivers/block/ftide020.c
@@ -81,7 +81,7 @@  void ide_write_register(int dev, unsigned int port, unsigned char val)
 		IDE_REG_DA_WRITE(port) | val);
 }
 
-void ide_write_data(int dev, ulong *sect_buf, int words)
+void ide_write_data(int dev, const ulong *sect_buf, int words)
 {
 	static struct ftide020_s *ftide020 = (struct ftide020_s *) FTIDE_BASE;
 
diff --git a/include/ide.h b/include/ide.h
index afea85c..703338d 100644
--- a/include/ide.h
+++ b/include/ide.h
@@ -73,7 +73,7 @@  int ide_device_present(int dev);
 unsigned char ide_read_register(int dev, unsigned int port);
 void ide_write_register(int dev, unsigned int port, unsigned char val);
 void ide_read_data(int dev, ulong *sect_buf, int words);
-void ide_write_data(int dev, ulong *sect_buf, int words);
+void ide_write_data(int dev, const ulong *sect_buf, int words);
 #endif
 
 /*