Skip to content

Commit 929a4d2

Browse files
andy-shevlag-linaro
authored andcommitted
mfd: intel_soc_pmic_bxtwc: Create sysfs attributes using core driver's facility
Driver core takes care of sysfs attributes. Use this facility instead of doing it explicitly in ->probe() and ->remove(). Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Lee Jones <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 5189952 commit 929a4d2

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

drivers/mfd/intel_soc_pmic_bxtwc.c

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,11 @@ static const struct attribute_group bxtwc_group = {
396396
.attrs = bxtwc_attrs,
397397
};
398398

399+
static const struct attribute_group *bxtwc_groups[] = {
400+
&bxtwc_group,
401+
NULL
402+
};
403+
399404
static const struct regmap_config bxtwc_regmap_config = {
400405
.reg_bits = 16,
401406
.val_bits = 8,
@@ -555,28 +560,14 @@ static int bxtwc_probe(struct platform_device *pdev)
555560
return ret;
556561
}
557562

558-
ret = sysfs_create_group(&pdev->dev.kobj, &bxtwc_group);
559-
if (ret) {
560-
dev_err(&pdev->dev, "Failed to create sysfs group %d\n", ret);
561-
return ret;
562-
}
563-
564563
/*
565564
* There is known hw bug. Upon reset BIT 5 of register
566565
* BXTWC_CHGR_LVL1_IRQ is 0 which is the expected value. However,
567566
* later it's set to 1(masked) automatically by hardware. So we
568567
* have the software workaround here to unmaksed it in order to let
569568
* charger interrutp work.
570569
*/
571-
regmap_update_bits(pmic->regmap, BXTWC_MIRQLVL1,
572-
BXTWC_MIRQLVL1_MCHGR, 0);
573-
574-
return 0;
575-
}
576-
577-
static int bxtwc_remove(struct platform_device *pdev)
578-
{
579-
sysfs_remove_group(&pdev->dev.kobj, &bxtwc_group);
570+
regmap_update_bits(pmic->regmap, BXTWC_MIRQLVL1, BXTWC_MIRQLVL1_MCHGR, 0);
580571

581572
return 0;
582573
}
@@ -616,12 +607,12 @@ MODULE_DEVICE_TABLE(acpi, bxtwc_acpi_ids);
616607

617608
static struct platform_driver bxtwc_driver = {
618609
.probe = bxtwc_probe,
619-
.remove = bxtwc_remove,
620610
.shutdown = bxtwc_shutdown,
621611
.driver = {
622612
.name = "BXTWC PMIC",
623613
.pm = &bxtwc_pm_ops,
624614
.acpi_match_table = ACPI_PTR(bxtwc_acpi_ids),
615+
.dev_groups = bxtwc_groups,
625616
},
626617
};
627618

0 commit comments

Comments
 (0)