lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YgIu+Lrt0p85yog1@kroah.com>
Date:   Tue, 8 Feb 2022 09:51:04 +0100
From:   Greg KH <gregkh@...uxfoundation.org>
To:     Andrey Smirnov <andrew.smirnov@...il.com>
Cc:     platform-driver-x86@...r.kernel.org,
        Hans de Goede <hdegoede@...hat.com>,
        Mark Gross <markgross@...nel.org>,
        Jean Delvare <jdelvare@...e.com>,
        Guenter Roeck <linux@...ck-us.net>,
        linux-kernel@...r.kernel.org, linux-hwmon@...r.kernel.org
Subject: Re: [PATCH] platform/x86: Add Steam Deck driver

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ