Skip to content

Commit 9597965

Browse files
committed
Merge back ACPI platform_profile material for 6.15
2 parents d403120 + bb519cf commit 9597965

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
@@ -260,14 +260,14 @@ static int _aggregate_choices(struct device *dev, void *data)
260260

261261
/**
262262
* platform_profile_choices_show - Show the available profile choices for legacy sysfs interface
263-
* @dev: The device
263+
* @kobj: The kobject
264264
* @attr: The attribute
265265
* @buf: The buffer to write to
266266
*
267267
* Return: The number of bytes written
268268
*/
269-
static ssize_t platform_profile_choices_show(struct device *dev,
270-
struct device_attribute *attr,
269+
static ssize_t platform_profile_choices_show(struct kobject *kobj,
270+
struct kobj_attribute *attr,
271271
char *buf)
272272
{
273273
unsigned long aggregate[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)];
@@ -333,14 +333,14 @@ static int _store_and_notify(struct device *dev, void *data)
333333

334334
/**
335335
* platform_profile_show - Show the current profile for legacy sysfs interface
336-
* @dev: The device
336+
* @kobj: The kobject
337337
* @attr: The attribute
338338
* @buf: The buffer to write to
339339
*
340340
* Return: The number of bytes written
341341
*/
342-
static ssize_t platform_profile_show(struct device *dev,
343-
struct device_attribute *attr,
342+
static ssize_t platform_profile_show(struct kobject *kobj,
343+
struct kobj_attribute *attr,
344344
char *buf)
345345
{
346346
enum platform_profile_option profile = PLATFORM_PROFILE_LAST;
@@ -362,15 +362,15 @@ static ssize_t platform_profile_show(struct device *dev,
362362

363363
/**
364364
* platform_profile_store - Set the profile for legacy sysfs interface
365-
* @dev: The device
365+
* @kobj: The kobject
366366
* @attr: The attribute
367367
* @buf: The buffer to read from
368368
* @count: The number of bytes to read
369369
*
370370
* Return: The number of bytes read
371371
*/
372-
static ssize_t platform_profile_store(struct device *dev,
373-
struct device_attribute *attr,
372+
static ssize_t platform_profile_store(struct kobject *kobj,
373+
struct kobj_attribute *attr,
374374
const char *buf, size_t count)
375375
{
376376
unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)];
@@ -401,12 +401,12 @@ static ssize_t platform_profile_store(struct device *dev,
401401
return count;
402402
}
403403

404-
static DEVICE_ATTR_RO(platform_profile_choices);
405-
static DEVICE_ATTR_RW(platform_profile);
404+
static struct kobj_attribute attr_platform_profile_choices = __ATTR_RO(platform_profile_choices);
405+
static struct kobj_attribute attr_platform_profile = __ATTR_RW(platform_profile);
406406

407407
static struct attribute *platform_profile_attrs[] = {
408-
&dev_attr_platform_profile_choices.attr,
409-
&dev_attr_platform_profile.attr,
408+
&attr_platform_profile_choices.attr,
409+
&attr_platform_profile.attr,
410410
NULL
411411
};
412412

@@ -575,24 +575,23 @@ EXPORT_SYMBOL_GPL(platform_profile_register);
575575
/**
576576
* platform_profile_remove - Unregisters a platform profile class device
577577
* @dev: Class device
578-
*
579-
* Return: 0
580578
*/
581-
int platform_profile_remove(struct device *dev)
579+
void platform_profile_remove(struct device *dev)
582580
{
583-
struct platform_profile_handler *pprof = to_pprof_handler(dev);
584-
int id;
581+
struct platform_profile_handler *pprof;
582+
583+
if (IS_ERR_OR_NULL(dev))
584+
return;
585+
586+
pprof = to_pprof_handler(dev);
587+
585588
guard(mutex)(&profile_lock);
586589

587-
id = pprof->minor;
590+
ida_free(&platform_profile_ida, pprof->minor);
588591
device_unregister(&pprof->dev);
589-
ida_free(&platform_profile_ida, id);
590592

591593
sysfs_notify(acpi_kobj, NULL, "platform_profile");
592-
593594
sysfs_update_group(acpi_kobj, &platform_profile_group);
594-
595-
return 0;
596595
}
597596
EXPORT_SYMBOL_GPL(platform_profile_remove);
598597

include/linux/platform_profile.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ struct platform_profile_ops {
4747
struct device *platform_profile_register(struct device *dev, const char *name,
4848
void *drvdata,
4949
const struct platform_profile_ops *ops);
50-
int platform_profile_remove(struct device *dev);
50+
void platform_profile_remove(struct device *dev);
5151
struct device *devm_platform_profile_register(struct device *dev, const char *name,
5252
void *drvdata,
5353
const struct platform_profile_ops *ops);

0 commit comments

Comments
 (0)