summaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-02-19 11:18:10 +0100
committerTakashi Iwai <tiwai@suse.de>2014-02-19 11:20:32 +0100
commitb203dbab0838afa4b2de8b5bd880fb124446b764 (patch)
tree02a8fc1f6f0323b6aa04fb1f4d944dca10a03e84 /sound/core
parentdff86f86d43f17db8616d06f4150c8957d33864b (diff)
downloadop-kernel-dev-b203dbab0838afa4b2de8b5bd880fb124446b764.zip
op-kernel-dev-b203dbab0838afa4b2de8b5bd880fb124446b764.tar.gz
ALSA: core: Fix missing card sysfs contents
While moving the card device into struct snd_card, the reference to the assigned card in sysfs show/store callbacks were forgotten to be refreshed, still accessing to the no longer used drvdata. Fix these places to refer correctly via container_of(). Also, remove the superfluous NULL checks since it's guaranteed to be non-NULL now. Fixes: 8bfb181c17d2 ('ALSA: Embed card device into struct snd_card') Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/init.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sound/core/init.c b/sound/core/init.c
index 0095a53..b7085eb 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -624,15 +624,15 @@ static ssize_t
card_id_show_attr(struct device *dev,
struct device_attribute *attr, char *buf)
{
- struct snd_card *card = dev_get_drvdata(dev);
- return snprintf(buf, PAGE_SIZE, "%s\n", card ? card->id : "(null)");
+ struct snd_card *card = container_of(dev, struct snd_card, card_dev);
+ return snprintf(buf, PAGE_SIZE, "%s\n", card->id);
}
static ssize_t
card_id_store_attr(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
- struct snd_card *card = dev_get_drvdata(dev);
+ struct snd_card *card = container_of(dev, struct snd_card, card_dev);
char buf1[sizeof(card->id)];
size_t copy = count > sizeof(card->id) - 1 ?
sizeof(card->id) - 1 : count;
@@ -664,8 +664,8 @@ static ssize_t
card_number_show_attr(struct device *dev,
struct device_attribute *attr, char *buf)
{
- struct snd_card *card = dev_get_drvdata(dev);
- return snprintf(buf, PAGE_SIZE, "%i\n", card ? card->number : -1);
+ struct snd_card *card = container_of(dev, struct snd_card, card_dev);
+ return snprintf(buf, PAGE_SIZE, "%i\n", card->number);
}
static DEVICE_ATTR(number, S_IRUGO, card_number_show_attr, NULL);
OpenPOWER on IntegriCloud