Skip to content

Commit

Permalink
bus: subsys: update return type of ->remove_dev() to void
Browse files Browse the repository at this point in the history
Its return value is not used by the subsys core and nothing meaningful
can be done with it, even if we want to use it. The subsys device is
anyway getting removed.

Update prototype of ->remove_dev() to make its return type as void. Fix
all usage sites as well.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
vireshk authored and gregkh committed Aug 6, 2015
1 parent 52cdbdd commit 71db87b
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 23 deletions.
3 changes: 1 addition & 2 deletions arch/sh/kernel/cpu/sh4/sq.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,13 +355,12 @@ static int sq_dev_add(struct device *dev, struct subsys_interface *sif)
return error;
}

static int sq_dev_remove(struct device *dev, struct subsys_interface *sif)
static void sq_dev_remove(struct device *dev, struct subsys_interface *sif)
{
unsigned int cpu = dev->id;
struct kobject *kobj = sq_kobject[cpu];

kobject_put(kobj);
return 0;
}

static struct subsys_interface sq_interface = {
Expand Down
11 changes: 4 additions & 7 deletions arch/tile/kernel/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,16 +198,13 @@ static int hv_stats_device_add(struct device *dev, struct subsys_interface *sif)
return err;
}

static int hv_stats_device_remove(struct device *dev,
struct subsys_interface *sif)
static void hv_stats_device_remove(struct device *dev,
struct subsys_interface *sif)
{
int cpu = dev->id;

if (!cpu_online(cpu))
return 0;

sysfs_remove_file(&dev->kobj, &dev_attr_hv_stats.attr);
return 0;
if (cpu_online(cpu))
sysfs_remove_file(&dev->kobj, &dev_attr_hv_stats.attr);
}


Expand Down
5 changes: 2 additions & 3 deletions arch/x86/kernel/cpu/microcode/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,17 +377,16 @@ static int mc_device_add(struct device *dev, struct subsys_interface *sif)
return err;
}

static int mc_device_remove(struct device *dev, struct subsys_interface *sif)
static void mc_device_remove(struct device *dev, struct subsys_interface *sif)
{
int cpu = dev->id;

if (!cpu_online(cpu))
return 0;
return;

pr_debug("CPU%d removed\n", cpu);
microcode_fini_cpu(cpu);
sysfs_remove_group(&dev->kobj, &mc_attr_group);
return 0;
}

static struct subsys_interface mc_cpu_interface = {
Expand Down
12 changes: 5 additions & 7 deletions drivers/cpufreq/cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,7 @@ static int __cpufreq_remove_dev_finish(struct device *dev,
*
* Removes the cpufreq interface for a CPU device.
*/
static int cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif)
static void cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif)
{
unsigned int cpu = dev->id;
int ret;
Expand All @@ -1533,7 +1533,7 @@ static int cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif)
struct cpumask mask;

if (!policy)
return 0;
return;

cpumask_copy(&mask, policy->related_cpus);
cpumask_clear_cpu(cpu, &mask);
Expand All @@ -1544,19 +1544,17 @@ static int cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif)
*/
if (cpumask_intersects(&mask, cpu_present_mask)) {
remove_cpu_dev_symlink(policy, cpu);
return 0;
return;
}

cpufreq_policy_free(policy, true);
return 0;
return;
}

ret = __cpufreq_remove_dev_prepare(dev, sif);

if (!ret)
ret = __cpufreq_remove_dev_finish(dev, sif);

return ret;
__cpufreq_remove_dev_finish(dev, sif);
}

static void handle_update(struct work_struct *work)
Expand Down
4 changes: 1 addition & 3 deletions drivers/net/rionet.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ static int rionet_close(struct net_device *ndev)
return 0;
}

static int rionet_remove_dev(struct device *dev, struct subsys_interface *sif)
static void rionet_remove_dev(struct device *dev, struct subsys_interface *sif)
{
struct rio_dev *rdev = to_rio_dev(dev);
unsigned char netid = rdev->net->hport->id;
Expand All @@ -416,8 +416,6 @@ static int rionet_remove_dev(struct device *dev, struct subsys_interface *sif)
}
}
}

return 0;
}

static void rionet_get_drvinfo(struct net_device *ndev,
Expand Down
2 changes: 1 addition & 1 deletion include/linux/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ struct subsys_interface {
struct bus_type *subsys;
struct list_head node;
int (*add_dev)(struct device *dev, struct subsys_interface *sif);
int (*remove_dev)(struct device *dev, struct subsys_interface *sif);
void (*remove_dev)(struct device *dev, struct subsys_interface *sif);
};

int subsys_interface_register(struct subsys_interface *sif);
Expand Down

0 comments on commit 71db87b

Please sign in to comment.