i2c: scmi: Use standard device message logging functions
ACPI_ERROR and ACPI_DEBUG_PRINT are not intended to be used by device drivers. Use acpi_handle message logging functions instead. As a nice side effect, it removes the following compiler warnings which were printed when ACPI debug is disabled: drivers/i2c/busses/i2c-scmi.c: In function "acpi_smbus_cmi_add_cap": drivers/i2c/busses/i2c-scmi.c:328:39: warning: suggest braces around empty body in an "else" statement [-Wempty-body] drivers/i2c/busses/i2c-scmi.c:338:12: warning: suggest braces around empty body in an "else" statement [-Wempty-body] Suggested-by: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> Signed-off-by: Jean Delvare <jdelvare@suse.de> Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
This commit is contained in:
parent
04b6fcaba3
commit
e9d09d97af
|
@ -182,7 +182,8 @@ acpi_smbus_cmi_access(struct i2c_adapter *adap, u16 addr, unsigned short flags,
|
||||||
status = acpi_evaluate_object(smbus_cmi->handle, method, &input,
|
status = acpi_evaluate_object(smbus_cmi->handle, method, &input,
|
||||||
&buffer);
|
&buffer);
|
||||||
if (ACPI_FAILURE(status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_ERROR((AE_INFO, "Evaluating %s: %i", method, status));
|
acpi_handle_err(smbus_cmi->handle,
|
||||||
|
"Failed to evaluate %s: %i\n", method, status);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,19 +191,19 @@ acpi_smbus_cmi_access(struct i2c_adapter *adap, u16 addr, unsigned short flags,
|
||||||
if (pkg && pkg->type == ACPI_TYPE_PACKAGE)
|
if (pkg && pkg->type == ACPI_TYPE_PACKAGE)
|
||||||
obj = pkg->package.elements;
|
obj = pkg->package.elements;
|
||||||
else {
|
else {
|
||||||
ACPI_ERROR((AE_INFO, "Invalid argument type"));
|
acpi_handle_err(smbus_cmi->handle, "Invalid argument type\n");
|
||||||
result = -EIO;
|
result = -EIO;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (obj == NULL || obj->type != ACPI_TYPE_INTEGER) {
|
if (obj == NULL || obj->type != ACPI_TYPE_INTEGER) {
|
||||||
ACPI_ERROR((AE_INFO, "Invalid argument type"));
|
acpi_handle_err(smbus_cmi->handle, "Invalid argument type\n");
|
||||||
result = -EIO;
|
result = -EIO;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = obj->integer.value;
|
result = obj->integer.value;
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s return status: %i\n",
|
acpi_handle_debug(smbus_cmi->handle, "%s return status: %i\n", method,
|
||||||
method, result));
|
result);
|
||||||
|
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case ACPI_SMBUS_STATUS_OK:
|
case ACPI_SMBUS_STATUS_OK:
|
||||||
|
@ -227,7 +228,7 @@ acpi_smbus_cmi_access(struct i2c_adapter *adap, u16 addr, unsigned short flags,
|
||||||
|
|
||||||
obj = pkg->package.elements + 1;
|
obj = pkg->package.elements + 1;
|
||||||
if (obj->type != ACPI_TYPE_INTEGER) {
|
if (obj->type != ACPI_TYPE_INTEGER) {
|
||||||
ACPI_ERROR((AE_INFO, "Invalid argument type"));
|
acpi_handle_err(smbus_cmi->handle, "Invalid argument type\n");
|
||||||
result = -EIO;
|
result = -EIO;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -239,7 +240,8 @@ acpi_smbus_cmi_access(struct i2c_adapter *adap, u16 addr, unsigned short flags,
|
||||||
case I2C_SMBUS_BYTE_DATA:
|
case I2C_SMBUS_BYTE_DATA:
|
||||||
case I2C_SMBUS_WORD_DATA:
|
case I2C_SMBUS_WORD_DATA:
|
||||||
if (obj->type != ACPI_TYPE_INTEGER) {
|
if (obj->type != ACPI_TYPE_INTEGER) {
|
||||||
ACPI_ERROR((AE_INFO, "Invalid argument type"));
|
acpi_handle_err(smbus_cmi->handle,
|
||||||
|
"Invalid argument type\n");
|
||||||
result = -EIO;
|
result = -EIO;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -250,7 +252,8 @@ acpi_smbus_cmi_access(struct i2c_adapter *adap, u16 addr, unsigned short flags,
|
||||||
break;
|
break;
|
||||||
case I2C_SMBUS_BLOCK_DATA:
|
case I2C_SMBUS_BLOCK_DATA:
|
||||||
if (obj->type != ACPI_TYPE_BUFFER) {
|
if (obj->type != ACPI_TYPE_BUFFER) {
|
||||||
ACPI_ERROR((AE_INFO, "Invalid argument type"));
|
acpi_handle_err(smbus_cmi->handle,
|
||||||
|
"Invalid argument type\n");
|
||||||
result = -EIO;
|
result = -EIO;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -300,6 +303,7 @@ static int acpi_smbus_cmi_add_cap(struct acpi_smbus_cmi *smbus_cmi,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
|
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
|
||||||
|
struct acpi_handle *handle = smbus_cmi->handle;
|
||||||
union acpi_object *obj;
|
union acpi_object *obj;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
@ -308,8 +312,8 @@ static int acpi_smbus_cmi_add_cap(struct acpi_smbus_cmi *smbus_cmi,
|
||||||
smbus_cmi->methods->mt_info,
|
smbus_cmi->methods->mt_info,
|
||||||
NULL, &buffer);
|
NULL, &buffer);
|
||||||
if (ACPI_FAILURE(status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_ERROR((AE_INFO, "Evaluating %s: %i",
|
acpi_handle_err(handle, "Failed to evaluate %s: %i\n",
|
||||||
smbus_cmi->methods->mt_info, status));
|
smbus_cmi->methods->mt_info, status);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,18 +321,18 @@ static int acpi_smbus_cmi_add_cap(struct acpi_smbus_cmi *smbus_cmi,
|
||||||
if (obj && obj->type == ACPI_TYPE_PACKAGE)
|
if (obj && obj->type == ACPI_TYPE_PACKAGE)
|
||||||
obj = obj->package.elements;
|
obj = obj->package.elements;
|
||||||
else {
|
else {
|
||||||
ACPI_ERROR((AE_INFO, "Invalid argument type"));
|
acpi_handle_err(handle, "Invalid argument type\n");
|
||||||
kfree(buffer.pointer);
|
kfree(buffer.pointer);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj->type != ACPI_TYPE_INTEGER) {
|
if (obj->type != ACPI_TYPE_INTEGER) {
|
||||||
ACPI_ERROR((AE_INFO, "Invalid argument type"));
|
acpi_handle_err(handle, "Invalid argument type\n");
|
||||||
kfree(buffer.pointer);
|
kfree(buffer.pointer);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
} else
|
} else
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "SMBus CMI Version %x"
|
acpi_handle_debug(handle, "SMBus CMI Version %x\n",
|
||||||
"\n", (int)obj->integer.value));
|
(int)obj->integer.value);
|
||||||
|
|
||||||
kfree(buffer.pointer);
|
kfree(buffer.pointer);
|
||||||
smbus_cmi->cap_info = 1;
|
smbus_cmi->cap_info = 1;
|
||||||
|
@ -337,8 +341,7 @@ static int acpi_smbus_cmi_add_cap(struct acpi_smbus_cmi *smbus_cmi,
|
||||||
else if (!strcmp(name, smbus_cmi->methods->mt_sbw))
|
else if (!strcmp(name, smbus_cmi->methods->mt_sbw))
|
||||||
smbus_cmi->cap_write = 1;
|
smbus_cmi->cap_write = 1;
|
||||||
else
|
else
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Unsupported CMI method: %s\n",
|
acpi_handle_debug(handle, "Unsupported CMI method: %s\n", name);
|
||||||
name));
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue