All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Kuppuswamy Sathyanarayanan <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org,
	david.a.cohen@linux.intel.com,
	sathyanarayanan.kuppuswamy@linux.intel.com, tglx@linutronix.de,
	hpa@linux.intel.com
Subject: [tip:x86/intel-mid] intel_mid: Added custom device_handler support
Date: Thu, 17 Oct 2013 17:34:20 -0700	[thread overview]
Message-ID: <tip-3fd79ae4275001f293dbd170479e89df6c433226@git.kernel.org> (raw)
In-Reply-To: <1382049336-21316-8-git-send-email-david.a.cohen@linux.intel.com>

Commit-ID:  3fd79ae4275001f293dbd170479e89df6c433226
Gitweb:     http://git.kernel.org/tip/3fd79ae4275001f293dbd170479e89df6c433226
Author:     Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
AuthorDate: Thu, 17 Oct 2013 15:35:31 -0700
Committer:  H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Thu, 17 Oct 2013 16:40:49 -0700

intel_mid: Added custom device_handler support

This patch provides a means to add custom handler for
SFI devices. If you set device_handler as NULL in
device_id table standard SFI device handler will be used.
If its not NULL custom handler will be called.

Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Link: http://lkml.kernel.org/r/1382049336-21316-8-git-send-email-david.a.cohen@linux.intel.com
Signed-off-by: David Cohen <david.a.cohen@linux.intel.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
 arch/x86/platform/intel-mid/intel-mid.c | 74 ++++++++++++++++++---------------
 1 file changed, 40 insertions(+), 34 deletions(-)

diff --git a/arch/x86/platform/intel-mid/intel-mid.c b/arch/x86/platform/intel-mid/intel-mid.c
index d24c729..7bfd784 100644
--- a/arch/x86/platform/intel-mid/intel-mid.c
+++ b/arch/x86/platform/intel-mid/intel-mid.c
@@ -396,6 +396,9 @@ struct devs_id {
 	u8 type;
 	u8 delay;
 	void *(*get_platform_data)(void *info);
+	/* Custom handler for devices */
+	void (*device_handler)(struct sfi_device_table_entry *pentry,
+				struct devs_id *dev);
 };
 
 /* the offset for the mapping of global gpio pin to irq */
@@ -690,28 +693,27 @@ static void *tc35876x_platform_data(void *data)
 }
 
 static const struct devs_id __initconst device_ids[] = {
-	{"bma023", SFI_DEV_TYPE_I2C, 1, &no_platform_data},
-	{"pmic_gpio", SFI_DEV_TYPE_SPI, 1, &pmic_gpio_platform_data},
-	{"pmic_gpio", SFI_DEV_TYPE_IPC, 1, &pmic_gpio_platform_data},
-	{"spi_max3111", SFI_DEV_TYPE_SPI, 0, &max3111_platform_data},
-	{"i2c_max7315", SFI_DEV_TYPE_I2C, 1, &max7315_platform_data},
-	{"i2c_max7315_2", SFI_DEV_TYPE_I2C, 1, &max7315_platform_data},
-	{"tca6416", SFI_DEV_TYPE_I2C, 1, &tca6416_platform_data},
-	{"emc1403", SFI_DEV_TYPE_I2C, 1, &emc1403_platform_data},
-	{"i2c_accel", SFI_DEV_TYPE_I2C, 0, &lis331dl_platform_data},
-	{"pmic_audio", SFI_DEV_TYPE_IPC, 1, &no_platform_data},
-	{"mpu3050", SFI_DEV_TYPE_I2C, 1, &mpu3050_platform_data},
-	{"i2c_disp_brig", SFI_DEV_TYPE_I2C, 0, &tc35876x_platform_data},
+	{"bma023", SFI_DEV_TYPE_I2C, 1, &no_platform_data, NULL},
+	{"pmic_gpio", SFI_DEV_TYPE_SPI, 1, &pmic_gpio_platform_data, NULL},
+	{"pmic_gpio", SFI_DEV_TYPE_IPC, 1, &pmic_gpio_platform_data, NULL},
+	{"spi_max3111", SFI_DEV_TYPE_SPI, 0, &max3111_platform_data, NULL},
+	{"i2c_max7315", SFI_DEV_TYPE_I2C, 1, &max7315_platform_data, NULL},
+	{"i2c_max7315_2", SFI_DEV_TYPE_I2C, 1, &max7315_platform_data, NULL},
+	{"tca6416", SFI_DEV_TYPE_I2C, 1, &tca6416_platform_data, NULL},
+	{"emc1403", SFI_DEV_TYPE_I2C, 1, &emc1403_platform_data, NULL},
+	{"i2c_accel", SFI_DEV_TYPE_I2C, 0, &lis331dl_platform_data, NULL},
+	{"pmic_audio", SFI_DEV_TYPE_IPC, 1, &no_platform_data, NULL},
+	{"mpu3050", SFI_DEV_TYPE_I2C, 1, &mpu3050_platform_data, NULL},
+	{"i2c_disp_brig", SFI_DEV_TYPE_I2C, 0, &tc35876x_platform_data, NULL},
 
 	/* MSIC subdevices */
-	{"msic_battery", SFI_DEV_TYPE_IPC, 1, &msic_battery_platform_data},
-	{"msic_gpio", SFI_DEV_TYPE_IPC, 1, &msic_gpio_platform_data},
-	{"msic_audio", SFI_DEV_TYPE_IPC, 1, &msic_audio_platform_data},
-	{"msic_power_btn", SFI_DEV_TYPE_IPC, 1, &msic_power_btn_platform_data},
-	{"msic_ocd", SFI_DEV_TYPE_IPC, 1, &msic_ocd_platform_data},
-	{"msic_thermal", SFI_DEV_TYPE_IPC, 1, &msic_thermal_platform_data},
-
-	{},
+	{"msic_battery", SFI_DEV_TYPE_IPC, 1, &msic_battery_platform_data, NULL},
+	{"msic_gpio", SFI_DEV_TYPE_IPC, 1, &msic_gpio_platform_data, NULL},
+	{"msic_audio", SFI_DEV_TYPE_IPC, 1, &msic_audio_platform_data, NULL},
+	{"msic_power_btn", SFI_DEV_TYPE_IPC, 1, &msic_power_btn_platform_data, NULL},
+	{"msic_ocd", SFI_DEV_TYPE_IPC, 1, &msic_ocd_platform_data, NULL},
+	{"msic_thermal", SFI_DEV_TYPE_IPC, 1, &msic_thermal_platform_data, NULL},
+	{ 0 }
 };
 
 #define MAX_IPCDEVS	24
@@ -965,20 +967,24 @@ static int __init sfi_parse_devs(struct sfi_table_header *table)
 		if ((dev == NULL) || (dev->get_platform_data == NULL))
 			continue;
 
-		switch (pentry->type) {
-		case SFI_DEV_TYPE_IPC:
-			sfi_handle_ipc_dev(pentry, dev);
-			break;
-		case SFI_DEV_TYPE_SPI:
-			sfi_handle_spi_dev(pentry, dev);
-			break;
-		case SFI_DEV_TYPE_I2C:
-			sfi_handle_i2c_dev(pentry, dev);
-			break;
-		case SFI_DEV_TYPE_UART:
-		case SFI_DEV_TYPE_HSI:
-		default:
-			;
+		if (dev->device_handler) {
+			dev->device_handler(pentry, dev);
+		} else {
+			switch (pentry->type) {
+			case SFI_DEV_TYPE_IPC:
+				sfi_handle_ipc_dev(pentry, dev);
+				break;
+			case SFI_DEV_TYPE_SPI:
+				sfi_handle_spi_dev(pentry, dev);
+				break;
+			case SFI_DEV_TYPE_I2C:
+				sfi_handle_i2c_dev(pentry, dev);
+				break;
+			case SFI_DEV_TYPE_UART:
+			case SFI_DEV_TYPE_HSI:
+			default:
+				break;
+			}
 		}
 	}
 	return 0;

  reply	other threads:[~2013-10-18  0:34 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-17 22:35 [PATCH v10 00/12] rework arch/x86/platform/[mrst => intel-mid] David Cohen
2013-10-17 22:35 ` [PATCH v10 01/12] mrst: Fixed printk/pr_* related issues David Cohen
2013-10-18  0:33   ` [tip:x86/intel-mid] " tip-bot for Kuppuswamy Sathyanarayanan
2013-10-17 22:35 ` [PATCH v10 02/12] mrst: Fixed indentation issues David Cohen
2013-10-18  0:33   ` [tip:x86/intel-mid] " tip-bot for Kuppuswamy Sathyanarayanan
2013-10-17 22:35 ` [PATCH v10 03/12] intel_mid: Renamed *mrst* to *intel_mid* David Cohen
2013-10-18  0:33   ` [tip:x86/intel-mid] " tip-bot for Kuppuswamy Sathyanarayanan
2013-10-17 22:35 ` [PATCH v10 04/12] pci: intel_mid: return true/false in function returning bool David Cohen
2013-10-18  0:33   ` [tip:x86/intel-mid] pci: intel_mid: Return true/ false " tip-bot for Fengguang Wu
2013-10-17 22:35 ` [PATCH v10 05/12] intel_mid: Renamed *mrst* to *intel_mid* David Cohen
2013-10-18  0:34   ` [tip:x86/intel-mid] " tip-bot for Kuppuswamy Sathyanarayanan
2013-10-17 22:35 ` [PATCH v10 06/12] intel_mid: Refactored sfi_parse_devs() function David Cohen
2013-10-18  0:34   ` [tip:x86/intel-mid] " tip-bot for Kuppuswamy Sathyanarayanan
2013-10-17 22:35 ` [PATCH v10 07/12] intel_mid: Added custom device_handler support David Cohen
2013-10-18  0:34   ` tip-bot for Kuppuswamy Sathyanarayanan [this message]
2013-10-17 22:35 ` [PATCH v10 08/12] intel_mid: Added custom handler for ipc devices David Cohen
2013-10-18  0:34   ` [tip:x86/intel-mid] " tip-bot for Kuppuswamy Sathyanarayanan
2013-10-17 22:35 ` [PATCH v10 09/12] intel_mid: Moved SFI related code to sfi.c David Cohen
2013-10-18  0:34   ` [tip:x86/intel-mid] " tip-bot for Kuppuswamy Sathyanarayanan
2013-10-17 22:35 ` [PATCH v10 10/12] intel-mid: sfi: allow struct devs_id.get_platform_data to be NULL David Cohen
2013-10-18  0:34   ` [tip:x86/intel-mid] intel-mid: sfi: Allow " tip-bot for David Cohen
2013-10-17 22:35 ` [PATCH v10 11/12] x86: intel-mid: add section for sfi device table David Cohen
2013-10-18  0:35   ` [tip:x86/intel-mid] x86: intel-mid: Add " tip-bot for David Cohen
2013-10-17 22:35 ` [PATCH v10 12/12] intel_mid: move board related codes to their own platform_<device>.* files David Cohen
2013-10-18  0:35   ` [tip:x86/intel-mid] intel_mid: Move platform device setups " tip-bot for David Cohen
2013-10-18  6:09 ` [PATCH v10 00/12] rework arch/x86/platform/[mrst => intel-mid] Ingo Molnar
2013-10-18 13:39   ` David Cohen
  -- strict thread matches above, loose matches on Subject: below --
2013-10-16  4:11 [PATCH v5 07/12] intel_mid: Added custom device_handler support David Cohen
2013-10-17 18:19 ` [tip:x86/intel-mid] " tip-bot for Kuppuswamy Sathyanarayanan

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=tip-3fd79ae4275001f293dbd170479e89df6c433226@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=david.a.cohen@linux.intel.com \
    --cc=hpa@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=tglx@linutronix.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.