DMA-API: firmware/google/gsmi.c: avoid direct access to DMA masks

This driver doesn't need to directly access DMA masks if it uses the
platform_device_register_full() API rather than
platform_device_register_simple() - the former function can initialize
the DMA mask appropriately.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
Russell King 2013-07-01 15:55:02 +01:00
parent 20d897e45c
commit 536dc1eb6b
1 changed files with 8 additions and 5 deletions

View File

@ -764,6 +764,13 @@ static __init int gsmi_system_valid(void)
static struct kobject *gsmi_kobj; static struct kobject *gsmi_kobj;
static struct efivars efivars; static struct efivars efivars;
static const struct platform_device_info gsmi_dev_info = {
.name = "gsmi",
.id = -1,
/* SMI callbacks require 32bit addresses */
.dma_mask = DMA_BIT_MASK(32),
};
static __init int gsmi_init(void) static __init int gsmi_init(void)
{ {
unsigned long flags; unsigned long flags;
@ -776,7 +783,7 @@ static __init int gsmi_init(void)
gsmi_dev.smi_cmd = acpi_gbl_FADT.smi_command; gsmi_dev.smi_cmd = acpi_gbl_FADT.smi_command;
/* register device */ /* register device */
gsmi_dev.pdev = platform_device_register_simple("gsmi", -1, NULL, 0); gsmi_dev.pdev = platform_device_register_full(&gsmi_dev_info);
if (IS_ERR(gsmi_dev.pdev)) { if (IS_ERR(gsmi_dev.pdev)) {
printk(KERN_ERR "gsmi: unable to register platform device\n"); printk(KERN_ERR "gsmi: unable to register platform device\n");
return PTR_ERR(gsmi_dev.pdev); return PTR_ERR(gsmi_dev.pdev);
@ -785,10 +792,6 @@ static __init int gsmi_init(void)
/* SMI access needs to be serialized */ /* SMI access needs to be serialized */
spin_lock_init(&gsmi_dev.lock); spin_lock_init(&gsmi_dev.lock);
/* SMI callbacks require 32bit addresses */
gsmi_dev.pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
gsmi_dev.pdev->dev.dma_mask =
&gsmi_dev.pdev->dev.coherent_dma_mask;
ret = -ENOMEM; ret = -ENOMEM;
gsmi_dev.dma_pool = dma_pool_create("gsmi", &gsmi_dev.pdev->dev, gsmi_dev.dma_pool = dma_pool_create("gsmi", &gsmi_dev.pdev->dev,
GSMI_BUF_SIZE, GSMI_BUF_ALIGN, 0); GSMI_BUF_SIZE, GSMI_BUF_ALIGN, 0);