[alsa-devel] [PATCH 1/4] ALSA: core: use dev_to_snd_card
Use dev_to_snd_card() instead of open-coding it.
Signed-off-by: Geliang Tang geliangtang@163.com --- sound/core/init.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/core/init.c b/sound/core/init.c index 20f37fb..fcb84e1 100644 --- a/sound/core/init.c +++ b/sound/core/init.c @@ -639,7 +639,7 @@ static ssize_t card_id_show_attr(struct device *dev, struct device_attribute *attr, char *buf) { - struct snd_card *card = container_of(dev, struct snd_card, card_dev); + struct snd_card *card = dev_to_snd_card(dev); return snprintf(buf, PAGE_SIZE, "%s\n", card->id); }
@@ -647,7 +647,7 @@ static ssize_t card_id_store_attr(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - struct snd_card *card = container_of(dev, struct snd_card, card_dev); + struct snd_card *card = dev_to_snd_card(dev); char buf1[sizeof(card->id)]; size_t copy = count > sizeof(card->id) - 1 ? sizeof(card->id) - 1 : count; @@ -679,7 +679,7 @@ static ssize_t card_number_show_attr(struct device *dev, struct device_attribute *attr, char *buf) { - struct snd_card *card = container_of(dev, struct snd_card, card_dev); + struct snd_card *card = dev_to_snd_card(dev); return snprintf(buf, PAGE_SIZE, "%i\n", card->number); }
dev_to_hdac is not used anymore so drop it.
Signed-off-by: Geliang Tang geliangtang@163.com --- sound/hda/ext/hdac_ext_bus.c | 2 -- 1 file changed, 2 deletions(-)
diff --git a/sound/hda/ext/hdac_ext_bus.c b/sound/hda/ext/hdac_ext_bus.c index 2433f7c..58f6b98 100644 --- a/sound/hda/ext/hdac_ext_bus.c +++ b/sound/hda/ext/hdac_ext_bus.c @@ -197,8 +197,6 @@ void snd_hdac_ext_bus_device_remove(struct hdac_ext_bus *ebus) } } EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_device_remove); -#define dev_to_hdac(dev) (container_of((dev), \ - struct hdac_device, dev))
static inline struct hdac_ext_driver *get_edrv(struct device *dev) {
On Mon, Dec 28, 2015 at 10:47:11PM +0800, Geliang Tang wrote:
dev_to_hdac is not used anymore so drop it.
No harm in keeping this for now as the systems using these will be coming up and more users will be upstreamed...
Signed-off-by: Geliang Tang geliangtang@163.com
sound/hda/ext/hdac_ext_bus.c | 2 -- 1 file changed, 2 deletions(-)
diff --git a/sound/hda/ext/hdac_ext_bus.c b/sound/hda/ext/hdac_ext_bus.c index 2433f7c..58f6b98 100644 --- a/sound/hda/ext/hdac_ext_bus.c +++ b/sound/hda/ext/hdac_ext_bus.c @@ -197,8 +197,6 @@ void snd_hdac_ext_bus_device_remove(struct hdac_ext_bus *ebus) } } EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_device_remove); -#define dev_to_hdac(dev) (container_of((dev), \
struct hdac_device, dev))
static inline struct hdac_ext_driver *get_edrv(struct device *dev) { -- 2.5.0
On Mon, Jan 04, 2016 at 01:53:47PM +0530, Vinod Koul wrote:
On Mon, Dec 28, 2015 at 10:47:11PM +0800, Geliang Tang wrote:
dev_to_hdac is not used anymore so drop it.
No harm in keeping this for now as the systems using these will be coming up and more users will be upstreamed...
Thanks for your review. Sorry that I didn't make myself clear in the commit log. What I droped is a repetitive macro. dev_to_hdac() in hdac_ext_bus.c and dev_to_hdac_dev() in hdaudio.h are the same:
include/sound/hdaudio.h: #define dev_to_hdac_dev(_dev) container_of(_dev, struct hdac_device, dev)
sound/hda/ext/hdac_ext_bus.c: #define dev_to_hdac(dev) (container_of((dev), \ struct hdac_device, dev))
Users should use dev_to_hdac_dev() in hdaudio.h, not dev_to_hdac().
-Geliang
Signed-off-by: Geliang Tang geliangtang@163.com
sound/hda/ext/hdac_ext_bus.c | 2 -- 1 file changed, 2 deletions(-)
diff --git a/sound/hda/ext/hdac_ext_bus.c b/sound/hda/ext/hdac_ext_bus.c index 2433f7c..58f6b98 100644 --- a/sound/hda/ext/hdac_ext_bus.c +++ b/sound/hda/ext/hdac_ext_bus.c @@ -197,8 +197,6 @@ void snd_hdac_ext_bus_device_remove(struct hdac_ext_bus *ebus) } } EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_device_remove); -#define dev_to_hdac(dev) (container_of((dev), \
struct hdac_device, dev))
static inline struct hdac_ext_driver *get_edrv(struct device *dev) { -- 2.5.0
Use dev_to_hdac_dev() instead of open-coding it.
Signed-off-by: Geliang Tang geliangtang@163.com --- sound/hda/ext/hdac_ext_bus.c | 2 +- sound/hda/hdac_device.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/hda/ext/hdac_ext_bus.c b/sound/hda/ext/hdac_ext_bus.c index 58f6b98..2522943 100644 --- a/sound/hda/ext/hdac_ext_bus.c +++ b/sound/hda/ext/hdac_ext_bus.c @@ -122,7 +122,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_exit);
static void default_release(struct device *dev) { - snd_hdac_ext_bus_device_exit(container_of(dev, struct hdac_device, dev)); + snd_hdac_ext_bus_device_exit(dev_to_hdac_dev(dev)); }
/** diff --git a/sound/hda/hdac_device.c b/sound/hda/hdac_device.c index e361024..959f7d9 100644 --- a/sound/hda/hdac_device.c +++ b/sound/hda/hdac_device.c @@ -18,7 +18,7 @@ static int get_codec_vendor_name(struct hdac_device *codec);
static void default_release(struct device *dev) { - snd_hdac_device_exit(container_of(dev, struct hdac_device, dev)); + snd_hdac_device_exit(dev_to_hdac_dev(dev)); }
/**
On Mon, Dec 28, 2015 at 10:47:12PM +0800, Geliang Tang wrote:
Use dev_to_hdac_dev() instead of open-coding it.
Signed-off-by: Geliang Tang geliangtang@163.com
Reviewed-by: Vinod Koul vinod.koul@intel.com
Thanks
Use dev_to_hdac_dev() and to_ehdac_device() instead of open-coding.
Signed-off-by: Geliang Tang geliangtang@163.com --- sound/soc/codecs/hdac_hdmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c index 1a2f33b..b999fb2 100644 --- a/sound/soc/codecs/hdac_hdmi.c +++ b/sound/soc/codecs/hdac_hdmi.c @@ -67,9 +67,9 @@ struct hdac_hdmi_priv {
static inline struct hdac_ext_device *to_hda_ext_device(struct device *dev) { - struct hdac_device *hdac = container_of(dev, struct hdac_device, dev); + struct hdac_device *hdac = dev_to_hdac_dev(dev);
- return container_of(hdac, struct hdac_ext_device, hdac); + return to_ehdac_device(hdac); }
static int hdac_hdmi_setup_stream(struct hdac_ext_device *hdac,
On Mon, Dec 28, 2015 at 10:47:13PM +0800, Geliang Tang wrote:
Use dev_to_hdac_dev() and to_ehdac_device() instead of open-coding.
Reviewed-by: Vinod Koul vinod.koul@intel.com
Thanks
The patch
ASoC: hdac_hdmi: use dev_to_hdac_dev and to_ehdac_device
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From 51b2c4258f29d83120819a829a78345a3dac17c4 Mon Sep 17 00:00:00 2001
From: Geliang Tang geliangtang@163.com Date: Mon, 28 Dec 2015 22:47:13 +0800 Subject: [PATCH] ASoC: hdac_hdmi: use dev_to_hdac_dev and to_ehdac_device
Use dev_to_hdac_dev() and to_ehdac_device() instead of open-coding.
Signed-off-by: Geliang Tang geliangtang@163.com Reviewed-by: Vinod Koul vinod.koul@intel.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/codecs/hdac_hdmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c index 1a2f33b4abfc..b999fb2a463b 100644 --- a/sound/soc/codecs/hdac_hdmi.c +++ b/sound/soc/codecs/hdac_hdmi.c @@ -67,9 +67,9 @@ struct hdac_hdmi_priv {
static inline struct hdac_ext_device *to_hda_ext_device(struct device *dev) { - struct hdac_device *hdac = container_of(dev, struct hdac_device, dev); + struct hdac_device *hdac = dev_to_hdac_dev(dev);
- return container_of(hdac, struct hdac_ext_device, hdac); + return to_ehdac_device(hdac); }
static int hdac_hdmi_setup_stream(struct hdac_ext_device *hdac,
participants (3)
-
Geliang Tang
-
Mark Brown
-
Vinod Koul