Loading drivers/leds/leds-qpnp-flash-v2.c +5 −46 Original line number Diff line number Diff line Loading @@ -745,8 +745,11 @@ static int get_property_from_fg(struct qpnp_flash_led *led, union power_supply_propval pval = {0, }; if (!led->bms_psy) { pr_err("no bms psy found\n"); return -EINVAL; led->bms_psy = power_supply_get_by_name("bms"); if (!led->bms_psy) { pr_err_ratelimited("Couldn't get bms_psy\n"); return -ENODEV; } } rc = power_supply_get_property(led->bms_psy, prop, &pval); Loading Loading @@ -1793,41 +1796,6 @@ static struct device_attribute qpnp_flash_led_attrs[] = { __ATTR(enable, 0664, NULL, qpnp_flash_led_prepare_store), }; static int flash_led_psy_notifier_call(struct notifier_block *nb, unsigned long ev, void *v) { struct power_supply *psy = v; struct qpnp_flash_led *led = container_of(nb, struct qpnp_flash_led, nb); if (ev != PSY_EVENT_PROP_CHANGED) return NOTIFY_OK; if (!strcmp(psy->desc->name, "bms")) { led->bms_psy = power_supply_get_by_name("bms"); if (!led->bms_psy) pr_err("Failed to get bms power_supply\n"); else power_supply_unreg_notifier(&led->nb); } return NOTIFY_OK; } static int flash_led_psy_register_notifier(struct qpnp_flash_led *led) { int rc; led->nb.notifier_call = flash_led_psy_notifier_call; rc = power_supply_reg_notifier(&led->nb); if (rc < 0) { pr_err("Couldn't register psy notifier, rc = %d\n", rc); return rc; } return 0; } /* irq handler */ static irqreturn_t qpnp_flash_led_irq_handler(int irq, void *_led) { Loading Loading @@ -2821,15 +2789,6 @@ static int qpnp_flash_led_probe(struct platform_device *pdev) } } led->bms_psy = power_supply_get_by_name("bms"); if (!led->bms_psy) { rc = flash_led_psy_register_notifier(led); if (rc < 0) { pr_err("Couldn't register psy notifier, rc = %d\n", rc); goto error_switch_register; } } rc = qpnp_flash_led_init_settings(led); if (rc < 0) { pr_err("Failed to initialize flash LED, rc=%d\n", rc); Loading Loading
drivers/leds/leds-qpnp-flash-v2.c +5 −46 Original line number Diff line number Diff line Loading @@ -745,8 +745,11 @@ static int get_property_from_fg(struct qpnp_flash_led *led, union power_supply_propval pval = {0, }; if (!led->bms_psy) { pr_err("no bms psy found\n"); return -EINVAL; led->bms_psy = power_supply_get_by_name("bms"); if (!led->bms_psy) { pr_err_ratelimited("Couldn't get bms_psy\n"); return -ENODEV; } } rc = power_supply_get_property(led->bms_psy, prop, &pval); Loading Loading @@ -1793,41 +1796,6 @@ static struct device_attribute qpnp_flash_led_attrs[] = { __ATTR(enable, 0664, NULL, qpnp_flash_led_prepare_store), }; static int flash_led_psy_notifier_call(struct notifier_block *nb, unsigned long ev, void *v) { struct power_supply *psy = v; struct qpnp_flash_led *led = container_of(nb, struct qpnp_flash_led, nb); if (ev != PSY_EVENT_PROP_CHANGED) return NOTIFY_OK; if (!strcmp(psy->desc->name, "bms")) { led->bms_psy = power_supply_get_by_name("bms"); if (!led->bms_psy) pr_err("Failed to get bms power_supply\n"); else power_supply_unreg_notifier(&led->nb); } return NOTIFY_OK; } static int flash_led_psy_register_notifier(struct qpnp_flash_led *led) { int rc; led->nb.notifier_call = flash_led_psy_notifier_call; rc = power_supply_reg_notifier(&led->nb); if (rc < 0) { pr_err("Couldn't register psy notifier, rc = %d\n", rc); return rc; } return 0; } /* irq handler */ static irqreturn_t qpnp_flash_led_irq_handler(int irq, void *_led) { Loading Loading @@ -2821,15 +2789,6 @@ static int qpnp_flash_led_probe(struct platform_device *pdev) } } led->bms_psy = power_supply_get_by_name("bms"); if (!led->bms_psy) { rc = flash_led_psy_register_notifier(led); if (rc < 0) { pr_err("Couldn't register psy notifier, rc = %d\n", rc); goto error_switch_register; } } rc = qpnp_flash_led_init_settings(led); if (rc < 0) { pr_err("Failed to initialize flash LED, rc=%d\n", rc); Loading