mirror of https://gitee.com/openkylin/linux.git
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6: [PATCH] ALSA: Fix sysfs breakage
This commit is contained in:
commit
08456d10a6
|
@ -132,8 +132,10 @@ struct snd_card {
|
||||||
int shutdown; /* this card is going down */
|
int shutdown; /* this card is going down */
|
||||||
int free_on_last_close; /* free in context of file_release */
|
int free_on_last_close; /* free in context of file_release */
|
||||||
wait_queue_head_t shutdown_sleep;
|
wait_queue_head_t shutdown_sleep;
|
||||||
struct device *parent;
|
struct device *dev; /* device assigned to this card */
|
||||||
struct device *dev;
|
#ifndef CONFIG_SYSFS_DEPRECATED
|
||||||
|
struct device *card_dev; /* cardX object for sysfs */
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_PM
|
#ifdef CONFIG_PM
|
||||||
unsigned int power_state; /* power state */
|
unsigned int power_state; /* power state */
|
||||||
|
@ -191,6 +193,16 @@ struct snd_minor {
|
||||||
struct device *dev; /* device for sysfs */
|
struct device *dev; /* device for sysfs */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* return a device pointer linked to each sound device as a parent */
|
||||||
|
static inline struct device *snd_card_get_device_link(struct snd_card *card)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_SYSFS_DEPRECATED
|
||||||
|
return card ? card->dev : NULL;
|
||||||
|
#else
|
||||||
|
return card ? card->card_dev : NULL;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* sound.c */
|
/* sound.c */
|
||||||
|
|
||||||
extern int snd_major;
|
extern int snd_major;
|
||||||
|
@ -257,7 +269,7 @@ int snd_card_file_add(struct snd_card *card, struct file *file);
|
||||||
int snd_card_file_remove(struct snd_card *card, struct file *file);
|
int snd_card_file_remove(struct snd_card *card, struct file *file);
|
||||||
|
|
||||||
#ifndef snd_card_set_dev
|
#ifndef snd_card_set_dev
|
||||||
#define snd_card_set_dev(card,devptr) ((card)->parent = (devptr))
|
#define snd_card_set_dev(card,devptr) ((card)->dev = (devptr))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* device.c */
|
/* device.c */
|
||||||
|
|
|
@ -361,8 +361,10 @@ static int snd_card_do_free(struct snd_card *card)
|
||||||
snd_printk(KERN_WARNING "unable to free card info\n");
|
snd_printk(KERN_WARNING "unable to free card info\n");
|
||||||
/* Not fatal error */
|
/* Not fatal error */
|
||||||
}
|
}
|
||||||
if (card->dev)
|
#ifndef CONFIG_SYSFS_DEPRECATED
|
||||||
device_unregister(card->dev);
|
if (card->card_dev)
|
||||||
|
device_unregister(card->card_dev);
|
||||||
|
#endif
|
||||||
kfree(card);
|
kfree(card);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -497,12 +499,14 @@ int snd_card_register(struct snd_card *card)
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
snd_assert(card != NULL, return -EINVAL);
|
snd_assert(card != NULL, return -EINVAL);
|
||||||
if (!card->dev) {
|
#ifndef CONFIG_SYSFS_DEPRECATED
|
||||||
card->dev = device_create(sound_class, card->parent, 0,
|
if (!card->card_dev) {
|
||||||
"card%i", card->number);
|
card->card_dev = device_create(sound_class, card->dev, 0,
|
||||||
if (IS_ERR(card->dev))
|
"card%i", card->number);
|
||||||
card->dev = NULL;
|
if (IS_ERR(card->card_dev))
|
||||||
|
card->card_dev = NULL;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if ((err = snd_device_register_all(card)) < 0)
|
if ((err = snd_device_register_all(card)) < 0)
|
||||||
return err;
|
return err;
|
||||||
mutex_lock(&snd_card_mutex);
|
mutex_lock(&snd_card_mutex);
|
||||||
|
|
|
@ -238,7 +238,7 @@ int snd_register_device(int type, struct snd_card *card, int dev,
|
||||||
{
|
{
|
||||||
int minor;
|
int minor;
|
||||||
struct snd_minor *preg;
|
struct snd_minor *preg;
|
||||||
struct device *device = NULL;
|
struct device *device = snd_card_get_device_link(card);
|
||||||
|
|
||||||
snd_assert(name, return -EINVAL);
|
snd_assert(name, return -EINVAL);
|
||||||
preg = kmalloc(sizeof *preg, GFP_KERNEL);
|
preg = kmalloc(sizeof *preg, GFP_KERNEL);
|
||||||
|
@ -263,8 +263,6 @@ int snd_register_device(int type, struct snd_card *card, int dev,
|
||||||
return minor;
|
return minor;
|
||||||
}
|
}
|
||||||
snd_minors[minor] = preg;
|
snd_minors[minor] = preg;
|
||||||
if (card)
|
|
||||||
device = card->dev;
|
|
||||||
preg->dev = device_create(sound_class, device, MKDEV(major, minor),
|
preg->dev = device_create(sound_class, device, MKDEV(major, minor),
|
||||||
"%s", name);
|
"%s", name);
|
||||||
if (preg->dev)
|
if (preg->dev)
|
||||||
|
|
|
@ -106,7 +106,7 @@ int snd_register_oss_device(int type, struct snd_card *card, int dev,
|
||||||
int cidx = SNDRV_MINOR_OSS_CARD(minor);
|
int cidx = SNDRV_MINOR_OSS_CARD(minor);
|
||||||
int track2 = -1;
|
int track2 = -1;
|
||||||
int register1 = -1, register2 = -1;
|
int register1 = -1, register2 = -1;
|
||||||
struct device *carddev = NULL;
|
struct device *carddev = snd_card_get_device_link(card);
|
||||||
|
|
||||||
if (card && card->number >= 8)
|
if (card && card->number >= 8)
|
||||||
return 0; /* ignore silently */
|
return 0; /* ignore silently */
|
||||||
|
@ -134,8 +134,6 @@ int snd_register_oss_device(int type, struct snd_card *card, int dev,
|
||||||
track2 = SNDRV_MINOR_OSS(cidx, SNDRV_MINOR_OSS_DMMIDI1);
|
track2 = SNDRV_MINOR_OSS(cidx, SNDRV_MINOR_OSS_DMMIDI1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (card)
|
|
||||||
carddev = card->dev;
|
|
||||||
register1 = register_sound_special_device(f_ops, minor, carddev);
|
register1 = register_sound_special_device(f_ops, minor, carddev);
|
||||||
if (register1 != minor)
|
if (register1 != minor)
|
||||||
goto __end;
|
goto __end;
|
||||||
|
|
Loading…
Reference in New Issue