Skip to content

Commit

Permalink
intel-mid: sfi: Allow struct devs_id.get_platform_data to be NULL
Browse files Browse the repository at this point in the history
Intel mid sfi code doesn't need struct devs_id.get_platform_data != NULL.
If the callback is not set, just assume there is no platform_data.

Signed-off-by: David Cohen <david.a.cohen@linux.intel.com>
Link: http://lkml.kernel.org/r/1382049336-21316-11-git-send-email-david.a.cohen@linux.intel.com
Cc: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
  • Loading branch information
David Cohen authored and H. Peter Anvin committed Oct 17, 2013
1 parent aeedb37 commit 0e6fdb5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions arch/x86/platform/intel-mid/sfi.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ struct blocking_notifier_head intel_scu_notifier =
BLOCKING_NOTIFIER_INIT(intel_scu_notifier);
EXPORT_SYMBOL_GPL(intel_scu_notifier);

#define intel_mid_sfi_get_pdata(dev, priv) \
((dev)->get_platform_data ? (dev)->get_platform_data(priv) : NULL)

/* parse all the mtimer info to a static mtimer array */
int __init sfi_parse_mtmr(struct sfi_table_header *table)
{
Expand Down Expand Up @@ -334,7 +337,7 @@ static void __init sfi_handle_ipc_dev(struct sfi_device_table_entry *pentry,

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

pdev = platform_device_alloc(pentry->name, 0);
if (pdev == NULL) {
Expand Down Expand Up @@ -367,7 +370,7 @@ static void __init sfi_handle_spi_dev(struct sfi_device_table_entry *pentry,
spi_info.max_speed_hz,
spi_info.chip_select);

pdata = dev->get_platform_data(&spi_info);
pdata = intel_mid_sfi_get_pdata(dev, &spi_info);

spi_info.platform_data = pdata;
if (dev->delay)
Expand All @@ -391,7 +394,7 @@ static void __init sfi_handle_i2c_dev(struct sfi_device_table_entry *pentry,
i2c_info.type,
i2c_info.irq,
i2c_info.addr);
pdata = dev->get_platform_data(&i2c_info);
pdata = intel_mid_sfi_get_pdata(dev, &i2c_info);
i2c_info.platform_data = pdata;

if (dev->delay)
Expand Down Expand Up @@ -450,7 +453,7 @@ static int __init sfi_parse_devs(struct sfi_table_header *table)

dev = get_device_id(pentry->type, pentry->name);

if ((dev == NULL) || (dev->get_platform_data == NULL))
if (!dev)
continue;

if (dev->device_handler) {
Expand Down

0 comments on commit 0e6fdb5

Please sign in to comment.