Message ID | 1390088935-7193-2-git-send-email-hdegoede@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi, On 01/19/2014 05:46 AM, Tejun Heo wrote: > Hello, Hans. > > On Sun, Jan 19, 2014 at 12:48:43AM +0100, Hans de Goede wrote: >> void ahci_start_engine(struct ata_port *ap) >> { >> void __iomem *port_mmio = ahci_port_base(ap); >> + struct ahci_host_priv *hpriv = ap->host->private_data; >> u32 tmp; >> >> + if (hpriv->start_engine) { >> + hpriv->start_engine(ap); >> + return; >> + } >> + > > I'd much prefer if the driver always calls hpriv->start_engine() which > is initialized to the default callback during common init and then > overridden if necessary. This is a bit trouble some because ahci_start_engine is also exported, so the patch would also need to fix all callers (and probably un-export it). I can do this in the next revision in the patch-set if you want me to, just explaining why I choose to do this the way I did. Regards, Hans
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h index 2289efd..8f60f33 100644 --- a/drivers/ata/ahci.h +++ b/drivers/ata/ahci.h @@ -323,6 +323,8 @@ struct ahci_host_priv { u32 em_msg_type; /* EM message type */ struct clk *clk; /* Only for platforms supporting clk */ void *plat_data; /* Other platform data */ + /* Optional ahci_start_engine override */ + void (*start_engine)(struct ata_port *ap); }; extern int ahci_ignore_sss; diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index c482f8c..f6eabbc 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c @@ -568,8 +568,14 @@ static int ahci_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val) void ahci_start_engine(struct ata_port *ap) { void __iomem *port_mmio = ahci_port_base(ap); + struct ahci_host_priv *hpriv = ap->host->private_data; u32 tmp; + if (hpriv->start_engine) { + hpriv->start_engine(ap); + return; + } + /* start DMA */ tmp = readl(port_mmio + PORT_CMD); tmp |= PORT_CMD_START;