Re: [PATCH] platform/x86: Add Steam Deck driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Feb 05, 2022 at 06:20:23PM -0800, Andrey Smirnov wrote:
> +#define STEAMDECK_ATTR_RO(_name, _method)				\
> +	static ssize_t _name##_show(struct device *dev,			\
> +				    struct device_attribute *attr,	\
> +				    char *buf)				\
> +	{								\
> +		struct steamdeck *jup = dev_get_drvdata(dev);		\
> +		unsigned long long val;					\
> +									\
> +		if (ACPI_FAILURE(acpi_evaluate_integer(			\
> +					 jup->adev->handle,		\
> +					 _method, NULL, &val)))		\
> +			return -EIO;					\
> +									\
> +		return sprintf(buf, "%llu\n", val);			\

Please use sysfs_emit() for this and any other sysfs show functions.

Also, you have no Documenation/ABI/ entries for all of these new sysfs
files you are creating.  How do we know what these entries are for, and
what they contain?  Please add that in future versions of this commit,
as-is we can't take this :(


> +	}								\
> +	static DEVICE_ATTR_RO(_name)
> +
> +STEAMDECK_ATTR_RO(firmware_version, "PDFW");
> +STEAMDECK_ATTR_RO(board_id, "BOID");
> +STEAMDECK_ATTR_RO(pdcs, "PDCS");
> +
> +static umode_t
> +steamdeck_is_visible(struct kobject *kobj, struct attribute *attr, int index)
> +{
> +	return attr->mode;
> +}

As Guenter pointed out, this is not needed.


> +
> +static struct attribute *steamdeck_attributes[] = {
> +	&dev_attr_target_cpu_temp.attr,
> +	&dev_attr_gain.attr,
> +	&dev_attr_ramp_rate.attr,
> +	&dev_attr_hysteresis.attr,
> +	&dev_attr_maximum_battery_charge_rate.attr,
> +	&dev_attr_recalculate.attr,
> +	&dev_attr_power_cycle_display.attr,
> +
> +	&dev_attr_led_brightness.attr,
> +	&dev_attr_content_adaptive_brightness.attr,
> +	&dev_attr_gamma_set.attr,
> +	&dev_attr_display_brightness.attr,
> +	&dev_attr_ctrl_display.attr,
> +	&dev_attr_cabc_minimum_brightness.attr,
> +	&dev_attr_memory_data_access_control.attr,
> +
> +	&dev_attr_display_normal_mode_on.attr,
> +	&dev_attr_display_inversion_off.attr,
> +	&dev_attr_display_inversion_on.attr,
> +	&dev_attr_idle_mode_on.attr,
> +
> +	&dev_attr_firmware_version.attr,
> +	&dev_attr_board_id.attr,
> +	&dev_attr_pdcs.attr,
> +
> +	NULL
> +};
> +
> +static const struct attribute_group steamdeck_group = {
> +	.attrs = steamdeck_attributes,
> +	.is_visible = steamdeck_is_visible,
> +};
> +
> +static const struct attribute_group *steamdeck_groups[] = {
> +	&steamdeck_group,
> +	NULL
> +};

ATTRIBUTE_GROUPS()?

thanks,

greg k-h



[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux