Commit 4c47097f authored by Jiapeng Chong's avatar Jiapeng Chong Committed by Dmitry Torokhov
Browse files

Input: aiptek - convert sysfs sprintf/snprintf family to sysfs_emit



Fix the following coccicheck warning:

./drivers/input/tablet/aiptek.c:1629:8-16: WARNING: use scnprintf or
sprintf.

Reported-by: default avatarAbaci <Robot&lt;abaci@linux.alibaba.com>
Signed-off-by: default avatarJiapeng Chong <jiapeng.chong@linux.alibaba.com>
Link: https://lore.kernel.org/r/1612419191-1078-1-git-send-email-jiapeng.chong@linux.alibaba.com


Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 2896a27f
Loading
Loading
Loading
Loading
+33 −47
Original line number Diff line number Diff line
@@ -1036,7 +1036,7 @@ static ssize_t show_tabletSize(struct device *dev, struct device_attribute *attr
{
	struct aiptek *aiptek = dev_get_drvdata(dev);

	return snprintf(buf, PAGE_SIZE, "%dx%d\n",
	return sysfs_emit(buf, "%dx%d\n",
			  input_abs_get_max(aiptek->inputdev, ABS_X) + 1,
			  input_abs_get_max(aiptek->inputdev, ABS_Y) + 1);
}
@@ -1064,8 +1064,7 @@ static ssize_t show_tabletPointerMode(struct device *dev, struct device_attribut
{
	struct aiptek *aiptek = dev_get_drvdata(dev);

	return snprintf(buf, PAGE_SIZE, "%s\n",
			map_val_to_str(pointer_mode_map,
	return sysfs_emit(buf, "%s\n", map_val_to_str(pointer_mode_map,
						      aiptek->curSetting.pointerMode));
}

@@ -1101,8 +1100,7 @@ static ssize_t show_tabletCoordinateMode(struct device *dev, struct device_attri
{
	struct aiptek *aiptek = dev_get_drvdata(dev);

	return snprintf(buf, PAGE_SIZE, "%s\n",
			map_val_to_str(coordinate_mode_map,
	return sysfs_emit(buf, "%s\n", map_val_to_str(coordinate_mode_map,
						      aiptek->curSetting.coordinateMode));
}

@@ -1143,8 +1141,7 @@ static ssize_t show_tabletToolMode(struct device *dev, struct device_attribute *
{
	struct aiptek *aiptek = dev_get_drvdata(dev);

	return snprintf(buf, PAGE_SIZE, "%s\n",
			map_val_to_str(tool_mode_map,
	return sysfs_emit(buf, "%s\n", map_val_to_str(tool_mode_map,
						      aiptek->curSetting.toolMode));
}

@@ -1174,10 +1171,9 @@ static ssize_t show_tabletXtilt(struct device *dev, struct device_attribute *att
	struct aiptek *aiptek = dev_get_drvdata(dev);

	if (aiptek->curSetting.xTilt == AIPTEK_TILT_DISABLE) {
		return snprintf(buf, PAGE_SIZE, "disable\n");
		return sysfs_emit(buf, "disable\n");
	} else {
		return snprintf(buf, PAGE_SIZE, "%d\n",
				aiptek->curSetting.xTilt);
		return sysfs_emit(buf, "%d\n", aiptek->curSetting.xTilt);
	}
}

@@ -1216,10 +1212,9 @@ static ssize_t show_tabletYtilt(struct device *dev, struct device_attribute *att
	struct aiptek *aiptek = dev_get_drvdata(dev);

	if (aiptek->curSetting.yTilt == AIPTEK_TILT_DISABLE) {
		return snprintf(buf, PAGE_SIZE, "disable\n");
		return sysfs_emit(buf, "disable\n");
	} else {
		return snprintf(buf, PAGE_SIZE, "%d\n",
				aiptek->curSetting.yTilt);
		return sysfs_emit(buf, "%d\n", aiptek->curSetting.yTilt);
	}
}

@@ -1257,7 +1252,7 @@ static ssize_t show_tabletJitterDelay(struct device *dev, struct device_attribut
{
	struct aiptek *aiptek = dev_get_drvdata(dev);

	return snprintf(buf, PAGE_SIZE, "%d\n", aiptek->curSetting.jitterDelay);
	return sysfs_emit(buf, "%d\n", aiptek->curSetting.jitterDelay);
}

static ssize_t
@@ -1286,8 +1281,7 @@ static ssize_t show_tabletProgrammableDelay(struct device *dev, struct device_at
{
	struct aiptek *aiptek = dev_get_drvdata(dev);

	return snprintf(buf, PAGE_SIZE, "%d\n",
			aiptek->curSetting.programmableDelay);
	return sysfs_emit(buf, "%d\n", aiptek->curSetting.programmableDelay);
}

static ssize_t
@@ -1316,7 +1310,7 @@ static ssize_t show_tabletEventsReceived(struct device *dev, struct device_attri
{
	struct aiptek *aiptek = dev_get_drvdata(dev);

	return snprintf(buf, PAGE_SIZE, "%ld\n", aiptek->eventCount);
	return sysfs_emit(buf, "%ld\n", aiptek->eventCount);
}

static DEVICE_ATTR(event_count, S_IRUGO, show_tabletEventsReceived, NULL);
@@ -1355,7 +1349,7 @@ static ssize_t show_tabletDiagnosticMessage(struct device *dev, struct device_at
	default:
		return 0;
	}
	return snprintf(buf, PAGE_SIZE, retMsg);
	return sysfs_emit(buf, retMsg);
}

static DEVICE_ATTR(diagnostic, S_IRUGO, show_tabletDiagnosticMessage, NULL);
@@ -1375,8 +1369,7 @@ static ssize_t show_tabletStylusUpper(struct device *dev, struct device_attribut
{
	struct aiptek *aiptek = dev_get_drvdata(dev);

	return snprintf(buf, PAGE_SIZE, "%s\n",
			map_val_to_str(stylus_button_map,
	return sysfs_emit(buf, "%s\n", map_val_to_str(stylus_button_map,
						      aiptek->curSetting.stylusButtonUpper));
}

@@ -1406,8 +1399,7 @@ static ssize_t show_tabletStylusLower(struct device *dev, struct device_attribut
{
	struct aiptek *aiptek = dev_get_drvdata(dev);

	return snprintf(buf, PAGE_SIZE, "%s\n",
			map_val_to_str(stylus_button_map,
	return sysfs_emit(buf, "%s\n", map_val_to_str(stylus_button_map,
						      aiptek->curSetting.stylusButtonLower));
}

@@ -1444,8 +1436,7 @@ static ssize_t show_tabletMouseLeft(struct device *dev, struct device_attribute
{
	struct aiptek *aiptek = dev_get_drvdata(dev);

	return snprintf(buf, PAGE_SIZE, "%s\n",
			map_val_to_str(mouse_button_map,
	return sysfs_emit(buf, "%s\n", map_val_to_str(mouse_button_map,
						      aiptek->curSetting.mouseButtonLeft));
}

@@ -1474,8 +1465,7 @@ static ssize_t show_tabletMouseMiddle(struct device *dev, struct device_attribut
{
	struct aiptek *aiptek = dev_get_drvdata(dev);

	return snprintf(buf, PAGE_SIZE, "%s\n",
			map_val_to_str(mouse_button_map,
	return sysfs_emit(buf, "%s\n", map_val_to_str(mouse_button_map,
						      aiptek->curSetting.mouseButtonMiddle));
}

@@ -1504,8 +1494,7 @@ static ssize_t show_tabletMouseRight(struct device *dev, struct device_attribute
{
	struct aiptek *aiptek = dev_get_drvdata(dev);

	return snprintf(buf, PAGE_SIZE, "%s\n",
			map_val_to_str(mouse_button_map,
	return sysfs_emit(buf, "%s\n", map_val_to_str(mouse_button_map,
						      aiptek->curSetting.mouseButtonRight));
}

@@ -1535,10 +1524,9 @@ static ssize_t show_tabletWheel(struct device *dev, struct device_attribute *att
	struct aiptek *aiptek = dev_get_drvdata(dev);

	if (aiptek->curSetting.wheel == AIPTEK_WHEEL_DISABLE) {
		return snprintf(buf, PAGE_SIZE, "disable\n");
		return sysfs_emit(buf, "disable\n");
	} else {
		return snprintf(buf, PAGE_SIZE, "%d\n",
				aiptek->curSetting.wheel);
		return sysfs_emit(buf, "%d\n", aiptek->curSetting.wheel);
	}
}

@@ -1568,8 +1556,7 @@ static ssize_t show_tabletExecute(struct device *dev, struct device_attribute *a
	/* There is nothing useful to display, so a one-line manual
	 * is in order...
	 */
	return snprintf(buf, PAGE_SIZE,
			"Write anything to this file to program your tablet.\n");
	return sysfs_emit(buf, "Write anything to this file to program your tablet.\n");
}

static ssize_t
@@ -1600,7 +1587,7 @@ static ssize_t show_tabletODMCode(struct device *dev, struct device_attribute *a
{
	struct aiptek *aiptek = dev_get_drvdata(dev);

	return snprintf(buf, PAGE_SIZE, "0x%04x\n", aiptek->features.odmCode);
	return sysfs_emit(buf, "0x%04x\n", aiptek->features.odmCode);
}

static DEVICE_ATTR(odm_code, S_IRUGO, show_tabletODMCode, NULL);
@@ -1613,7 +1600,7 @@ static ssize_t show_tabletModelCode(struct device *dev, struct device_attribute
{
	struct aiptek *aiptek = dev_get_drvdata(dev);

	return snprintf(buf, PAGE_SIZE, "0x%04x\n", aiptek->features.modelCode);
	return sysfs_emit(buf, "0x%04x\n", aiptek->features.modelCode);
}

static DEVICE_ATTR(model_code, S_IRUGO, show_tabletModelCode, NULL);
@@ -1626,8 +1613,7 @@ static ssize_t show_firmwareCode(struct device *dev, struct device_attribute *at
{
	struct aiptek *aiptek = dev_get_drvdata(dev);

	return snprintf(buf, PAGE_SIZE, "%04x\n",
			aiptek->features.firmwareCode);
	return sysfs_emit(buf, "%04x\n", aiptek->features.firmwareCode);
}

static DEVICE_ATTR(firmware_code, S_IRUGO, show_firmwareCode, NULL);