[SeaBIOS] [PATCH] Check if capability enabled in XXX_cmd_data functions.

Kevin O'Connor kevin at koconnor.net
Sun Dec 5 18:54:21 CET 2010


Make sure to check if CONFIG_AHCI, CONFIG_ATA, CONFIG_USB_MSC is
enabled in their respective cmd_data functions.  This reduces the
compile size when they are not enabled.
---
 src/ahci.c    |    3 +++
 src/ata.c     |    3 +++
 src/usb-msc.c |    3 +++
 3 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/ahci.c b/src/ahci.c
index ee404d4..6c3127a 100644
--- a/src/ahci.c
+++ b/src/ahci.c
@@ -155,6 +155,9 @@ static int ahci_command(struct ahci_port_s *port, int iswrite, int isatapi,
 
 int ahci_cmd_data(struct disk_op_s *op, void *cdbcmd, u16 blocksize)
 {
+    if (! CONFIG_AHCI)
+        return 0;
+
     struct ahci_port_s *port = container_of(
         op->drive_g, struct ahci_port_s, drive);
     struct ahci_cmd_s *cmd = GET_GLOBAL(port->cmd);
diff --git a/src/ata.c b/src/ata.c
index 7079bf2..e533108 100644
--- a/src/ata.c
+++ b/src/ata.c
@@ -602,6 +602,9 @@ process_ata_op(struct disk_op_s *op)
 int
 atapi_cmd_data(struct disk_op_s *op, void *cdbcmd, u16 blocksize)
 {
+    if (! CONFIG_ATA)
+        return 0;
+
     struct atadrive_s *adrive_g = container_of(
         op->drive_g, struct atadrive_s, drive);
     struct ata_channel_s *chan_gf = GET_GLOBAL(adrive_g->chan_gf);
diff --git a/src/usb-msc.c b/src/usb-msc.c
index 968cae3..080efdc 100644
--- a/src/usb-msc.c
+++ b/src/usb-msc.c
@@ -50,6 +50,9 @@ struct csw_s {
 int
 usb_cmd_data(struct disk_op_s *op, void *cdbcmd, u16 blocksize)
 {
+    if (!CONFIG_USB_MSC)
+        return 0;
+
     dprintf(16, "usb_cmd_data id=%p write=%d count=%d bs=%d buf=%p\n"
             , op->drive_g, 0, op->count, blocksize, op->buf_fl);
     struct usbdrive_s *udrive_g = container_of(
-- 
1.7.3.2




More information about the SeaBIOS mailing list