Skip to content

Commit f316178

Browse files
committed
Merge back ACPI platform_profile driver material for 6.15
2 parents 9a43102 + 9597965 commit f316178

File tree

2 files changed

+23
-24
lines changed

2 files changed

+23
-24
lines changed

drivers/acpi/platform_profile.c

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -289,14 +289,14 @@ static int _remove_hidden_choices(struct device *dev, void *arg)
289289

290290
/**
291291
* platform_profile_choices_show - Show the available profile choices for legacy sysfs interface
292-
* @dev: The device
292+
* @kobj: The kobject
293293
* @attr: The attribute
294294
* @buf: The buffer to write to
295295
*
296296
* Return: The number of bytes written
297297
*/
298-
static ssize_t platform_profile_choices_show(struct device *dev,
299-
struct device_attribute *attr,
298+
static ssize_t platform_profile_choices_show(struct kobject *kobj,
299+
struct kobj_attribute *attr,
300300
char *buf)
301301
{
302302
struct aggregate_choices_data data = {
@@ -371,14 +371,14 @@ static int _store_and_notify(struct device *dev, void *data)
371371

372372
/**
373373
* platform_profile_show - Show the current profile for legacy sysfs interface
374-
* @dev: The device
374+
* @kobj: The kobject
375375
* @attr: The attribute
376376
* @buf: The buffer to write to
377377
*
378378
* Return: The number of bytes written
379379
*/
380-
static ssize_t platform_profile_show(struct device *dev,
381-
struct device_attribute *attr,
380+
static ssize_t platform_profile_show(struct kobject *kobj,
381+
struct kobj_attribute *attr,
382382
char *buf)
383383
{
384384
enum platform_profile_option profile = PLATFORM_PROFILE_LAST;
@@ -400,15 +400,15 @@ static ssize_t platform_profile_show(struct device *dev,
400400

401401
/**
402402
* platform_profile_store - Set the profile for legacy sysfs interface
403-
* @dev: The device
403+
* @kobj: The kobject
404404
* @attr: The attribute
405405
* @buf: The buffer to read from
406406
* @count: The number of bytes to read
407407
*
408408
* Return: The number of bytes read
409409
*/
410-
static ssize_t platform_profile_store(struct device *dev,
411-
struct device_attribute *attr,
410+
static ssize_t platform_profile_store(struct kobject *kobj,
411+
struct kobj_attribute *attr,
412412
const char *buf, size_t count)
413413
{
414414
struct aggregate_choices_data data = {
@@ -442,12 +442,12 @@ static ssize_t platform_profile_store(struct device *dev,
442442
return count;
443443
}
444444

445-
static DEVICE_ATTR_RO(platform_profile_choices);
446-
static DEVICE_ATTR_RW(platform_profile);
445+
static struct kobj_attribute attr_platform_profile_choices = __ATTR_RO(platform_profile_choices);
446+
static struct kobj_attribute attr_platform_profile = __ATTR_RW(platform_profile);
447447

448448
static struct attribute *platform_profile_attrs[] = {
449-
&dev_attr_platform_profile_choices.attr,
450-
&dev_attr_platform_profile.attr,
449+
&attr_platform_profile_choices.attr,
450+
&attr_platform_profile.attr,
451451
NULL
452452
};
453453

@@ -627,24 +627,23 @@ EXPORT_SYMBOL_GPL(platform_profile_register);
627627
/**
628628
* platform_profile_remove - Unregisters a platform profile class device
629629
* @dev: Class device
630-
*
631-
* Return: 0
632630
*/
633-
int platform_profile_remove(struct device *dev)
631+
void platform_profile_remove(struct device *dev)
634632
{
635-
struct platform_profile_handler *pprof = to_pprof_handler(dev);
636-
int id;
633+
struct platform_profile_handler *pprof;
634+
635+
if (IS_ERR_OR_NULL(dev))
636+
return;
637+
638+
pprof = to_pprof_handler(dev);
639+
637640
guard(mutex)(&profile_lock);
638641

639-
id = pprof->minor;
642+
ida_free(&platform_profile_ida, pprof->minor);
640643
device_unregister(&pprof->dev);
641-
ida_free(&platform_profile_ida, id);
642644

643645
sysfs_notify(acpi_kobj, NULL, "platform_profile");
644-
645646
sysfs_update_group(acpi_kobj, &platform_profile_group);
646-
647-
return 0;
648647
}
649648
EXPORT_SYMBOL_GPL(platform_profile_remove);
650649

include/linux/platform_profile.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ struct platform_profile_ops {
5050
struct device *platform_profile_register(struct device *dev, const char *name,
5151
void *drvdata,
5252
const struct platform_profile_ops *ops);
53-
int platform_profile_remove(struct device *dev);
53+
void platform_profile_remove(struct device *dev);
5454
struct device *devm_platform_profile_register(struct device *dev, const char *name,
5555
void *drvdata,
5656
const struct platform_profile_ops *ops);

0 commit comments

Comments
 (0)