linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anton Vorontsov <avorontsov@ru.mvista.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: Sergei Shtylyov <sshtylyov@mvista.com>,
	linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 08/11] ahci: Introduce ahci_set_em_messages()
Date: Wed, 3 Mar 2010 20:17:45 +0300	[thread overview]
Message-ID: <20100303171745.GH12362@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <20100303171713.GA6322@oksana.dev.rtsoft.ru>

Factor out some ahci_em_messages handling code from ahci_init_one().
We would like to reuse it for non-PCI devices.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 drivers/ata/ahci.c |   41 ++++++++++++++++++++++++-----------------
 1 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index f904683..4f05cf0 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -3231,6 +3231,29 @@ static inline void ahci_gtf_filter_workaround(struct ata_host *host)
 {}
 #endif
 
+static void ahci_set_em_messages(struct ahci_host_priv *hpriv,
+				 struct ata_port_info *pi)
+{
+	u8 messages;
+	void __iomem *mmio = hpriv->mmio;
+	u32 em_loc = readl(mmio + HOST_EM_LOC);
+	u32 em_ctl = readl(mmio + HOST_EM_CTL);
+
+	if (!ahci_em_messages || !(hpriv->cap & HOST_CAP_EMS))
+		return;
+
+	messages = (em_ctl & EM_CTRL_MSG_TYPE) >> 16;
+
+	/* we only support LED message type right now */
+	if ((messages & 0x01) && (ahci_em_messages == 1)) {
+		/* store em_loc */
+		hpriv->em_loc = ((em_loc >> 16) * 4);
+		pi->flags |= ATA_FLAG_EM;
+		if (!(em_ctl & EM_CTL_ALHD))
+			pi->flags |= ATA_FLAG_SW_ACTIVITY;
+	}
+}
+
 static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 	static int printed_version;
@@ -3334,23 +3357,7 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (hpriv->cap & HOST_CAP_PMP)
 		pi.flags |= ATA_FLAG_PMP;
 
-	if (ahci_em_messages && (hpriv->cap & HOST_CAP_EMS)) {
-		u8 messages;
-		void __iomem *mmio = hpriv->mmio;
-		u32 em_loc = readl(mmio + HOST_EM_LOC);
-		u32 em_ctl = readl(mmio + HOST_EM_CTL);
-
-		messages = (em_ctl & EM_CTRL_MSG_TYPE) >> 16;
-
-		/* we only support LED message type right now */
-		if ((messages & 0x01) && (ahci_em_messages == 1)) {
-			/* store em_loc */
-			hpriv->em_loc = ((em_loc >> 16) * 4);
-			pi.flags |= ATA_FLAG_EM;
-			if (!(em_ctl & EM_CTL_ALHD))
-				pi.flags |= ATA_FLAG_SW_ACTIVITY;
-		}
-	}
+	ahci_set_em_messages(hpriv, &pi);
 
 	if (ahci_broken_system_poweroff(pdev)) {
 		pi.flags |= ATA_FLAG_NO_POWEROFF_SPINDOWN;
-- 
1.7.0

  parent reply	other threads:[~2010-03-03 17:17 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-03 17:17 [PATCH 0/11] ahci: Add support for non-PCI devices Anton Vorontsov
2010-03-03 17:17 ` [PATCH 01/11] ahci: Get rid of host->iomap usage Anton Vorontsov
2010-03-03 18:45   ` Jeff Garzik
2010-03-03 18:49     ` Jeff Garzik
2010-03-03 17:17 ` [PATCH 02/11] ahci: Factor out PCI specifics from ahci_save_initial_config() Anton Vorontsov
2010-03-03 17:17 ` [PATCH 03/11] ahci: Get rid of pci_dev argument in ahci_save_initial_config() Anton Vorontsov
2010-03-03 17:17 ` [PATCH 04/11] ahci: Factor out PCI specifics from ahci_reset_controller() Anton Vorontsov
2010-03-03 17:17 ` [PATCH 05/11] ahci: Get rid of pci_dev argument in ahci_port_init() Anton Vorontsov
2010-03-03 17:17 ` [PATCH 06/11] ahci: Factor out PCI specifics from ahci_init_controller() Anton Vorontsov
2010-03-03 17:17 ` [PATCH 07/11] ahci: Factor out PCI specifics from ahci_print_info() Anton Vorontsov
2010-03-03 17:17 ` Anton Vorontsov [this message]
2010-03-03 20:52   ` [PATCH 08/11] ahci: Introduce ahci_set_em_messages() Jeff Garzik
2010-03-03 17:17 ` [PATCH 09/11] ahci: Move generic code into libahci Anton Vorontsov
2010-03-03 17:33   ` Sergei Shtylyov
2010-03-03 17:45     ` Anton Vorontsov
2010-03-03 18:43   ` Jeff Garzik
2010-03-03 21:58     ` Mark Lord
2010-03-03 17:17 ` [PATCH 10/11] ahci: Export generic AHCI symbols, turn libahci into a separate module Anton Vorontsov
2010-03-03 17:53   ` Sergei Shtylyov
2010-03-03 18:08     ` Anton Vorontsov
2010-03-03 18:14       ` Anton Vorontsov
2010-03-03 18:34         ` Jeff Garzik
2010-03-03 18:42           ` Anton Vorontsov
2010-03-03 17:17 ` [PATCH 11/11] ahci: Add platform driver Anton Vorontsov

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=20100303171745.GH12362@oksana.dev.rtsoft.ru \
    --to=avorontsov@ru.mvista.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sshtylyov@mvista.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;
as well as URLs for NNTP newsgroup(s).