static void dvfs_sysdev_ctrl_exit(void) { sysdev_remove_file(&dvfs_device, &attr_enable); sysdev_remove_file(&dvfs_device, &attr_status); sysdev_unregister(&dvfs_device); sysdev_class_unregister(&dvfs_sysclass); }
/** * unregister_node - unregister a node device * @node: node going away * * Unregisters a node device @node. All the devices on the node must be * unregistered before calling this function. */ void unregister_node(struct node *node) { sysdev_remove_file(&node->sysdev, &attr_cpumap); sysdev_remove_file(&node->sysdev, &attr_meminfo); sysdev_remove_file(&node->sysdev, &attr_numastat); sysdev_remove_file(&node->sysdev, &attr_distance); sysdev_unregister(&node->sysdev); }
static int summit_smb347_remove(struct i2c_client *client) { struct summit_smb347_info *info = i2c_get_clientdata(client); i2c_set_clientdata(client, info); sysdev_remove_file(&device_smb347_reg, &attr_smb347_reg); sysdev_remove_file(&device_smb347_register, &attr_smb347_register); return 0; }
/** * unregister_node - unregister a node device * @node: node going away * * Unregisters a node device @node. All the devices on the node must be * unregistered before calling this function. */ void unregister_node(struct node *node) { sysdev_remove_file(&node->sysdev, &attr_cpumap); sysdev_remove_file(&node->sysdev, &attr_cpulist); sysdev_remove_file(&node->sysdev, &attr_meminfo); sysdev_remove_file(&node->sysdev, &attr_numastat); sysdev_remove_file(&node->sysdev, &attr_distance); scan_unevictable_unregister_node(node); hugetlb_unregister_node(node); /* no-op, if memoryless node */ sysdev_unregister(&node->sysdev); }
void dma_remove_sysfs_files(struct dma_channel *chan, struct dma_info *info) { struct sys_device *dev = &chan->dev; char name[16]; sysdev_remove_file(dev, &attr_dev_id); sysdev_remove_file(dev, &attr_count); sysdev_remove_file(dev, &attr_mode); sysdev_remove_file(dev, &attr_flags); sysdev_remove_file(dev, &attr_config); snprintf(name, sizeof(name), "dma%d", chan->chan); sysfs_remove_link(&info->pdev->dev.kobj, name); sysdev_unregister(dev); }
static void unregister_mmu_stats(struct sys_device *s) { if (!mmu_stats_supported) return; sysfs_remove_group(&s->kobj, &mmu_stat_group); sysdev_remove_file(s, &attr_mmustat_enable); }
/** * cmm_sysfs_register - Register with sysfs * * Return value: * 0 on success / other on failure **/ static int cmm_sysfs_register(struct sys_device *sysdev) { int i, rc; if ((rc = sysdev_class_register(&cmm_sysdev_class))) return rc; sysdev->id = 0; sysdev->cls = &cmm_sysdev_class; if ((rc = sysdev_register(sysdev))) goto class_unregister; for (i = 0; i < ARRAY_SIZE(cmm_attrs); i++) { if ((rc = sysdev_create_file(sysdev, cmm_attrs[i]))) goto fail; } return 0; fail: while (--i >= 0) sysdev_remove_file(sysdev, cmm_attrs[i]); sysdev_unregister(sysdev); class_unregister: sysdev_class_unregister(&cmm_sysdev_class); return rc; }
/** * cmm_unregister_sysfs - Unregister from sysfs * **/ static void cmm_unregister_sysfs(struct sys_device *sysdev) { int i; for (i = 0; i < ARRAY_SIZE(cmm_attrs); i++) sysdev_remove_file(sysdev, cmm_attrs[i]); sysdev_unregister(sysdev); sysdev_class_unregister(&cmm_sysdev_class); }
static __exit void unregister_balloon(struct sys_device *sysdev) { int i; sysfs_remove_group(&sysdev->kobj, &balloon_info_group); for (i = 0; i < ARRAY_SIZE(balloon_attrs); i++) sysdev_remove_file(sysdev, balloon_attrs[i]); sysdev_unregister(sysdev); sysdev_class_unregister(&balloon_sysdev_class); }
static void unregister_cpu_online(unsigned int cpu) { struct cpu *c = &per_cpu(cpu_devices, cpu); struct sys_device *s = &c->sysdev; int i; unregister_mmu_stats(s); for (i = 0; i < ARRAY_SIZE(cpu_core_attrs); i++) sysdev_remove_file(s, &cpu_core_attrs[i]); }
void unregister_cpu(struct cpu *cpu) { int logical_cpu = cpu->sysdev.id; unregister_cpu_under_node(logical_cpu, cpu_to_node(logical_cpu)); sysdev_remove_file(&cpu->sysdev, &attr_online); sysdev_unregister(&cpu->sysdev); per_cpu(cpu_sys_devices, logical_cpu) = NULL; return; }
void unregister_cpu(struct cpu *cpu, struct node *root) { if (root) sysfs_remove_link(&root->sysdev.kobj, kobject_name(&cpu->sysdev.kobj)); sysdev_remove_file(&cpu->sysdev, &attr_online); sysdev_unregister(&cpu->sysdev); return; }
void cpu_remove_sysdev_attr(struct sysdev_attribute *attr) { int cpu; mutex_lock(&cpu_mutex); for_each_possible_cpu(cpu) { sysdev_remove_file(get_cpu_sysdev(cpu), attr); } mutex_unlock(&cpu_mutex); }
void unregister_cpu(struct cpu *cpu, struct node *root) { int logical_cpu = cpu->sysdev.id; if (root) sysfs_remove_link(&root->sysdev.kobj, kobject_name(&cpu->sysdev.kobj)); sysdev_remove_file(&cpu->sysdev, &attr_online); sysdev_unregister(&cpu->sysdev); cpu_sys_devices[logical_cpu] = NULL; return; }
static void unregister_cpu_online(unsigned int cpu) { struct cpu *c = &per_cpu(cpu_devices, cpu); struct sys_device *s = &c->sysdev; struct sysdev_attribute *attrs, *pmc_attrs; int i, nattrs; BUG_ON(!c->hotpluggable); if (!firmware_has_feature(FW_FEATURE_ISERIES) && cpu_has_feature(CPU_FTR_SMT)) sysdev_remove_file(s, &attr_smt_snooze_delay); /* PMC stuff */ switch (cur_cpu_spec->pmc_type) { case PPC_PMC_IBM: attrs = ibm_common_attrs; nattrs = sizeof(ibm_common_attrs) / sizeof(struct sysdev_attribute); pmc_attrs = ibm_pmc_attrs; break; case PPC_PMC_PA6T: /* PA Semi starts counting at PMC0 */ attrs = pa6t_attrs; nattrs = sizeof(pa6t_attrs) / sizeof(struct sysdev_attribute); pmc_attrs = NULL; break; default: attrs = NULL; nattrs = 0; pmc_attrs = NULL; } for (i = 0; i < nattrs; i++) sysdev_remove_file(s, &attrs[i]); if (pmc_attrs) for (i = 0; i < cur_cpu_spec->num_pmcs; i++) sysdev_remove_file(s, &pmc_attrs[i]); if (cpu_has_feature(CPU_FTR_MMCRA)) sysdev_remove_file(s, &attr_mmcra); if (cpu_has_feature(CPU_FTR_PURR)) sysdev_remove_file(s, &attr_purr); if (cpu_has_feature(CPU_FTR_SPURR)) sysdev_remove_file(s, &attr_spurr); if (cpu_has_feature(CPU_FTR_DSCR)) sysdev_remove_file(s, &attr_dscr); }
/* * Sys device register * * sysdev file: * * /sys/devices/system/zte_ftm/zte_ftm0/fusion * /sys/devices/system/zte_ftm/zte_ftm0/simlocking */ static int32_t ftm_register_sysdev(struct sys_device *sysdev) { int32_t ret; int32_t i; ret = sysdev_class_register(&ftm_sysdev_class); if (ret) { return ret; } sysdev->id = 0; sysdev->cls = &ftm_sysdev_class; ret = sysdev_register(sysdev); if (ret) { sysdev_class_unregister(&ftm_sysdev_class); return ret; } for (i = 0; i < ARRAY_SIZE(ftm_attrs); i++) { ret = sysdev_create_file(sysdev, ftm_attrs[i]); if (ret) { goto ftm_fail; } } return 0; ftm_fail: while (--i >= 0) sysdev_remove_file(sysdev, ftm_attrs[i]); sysdev_unregister(sysdev); sysdev_class_unregister(&ftm_sysdev_class); return ret; }
/* * MSM LED Trigger Sys Device Register * * 1. Torch Mode * enable: $ echo "1" > /sys/devices/system/led-flash/led-flash0/torch * disable: $ echo "0" > /sys/devices/system/led-flash/led-flash0/torch * * 2. Flash Mode * enable: $ echo "1" > /sys/devices/system/led-flash/led-flash0/flash * disable: $ echo "0" > /sys/devices/system/led-flash/led-flash0/flash */ static int32_t msm_led_trigger_register_sysdev(struct msm_led_flash_ctrl_t *fctrl) { int32_t i, rc; rc = sysdev_class_register(&msm_led_trigger_sysdev_class); if (rc) { return rc; } msm_led_trigger_sysdev.id = 0; msm_led_trigger_sysdev.cls = &msm_led_trigger_sysdev_class; rc = sysdev_register(&msm_led_trigger_sysdev); if (rc) { sysdev_class_unregister(&msm_led_trigger_sysdev_class); return rc; } for (i = 0; i < ARRAY_SIZE(msm_led_trigger_sysdev_attrs); ++i) { rc = sysdev_create_file(&msm_led_trigger_sysdev, msm_led_trigger_sysdev_attrs[i]); if (rc) { goto msm_led_trigger_register_sysdev_failed; } } msm_led_trigger_sysdev_fctrl = fctrl; return 0; msm_led_trigger_register_sysdev_failed: while (--i >= 0) sysdev_remove_file(&msm_led_trigger_sysdev, msm_led_trigger_sysdev_attrs[i]); sysdev_unregister(&msm_led_trigger_sysdev); sysdev_class_unregister(&msm_led_trigger_sysdev_class); return rc; }
static int __init register_balloon(struct sys_device *sysdev) { int i, error; error = sysdev_class_register(&balloon_sysdev_class); if (error) return error; sysdev->id = 0; sysdev->cls = &balloon_sysdev_class; error = sysdev_register(sysdev); if (error) { sysdev_class_unregister(&balloon_sysdev_class); return error; } for (i = 0; i < ARRAY_SIZE(balloon_attrs); i++) { error = sysdev_create_file(sysdev, balloon_attrs[i]); if (error) goto fail; } error = sysfs_create_group(&sysdev->kobj, &balloon_info_group); if (error) goto fail; return 0; fail: while (--i >= 0) sysdev_remove_file(sysdev, balloon_attrs[i]); sysdev_unregister(sysdev); sysdev_class_unregister(&balloon_sysdev_class); return error; }
static void mx50_accessory_sysdev_ctrl_exit(void) { sysdev_remove_file(&mx50_accessory_device, &attr_mx50_accessory_state); sysdev_unregister(&mx50_accessory_device); sysdev_class_unregister(&mx50_accessory_sysclass); }
static void unregister_cpu_online(unsigned int cpu) { struct cpu *c = &per_cpu(cpu_devices, cpu); struct sys_device *s = &c->sysdev; BUG_ON(c->no_control); #ifndef CONFIG_PPC_ISERIES if (cpu_has_feature(CPU_FTR_SMT)) sysdev_remove_file(s, &attr_smt_snooze_delay); #endif /* PMC stuff */ sysdev_remove_file(s, &attr_mmcr0); sysdev_remove_file(s, &attr_mmcr1); if (cpu_has_feature(CPU_FTR_MMCRA)) sysdev_remove_file(s, &attr_mmcra); if (cur_cpu_spec->num_pmcs >= 1) sysdev_remove_file(s, &attr_pmc1); if (cur_cpu_spec->num_pmcs >= 2) sysdev_remove_file(s, &attr_pmc2); if (cur_cpu_spec->num_pmcs >= 3) sysdev_remove_file(s, &attr_pmc3); if (cur_cpu_spec->num_pmcs >= 4) sysdev_remove_file(s, &attr_pmc4); if (cur_cpu_spec->num_pmcs >= 5) sysdev_remove_file(s, &attr_pmc5); if (cur_cpu_spec->num_pmcs >= 6) sysdev_remove_file(s, &attr_pmc6); if (cur_cpu_spec->num_pmcs >= 7) sysdev_remove_file(s, &attr_pmc7); if (cur_cpu_spec->num_pmcs >= 8) sysdev_remove_file(s, &attr_pmc8); if (cpu_has_feature(CPU_FTR_SMT)) sysdev_remove_file(s, &attr_purr); }
static void bq27541_battery_sysdev_ctrl_exit(void) { sysdev_remove_file(&bq27541_battery_device, &attr_battery_id); sysdev_remove_file(&bq27541_battery_device, &attr_battery_current); sysdev_remove_file(&bq27541_battery_device, &attr_battery_voltage); sysdev_remove_file(&bq27541_battery_device, &attr_battery_temperature); sysdev_remove_file(&bq27541_battery_device, &attr_battery_capacity); sysdev_remove_file(&bq27541_battery_device, &attr_battery_mAH); sysdev_remove_file(&bq27541_battery_device, &attr_battery_voltage_thresholds); sysdev_remove_file(&bq27541_battery_device, &attr_battery_polling_intervals); sysdev_remove_file(&bq27541_battery_device, &attr_battery_temp_thresholds); sysdev_remove_file(&bq27541_battery_device, &attr_battery_i2c_address); sysdev_remove_file(&bq27541_battery_device, &attr_battery_error); sysdev_remove_file(&bq27541_battery_device, &attr_battery_suspend_current); sysdev_remove_file(&bq27541_battery_device, &attr_battery_current_diags); sysdev_remove_file(&bq27541_battery_device, &attr_battery_suspend_current_diags); sysdev_remove_file(&bq27541_battery_device, &attr_battery_cycl); sysdev_remove_file(&bq27541_battery_device, &attr_battery_lmd); sysdev_remove_file(&bq27541_battery_device, &attr_battery_cyct); sysdev_remove_file(&bq27541_battery_device, &attr_resume_stats); sysdev_remove_file(&bq27541_battery_device, &attr_battreg); sysdev_remove_file(&bq27541_battery_device, &attr_battreg_value); sysdev_unregister(&bq27541_battery_device); sysdev_class_unregister(&bq27541_battery_sysclass); }