Skip to content

Commit

Permalink
DCA: convert struct class_device to struct device.
Browse files Browse the repository at this point in the history
Thanks to Kay for keeping us honest.

Signed-off-by: Kay Sievers <[email protected]>
Signed-off-by: Shannon Nelson <[email protected]>
Cc: "Williams, Dan J" <[email protected]>
Acked-by: Greg KH <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
kaysievers authored and Linus Torvalds committed Feb 8, 2008
1 parent 11b0cc3 commit 765cdb6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
15 changes: 7 additions & 8 deletions drivers/dca/dca-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ static spinlock_t dca_idr_lock;

int dca_sysfs_add_req(struct dca_provider *dca, struct device *dev, int slot)
{
struct class_device *cd;
struct device *cd;

cd = class_device_create(dca_class, dca->cd, MKDEV(0, slot + 1),
dev, "requester%d", slot);
cd = device_create(dca_class, dca->cd, MKDEV(0, slot + 1),
"requester%d", slot);
if (IS_ERR(cd))
return PTR_ERR(cd);
return 0;
}

void dca_sysfs_remove_req(struct dca_provider *dca, int slot)
{
class_device_destroy(dca_class, MKDEV(0, slot + 1));
device_destroy(dca_class, MKDEV(0, slot + 1));
}

int dca_sysfs_add_provider(struct dca_provider *dca, struct device *dev)
{
struct class_device *cd;
struct device *cd;
int err = 0;

idr_try_again:
Expand All @@ -46,8 +46,7 @@ int dca_sysfs_add_provider(struct dca_provider *dca, struct device *dev)
return err;
}

cd = class_device_create(dca_class, NULL, MKDEV(0, 0),
dev, "dca%d", dca->id);
cd = device_create(dca_class, dev, MKDEV(0, 0), "dca%d", dca->id);
if (IS_ERR(cd)) {
spin_lock(&dca_idr_lock);
idr_remove(&dca_idr, dca->id);
Expand All @@ -60,7 +59,7 @@ int dca_sysfs_add_provider(struct dca_provider *dca, struct device *dev)

void dca_sysfs_remove_provider(struct dca_provider *dca)
{
class_device_unregister(dca->cd);
device_unregister(dca->cd);
dca->cd = NULL;
spin_lock(&dca_idr_lock);
idr_remove(&dca_idr, dca->id);
Expand Down
2 changes: 1 addition & 1 deletion include/linux/dca.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ void dca_unregister_notify(struct notifier_block *nb);

struct dca_provider {
struct dca_ops *ops;
struct class_device *cd;
struct device *cd;
int id;
};

Expand Down

0 comments on commit 765cdb6

Please sign in to comment.