mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-10-22 23:13:01 +02:00
ALSA: core: fix up bus match const issues.
[ Upstream commit62f134ab19
] In commitd69d804845
("driver core: have match() callback in struct bus_type take a const *"), the match bus callback was changed to have the driver be a const pointer. Unfortunately that const attribute was thrown away when container_of() is called, which is not correct and was not caught by the compiler due to how container_of() is implemented. Fix this up by correctly preserving the const attribute of the driver passed to the bus match function which requires the hdac_driver match function to also take a const pointer for the driver structure. Cc: Jaroslav Kysela <perex@perex.cz> Cc: Takashi Iwai <tiwai@suse.com> Fixes:d69d804845
("driver core: have match() callback in struct bus_type take a const *") Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://patch.msgid.link/2025052204-hyphen-thermal-3e72@gregkh Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
9bad55fc4a
commit
45844a9403
|
@ -223,7 +223,7 @@ struct hdac_driver {
|
||||||
struct device_driver driver;
|
struct device_driver driver;
|
||||||
int type;
|
int type;
|
||||||
const struct hda_device_id *id_table;
|
const struct hda_device_id *id_table;
|
||||||
int (*match)(struct hdac_device *dev, struct hdac_driver *drv);
|
int (*match)(struct hdac_device *dev, const struct hdac_driver *drv);
|
||||||
void (*unsol_event)(struct hdac_device *dev, unsigned int event);
|
void (*unsol_event)(struct hdac_device *dev, unsigned int event);
|
||||||
|
|
||||||
/* fields used by ext bus APIs */
|
/* fields used by ext bus APIs */
|
||||||
|
@ -235,7 +235,7 @@ struct hdac_driver {
|
||||||
#define drv_to_hdac_driver(_drv) container_of(_drv, struct hdac_driver, driver)
|
#define drv_to_hdac_driver(_drv) container_of(_drv, struct hdac_driver, driver)
|
||||||
|
|
||||||
const struct hda_device_id *
|
const struct hda_device_id *
|
||||||
hdac_get_device_id(struct hdac_device *hdev, struct hdac_driver *drv);
|
hdac_get_device_id(struct hdac_device *hdev, const struct hdac_driver *drv);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Bus verb operators
|
* Bus verb operators
|
||||||
|
|
|
@ -43,7 +43,7 @@ MODULE_LICENSE("GPL");
|
||||||
static int snd_seq_bus_match(struct device *dev, const struct device_driver *drv)
|
static int snd_seq_bus_match(struct device *dev, const struct device_driver *drv)
|
||||||
{
|
{
|
||||||
struct snd_seq_device *sdev = to_seq_dev(dev);
|
struct snd_seq_device *sdev = to_seq_dev(dev);
|
||||||
struct snd_seq_driver *sdrv = to_seq_drv(drv);
|
const struct snd_seq_driver *sdrv = to_seq_drv(drv);
|
||||||
|
|
||||||
return strcmp(sdrv->id, sdev->id) == 0 &&
|
return strcmp(sdrv->id, sdev->id) == 0 &&
|
||||||
sdrv->argsize == sdev->argsize;
|
sdrv->argsize == sdev->argsize;
|
||||||
|
|
|
@ -21,7 +21,7 @@ MODULE_LICENSE("GPL");
|
||||||
* driver id_table and returns the matching device id entry.
|
* driver id_table and returns the matching device id entry.
|
||||||
*/
|
*/
|
||||||
const struct hda_device_id *
|
const struct hda_device_id *
|
||||||
hdac_get_device_id(struct hdac_device *hdev, struct hdac_driver *drv)
|
hdac_get_device_id(struct hdac_device *hdev, const struct hdac_driver *drv)
|
||||||
{
|
{
|
||||||
if (drv->id_table) {
|
if (drv->id_table) {
|
||||||
const struct hda_device_id *id = drv->id_table;
|
const struct hda_device_id *id = drv->id_table;
|
||||||
|
@ -38,7 +38,7 @@ hdac_get_device_id(struct hdac_device *hdev, struct hdac_driver *drv)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(hdac_get_device_id);
|
EXPORT_SYMBOL_GPL(hdac_get_device_id);
|
||||||
|
|
||||||
static int hdac_codec_match(struct hdac_device *dev, struct hdac_driver *drv)
|
static int hdac_codec_match(struct hdac_device *dev, const struct hdac_driver *drv)
|
||||||
{
|
{
|
||||||
if (hdac_get_device_id(dev, drv))
|
if (hdac_get_device_id(dev, drv))
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -49,7 +49,7 @@ static int hdac_codec_match(struct hdac_device *dev, struct hdac_driver *drv)
|
||||||
static int hda_bus_match(struct device *dev, const struct device_driver *drv)
|
static int hda_bus_match(struct device *dev, const struct device_driver *drv)
|
||||||
{
|
{
|
||||||
struct hdac_device *hdev = dev_to_hdac_dev(dev);
|
struct hdac_device *hdev = dev_to_hdac_dev(dev);
|
||||||
struct hdac_driver *hdrv = drv_to_hdac_driver(drv);
|
const struct hdac_driver *hdrv = drv_to_hdac_driver(drv);
|
||||||
|
|
||||||
if (hdev->type != hdrv->type)
|
if (hdev->type != hdrv->type)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -18,10 +18,10 @@
|
||||||
/*
|
/*
|
||||||
* find a matching codec id
|
* find a matching codec id
|
||||||
*/
|
*/
|
||||||
static int hda_codec_match(struct hdac_device *dev, struct hdac_driver *drv)
|
static int hda_codec_match(struct hdac_device *dev, const struct hdac_driver *drv)
|
||||||
{
|
{
|
||||||
struct hda_codec *codec = container_of(dev, struct hda_codec, core);
|
struct hda_codec *codec = container_of(dev, struct hda_codec, core);
|
||||||
struct hda_codec_driver *driver =
|
const struct hda_codec_driver *driver =
|
||||||
container_of(drv, struct hda_codec_driver, core);
|
container_of(drv, struct hda_codec_driver, core);
|
||||||
const struct hda_device_id *list;
|
const struct hda_device_id *list;
|
||||||
/* check probe_id instead of vendor_id if set */
|
/* check probe_id instead of vendor_id if set */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user