Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 89409211 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

device create: sound: convert device_create to device_create_drvdata



device_create() is race-prone, so use the race-free
device_create_drvdata() instead as device_create() is going away.

Cc: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 9def0b97
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -548,7 +548,8 @@ int snd_card_register(struct snd_card *card)
	snd_assert(card != NULL, return -EINVAL);
#ifndef CONFIG_SYSFS_DEPRECATED
	if (!card->card_dev) {
		card->card_dev = device_create(sound_class, card->dev, 0,
		card->card_dev = device_create_drvdata(sound_class, card->dev,
						       MKDEV(0, 0), NULL,
						       "card%i", card->number);
		if (IS_ERR(card->card_dev))
			card->card_dev = NULL;
+8 −6
Original line number Diff line number Diff line
@@ -560,16 +560,18 @@ static int __init oss_init(void)
	sound_dmap_flag = (dmabuf > 0 ? 1 : 0);

	for (i = 0; i < ARRAY_SIZE(dev_list); i++) {
		device_create(sound_class, NULL,
		device_create_drvdata(sound_class, NULL,
				      MKDEV(SOUND_MAJOR, dev_list[i].minor),
			      "%s", dev_list[i].name);
				      NULL, "%s", dev_list[i].name);

		if (!dev_list[i].num)
			continue;

		for (j = 1; j < *dev_list[i].num; j++)
			device_create(sound_class, NULL,
				      MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10)),
			device_create_drvdata(sound_class, NULL,
					      MKDEV(SOUND_MAJOR,
						    dev_list[i].minor + (j*0x10)),
					      NULL,
					      "%s%d", dev_list[i].name, j);
	}

+3 −2
Original line number Diff line number Diff line
@@ -171,8 +171,9 @@ static int sound_insert_unit(struct sound_unit **list, const struct file_operati
	else
		sprintf(s->name, "sound/%s%d", name, r / SOUND_STEP);

	device_create(sound_class, dev, MKDEV(SOUND_MAJOR, s->unit_minor),
		      s->name+6);
	device_create_drvdata(sound_class, dev,
			      MKDEV(SOUND_MAJOR, s->unit_minor),
			      NULL, s->name+6);
	return r;

 fail: