drivers/soundwire/bus.c:173:21: warning: assignment to 'struct irq_domain *' from 'int' makes pointer from integer without a cast

From: kernel test robot
Date: Thu Sep 14 2023 - 17:59:17 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 9fdfb15a3dbf818e06be514f4abbfc071004cbe7
commit: 12a95123bfe1dd1a6020a35f5e67a560591bb02a soundwire: bus: Allow SoundWire peripherals to register IRQ handlers
date: 4 weeks ago
config: s390-randconfig-r031-20220110 (https://download.01.org/0day-ci/archive/20230915/202309150522.MoKeF4jx-lkp@xxxxxxxxx/config)
compiler: s390-linux-gcc (GCC) 11.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230915/202309150522.MoKeF4jx-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309150522.MoKeF4jx-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

drivers/soundwire/bus.c: In function 'sdw_bus_master_add':
drivers/soundwire/bus.c:173:23: error: implicit declaration of function 'irq_domain_create_linear' [-Werror=implicit-function-declaration]
173 | bus->domain = irq_domain_create_linear(fwnode, SDW_MAX_DEVICES,
| ^~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/soundwire/bus.c:173:21: warning: assignment to 'struct irq_domain *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
173 | bus->domain = irq_domain_create_linear(fwnode, SDW_MAX_DEVICES,
| ^
drivers/soundwire/bus.c: In function 'sdw_bus_master_delete':
drivers/soundwire/bus.c:217:9: error: implicit declaration of function 'irq_domain_remove' [-Werror=implicit-function-declaration]
217 | irq_domain_remove(bus->domain);
| ^~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors


vim +173 drivers/soundwire/bus.c

45
46 /**
47 * sdw_bus_master_add() - add a bus Master instance
48 * @bus: bus instance
49 * @parent: parent device
50 * @fwnode: firmware node handle
51 *
52 * Initializes the bus instance, read properties and create child
53 * devices.
54 */
55 int sdw_bus_master_add(struct sdw_bus *bus, struct device *parent,
56 struct fwnode_handle *fwnode)
57 {
58 struct sdw_master_prop *prop = NULL;
59 int ret;
60
61 if (!parent) {
62 pr_err("SoundWire parent device is not set\n");
63 return -ENODEV;
64 }
65
66 ret = sdw_get_id(bus);
67 if (ret < 0) {
68 dev_err(parent, "Failed to get bus id\n");
69 return ret;
70 }
71
72 ret = sdw_master_device_add(bus, parent, fwnode);
73 if (ret < 0) {
74 dev_err(parent, "Failed to add master device at link %d\n",
75 bus->link_id);
76 return ret;
77 }
78
79 if (!bus->ops) {
80 dev_err(bus->dev, "SoundWire Bus ops are not set\n");
81 return -EINVAL;
82 }
83
84 if (!bus->compute_params) {
85 dev_err(bus->dev,
86 "Bandwidth allocation not configured, compute_params no set\n");
87 return -EINVAL;
88 }
89
90 /*
91 * Give each bus_lock and msg_lock a unique key so that lockdep won't
92 * trigger a deadlock warning when the locks of several buses are
93 * grabbed during configuration of a multi-bus stream.
94 */
95 lockdep_register_key(&bus->msg_lock_key);
96 __mutex_init(&bus->msg_lock, "msg_lock", &bus->msg_lock_key);
97
98 lockdep_register_key(&bus->bus_lock_key);
99 __mutex_init(&bus->bus_lock, "bus_lock", &bus->bus_lock_key);
100
101 INIT_LIST_HEAD(&bus->slaves);
102 INIT_LIST_HEAD(&bus->m_rt_list);
103
104 /*
105 * Initialize multi_link flag
106 */
107 bus->multi_link = false;
108 if (bus->ops->read_prop) {
109 ret = bus->ops->read_prop(bus);
110 if (ret < 0) {
111 dev_err(bus->dev,
112 "Bus read properties failed:%d\n", ret);
113 return ret;
114 }
115 }
116
117 sdw_bus_debugfs_init(bus);
118
119 /*
120 * Device numbers in SoundWire are 0 through 15. Enumeration device
121 * number (0), Broadcast device number (15), Group numbers (12 and
122 * 13) and Master device number (14) are not used for assignment so
123 * mask these and other higher bits.
124 */
125
126 /* Set higher order bits */
127 *bus->assigned = ~GENMASK(SDW_BROADCAST_DEV_NUM, SDW_ENUM_DEV_NUM);
128
129 /* Set enumuration device number and broadcast device number */
130 set_bit(SDW_ENUM_DEV_NUM, bus->assigned);
131 set_bit(SDW_BROADCAST_DEV_NUM, bus->assigned);
132
133 /* Set group device numbers and master device number */
134 set_bit(SDW_GROUP12_DEV_NUM, bus->assigned);
135 set_bit(SDW_GROUP13_DEV_NUM, bus->assigned);
136 set_bit(SDW_MASTER_DEV_NUM, bus->assigned);
137
138 /*
139 * SDW is an enumerable bus, but devices can be powered off. So,
140 * they won't be able to report as present.
141 *
142 * Create Slave devices based on Slaves described in
143 * the respective firmware (ACPI/DT)
144 */
145 if (IS_ENABLED(CONFIG_ACPI) && ACPI_HANDLE(bus->dev))
146 ret = sdw_acpi_find_slaves(bus);
147 else if (IS_ENABLED(CONFIG_OF) && bus->dev->of_node)
148 ret = sdw_of_find_slaves(bus);
149 else
150 ret = -ENOTSUPP; /* No ACPI/DT so error out */
151
152 if (ret < 0) {
153 dev_err(bus->dev, "Finding slaves failed:%d\n", ret);
154 return ret;
155 }
156
157 /*
158 * Initialize clock values based on Master properties. The max
159 * frequency is read from max_clk_freq property. Current assumption
160 * is that the bus will start at highest clock frequency when
161 * powered on.
162 *
163 * Default active bank will be 0 as out of reset the Slaves have
164 * to start with bank 0 (Table 40 of Spec)
165 */
166 prop = &bus->prop;
167 bus->params.max_dr_freq = prop->max_clk_freq * SDW_DOUBLE_RATE_FACTOR;
168 bus->params.curr_dr_freq = bus->params.max_dr_freq;
169 bus->params.curr_bank = SDW_BANK0;
170 bus->params.next_bank = SDW_BANK1;
171
172 bus->irq_chip.name = dev_name(bus->dev);
> 173 bus->domain = irq_domain_create_linear(fwnode, SDW_MAX_DEVICES,
174 &sdw_domain_ops, bus);
175 if (!bus->domain) {
176 dev_err(bus->dev, "Failed to add IRQ domain\n");
177 return -EINVAL;
178 }
179
180 return 0;
181 }
182 EXPORT_SYMBOL(sdw_bus_master_add);
183

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki