diff options
Diffstat (limited to 'drivers/platform/chrome/chromeos_acpi.c')
| -rw-r--r-- | drivers/platform/chrome/chromeos_acpi.c | 33 | 
1 files changed, 31 insertions, 2 deletions
| diff --git a/drivers/platform/chrome/chromeos_acpi.c b/drivers/platform/chrome/chromeos_acpi.c index 50d8a4d4352d..e6e6dcfc74d1 100644 --- a/drivers/platform/chrome/chromeos_acpi.c +++ b/drivers/platform/chrome/chromeos_acpi.c @@ -90,7 +90,36 @@ static int chromeos_acpi_handle_package(struct device *dev, union acpi_object *o  	case ACPI_TYPE_STRING:  		return sysfs_emit(buf, "%s\n", element->string.pointer);  	case ACPI_TYPE_BUFFER: -		return sysfs_emit(buf, "%s\n", element->buffer.pointer); +		{ +			int i, r, at, room_left; +			const int byte_per_line = 16; + +			at = 0; +			room_left = PAGE_SIZE - 1; +			for (i = 0; i < element->buffer.length && room_left; i += byte_per_line) { +				r = hex_dump_to_buffer(element->buffer.pointer + i, +						       element->buffer.length - i, +						       byte_per_line, 1, buf + at, room_left, +						       false); +				if (r > room_left) +					goto truncating; +				at += r; +				room_left -= r; + +				r = sysfs_emit_at(buf, at, "\n"); +				if (!r) +					goto truncating; +				at += r; +				room_left -= r; +			} + +			buf[at] = 0; +			return at; +truncating: +			dev_info_once(dev, "truncating sysfs content for %s\n", name); +			sysfs_emit_at(buf, PAGE_SIZE - 4, "..\n"); +			return PAGE_SIZE - 1; +		}  	default:  		dev_err(dev, "element type %d not supported\n", element->type);  		return -EINVAL; @@ -235,9 +264,9 @@ static int chromeos_acpi_device_probe(struct platform_device *pdev)  	return 0;  } -/* GGL is valid PNP ID of Google. PNP ID can be used with the ACPI devices. */  static const struct acpi_device_id chromeos_device_ids[] = {  	{ "GGL0001", 0 }, +	{ "GOOG0016", 0 },  	{}  };  MODULE_DEVICE_TABLE(acpi, chromeos_device_ids); |