Commit a01b3391 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Ingo Molnar
Browse files

x86/platform/intel-mid: Get rid of duplication of IPC handler



There is no other device handler than ipc_device_handler() and sfi.c already
has a handler for IPC devices.

Replace a pointer to custom handler by a flag. Due to this change adjust
sfi_handle_ipc_dev() to handle it instead of ipc_device_handler().

Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20170105130235.177792-2-andriy.shevchenko@linux.intel.com


Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 4b5b61ea
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -42,10 +42,8 @@ struct devs_id {
	char name[SFI_NAME_LEN + 1];
	u8 type;
	u8 delay;
	u8 msic;
	void *(*get_platform_data)(void *info);
	/* Custom handler for devices */
	void (*device_handler)(struct sfi_device_table_entry *pentry,
			       struct devs_id *dev);
};

#define sfi_device(i)								\
+0 −1
Original line number Diff line number Diff line
@@ -5,7 +5,6 @@ obj-$(subst m,y,$(CONFIG_MMC_SDHCI_PCI)) += platform_mrfld_sd.o
# WiFi
obj-$(subst m,y,$(CONFIG_BRCMFMAC_SDIO)) += platform_bcm43xx.o
# IPC Devices
obj-y += platform_ipc.o
obj-$(subst m,y,$(CONFIG_MFD_INTEL_MSIC)) += platform_msic.o
obj-$(subst m,y,$(CONFIG_SND_MFLD_MACHINE)) += platform_msic_audio.o
obj-$(subst m,y,$(CONFIG_GPIO_MSIC)) += platform_msic_gpio.o
+0 −59
Original line number Diff line number Diff line
/*
 * platform_ipc.c: IPC platform library file
 *
 * (C) Copyright 2013 Intel Corporation
 * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; version 2
 * of the License.
 */

#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/interrupt.h>
#include <linux/sfi.h>
#include <linux/gpio.h>
#include <asm/intel-mid.h>
#include "platform_ipc.h"

void __init ipc_device_handler(struct sfi_device_table_entry *pentry,
				struct devs_id *dev)
{
	struct platform_device *pdev;
	void *pdata = NULL;
	static struct resource res __initdata = {
		.name = "IRQ",
		.flags = IORESOURCE_IRQ,
	};

	pr_debug("IPC bus, name = %16.16s, irq = 0x%2x\n",
		pentry->name, pentry->irq);

	/*
	 * We need to call platform init of IPC devices to fill misc_pdata
	 * structure. It will be used in msic_init for initialization.
	 */
	if (dev != NULL)
		pdata = dev->get_platform_data(pentry);

	/*
	 * On Medfield the platform device creation is handled by the MSIC
	 * MFD driver so we don't need to do it here.
	 */
	if (intel_mid_has_msic())
		return;

	pdev = platform_device_alloc(pentry->name, 0);
	if (pdev == NULL) {
		pr_err("out of memory for SFI platform device '%s'.\n",
			pentry->name);
		return;
	}
	res.start = pentry->irq;
	platform_device_add_resources(pdev, &res, 1);

	pdev->dev.platform_data = pdata;
	intel_scu_device_register(pdev);
}
+0 −18
Original line number Diff line number Diff line
/*
 * platform_ipc.h: IPC platform library header file
 *
 * (C) Copyright 2013 Intel Corporation
 * Author: Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@intel.com>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; version 2
 * of the License.
 */
#ifndef _PLATFORM_IPC_H_
#define _PLATFORM_IPC_H_

void __init
ipc_device_handler(struct sfi_device_table_entry *pentry, struct devs_id *dev);

#endif
+1 −2
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@
#include <asm/intel-mid.h>

#include "platform_msic.h"
#include "platform_ipc.h"

static void *msic_audio_platform_data(void *info)
{
@@ -40,8 +39,8 @@ static const struct devs_id msic_audio_dev_id __initconst = {
	.name = "msic_audio",
	.type = SFI_DEV_TYPE_IPC,
	.delay = 1,
	.msic = 1,
	.get_platform_data = &msic_audio_platform_data,
	.device_handler = &ipc_device_handler,
};

sfi_device(msic_audio_dev_id);
Loading