X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Facpi%2Fsbshc.c;h=bcf2c70fca87f498b9a3c5af5e0037248c488b37;hb=abe834c8a5d7e55ee12c0c8c7a5308b2c5cba95d;hp=fd40b6a1d639693a9160080b736c4c8d86cb909e;hpb=104064b54955addac0fcf9ceb6c68569f2bed6ab;p=linux-2.6-omap-h63xx.git diff --git a/drivers/acpi/sbshc.c b/drivers/acpi/sbshc.c index fd40b6a1d63..bcf2c70fca8 100644 --- a/drivers/acpi/sbshc.c +++ b/drivers/acpi/sbshc.c @@ -111,12 +111,17 @@ static int wait_transaction_complete(struct acpi_smb_hc *hc, int timeout) return -ETIME; } -int acpi_smbus_transaction(struct acpi_smb_hc *hc, u8 protocol, u8 address, - u8 command, u8 *data, u8 length) +static int acpi_smbus_transaction(struct acpi_smb_hc *hc, u8 protocol, + u8 address, u8 command, u8 *data, u8 length) { int ret = -EFAULT, i; u8 temp, sz = 0; + if (!hc) { + printk(KERN_ERR PREFIX "host controller is not configured\n"); + return ret; + } + mutex_lock(&hc->lock); if (smb_hc_read(hc, ACPI_SMB_PROTOCOL, &temp)) goto end; @@ -125,7 +130,6 @@ int acpi_smbus_transaction(struct acpi_smb_hc *hc, u8 protocol, u8 address, goto end; } smb_hc_write(hc, ACPI_SMB_COMMAND, command); - smb_hc_write(hc, ACPI_SMB_COMMAND, command); if (!(protocol & 0x01)) { smb_hc_write(hc, ACPI_SMB_BLOCK_COUNT, length); for (i = 0; i < length; ++i) @@ -292,6 +296,7 @@ static int acpi_smbus_hc_remove(struct acpi_device *device, int type) hc = acpi_driver_data(device); acpi_ec_remove_query_handler(hc->ec, hc->query_bit); kfree(hc); + acpi_driver_data(device) = NULL; return 0; }