Unverified Commit 79a8ccbd authored by Mark Brown's avatar Mark Brown
Browse files

ASoC: Replace sprintf() with sysfs_emit()

Merge series from Takashi Iwai <tiwai@suse.de>:

This is a patch set for rather simple conversions from the plain
sprintf() & co to the new helpers, sysfs_emit() and sysfs_emit_at().
No functional changes are expected.
parents 088f115c a111ae4d
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -1666,10 +1666,9 @@ static int cs43130_show_dc(struct device *dev, char *buf, u8 ch)
	struct cs43130_private *cs43130 = i2c_get_clientdata(client);

	if (!cs43130->hpload_done)
		return scnprintf(buf, PAGE_SIZE, "NO_HPLOAD\n");
		return sysfs_emit(buf, "NO_HPLOAD\n");
	else
		return scnprintf(buf, PAGE_SIZE, "%u\n",
				 cs43130->hpload_dc[ch]);
		return sysfs_emit(buf, "%u\n", cs43130->hpload_dc[ch]);
}

static ssize_t hpload_dc_l_show(struct device *dev,
@@ -1705,7 +1704,7 @@ static int cs43130_show_ac(struct device *dev, char *buf, u8 ch)

	if (cs43130->hpload_done && cs43130->ac_meas) {
		for (i = 0; i < ARRAY_SIZE(cs43130_ac_freq); i++) {
			tmp = scnprintf(buf + j, PAGE_SIZE - j, "%u\n",
			tmp = sysfs_emit_at(buf, j, "%u\n",
					    cs43130->hpload_ac[i][ch]);
			if (!tmp)
				break;
@@ -1715,7 +1714,7 @@ static int cs43130_show_ac(struct device *dev, char *buf, u8 ch)

		return j;
	} else {
		return scnprintf(buf, PAGE_SIZE, "NO_HPLOAD\n");
		return sysfs_emit(buf, "NO_HPLOAD\n");
	}
}

+1 −1
Original line number Diff line number Diff line
@@ -271,7 +271,7 @@ static ssize_t keyclick_show(struct device *dev,
	freq = (125 << ((val >> 8) & 0x7)) >> 1;
	len = 2 * (1 + ((val >> 4) & 0xf));

	return sprintf(buf, "amp=%x freq=%iHz len=%iclks\n", amp, freq, len);
	return sysfs_emit(buf, "amp=%x freq=%iHz len=%iclks\n", amp, freq, len);
}

/* Any write to the keyclick attribute will trigger the keyclick event */
+4 −4
Original line number Diff line number Diff line
@@ -242,9 +242,9 @@ static ssize_t firmware_version_show(struct device *dev,

	if (ctx->fw_version.type == 0 && ctx->fw_version.major == 0 &&
	    ctx->fw_version.minor == 0 && ctx->fw_version.build == 0)
		return sprintf(buf, "FW not yet loaded\n");
		return sysfs_emit(buf, "FW not yet loaded\n");
	else
		return sprintf(buf, "v%02x.%02x.%02x.%02x\n",
		return sysfs_emit(buf, "v%02x.%02x.%02x.%02x\n",
				  ctx->fw_version.type, ctx->fw_version.major,
				  ctx->fw_version.minor, ctx->fw_version.build);

+3 −3
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ static ssize_t fw_version_show(struct device *dev,
	if (ret)
		return CATPT_IPC_ERROR(ret);

	return sprintf(buf, "%d.%d.%d.%d\n", version.type, version.major,
	return sysfs_emit(buf, "%d.%d.%d.%d\n", version.type, version.major,
			  version.minor, version.build);
}
static DEVICE_ATTR_RO(fw_version);
@@ -37,7 +37,7 @@ static ssize_t fw_info_show(struct device *dev,
{
	struct catpt_dev *cdev = dev_get_drvdata(dev);

	return sprintf(buf, "%s\n", cdev->ipc.config.fw_info);
	return sysfs_emit(buf, "%s\n", cdev->ipc.config.fw_info);
}
static DEVICE_ATTR_RO(fw_info);

+1 −1
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ static ssize_t platform_id_show(struct device *dev,
			nhlt->header.oem_revision);

	skl_nhlt_trim_space(platform_id);
	return sprintf(buf, "%s\n", platform_id);
	return sysfs_emit(buf, "%s\n", platform_id);
}

static DEVICE_ATTR_RO(platform_id);
Loading