@@ -167,88 +167,35 @@ static irqreturn_t isr_bh_routine(int irq, void *userdata)
167167
168168static int init_irq (struct net_device * dev )
169169{
170- int ret = 0 ;
171170 struct wilc_vif * vif = netdev_priv (dev );
172171 struct wilc * wl = vif -> wilc ;
173172
174- #if KERNEL_VERSION (3 , 13 , 0 ) < LINUX_VERSION_CODE
175-
176- wl -> gpio_irq = gpiod_get (wl -> dt_dev , "irq" , GPIOD_IN );
177- if (IS_ERR (wl -> gpio_irq )) {
178- dev_warn (wl -> dev , "failed to get IRQ GPIO, load default\r\n" );
179- wl -> gpio_irq = gpio_to_desc (GPIO_NUM );
180- if (!wl -> gpio_irq ) {
181- dev_warn (wl -> dev , "failed to load default irq\r\n" );
182- return - EINVAL ;
183- }
184- } else {
185- dev_info (wl -> dev , "got gpio_irq successfully\r\n" );
186- }
187-
188- ret = gpiod_direction_input (wl -> gpio_irq );
189- if (ret ) {
190- PRINT_ER (dev , "could not obtain gpio for WILC_INTR\n" );
191- return - EINVAL ;
192- }
193-
194- wl -> dev_irq_num = gpiod_to_irq (wl -> gpio_irq );
195- if (wl -> dev_irq_num < 0 ) {
196- PRINT_ER (dev , "could not the IRQ\n" );
197- goto free_gpio ;
198- }
199- #else
200- wl -> gpio_irq = of_get_named_gpio_flags (wl -> dt_dev -> of_node ,
201- "irq-gpios" , 0 , NULL );
202- if (wl -> gpio_irq < 0 ) {
203- wl -> gpio_irq = GPIO_NUM ;
204- dev_warn (wl -> dev , "failed to get IRQ GPIO, load default\r\n" );
205- }
206-
207- if ((gpio_request (wl -> gpio_irq , "WILC_INTR" ) == 0 ) &&
208- (gpio_direction_input (wl -> gpio_irq ) == 0 )) {
209- wl -> dev_irq_num = gpio_to_irq (wl -> gpio_irq );
210- } else {
211- dev_err (wl -> dev , "could not obtain gpio for WILC_INTR\n" );
212- wl -> gpio_irq = 0 ;
213- return - EINVAL ;
214- }
215-
216- #endif
217-
218173 if (wl -> io_type == WILC_HIF_SPI ||
219174 wl -> io_type == WILC_HIF_SDIO_GPIO_IRQ ) {
220175 if (request_threaded_irq (wl -> dev_irq_num , isr_uh_routine ,
221176 isr_bh_routine , IRQF_TRIGGER_FALLING |
222177 IRQF_ONESHOT |
223178 IRQF_NO_SUSPEND ,
224179 "WILC_IRQ" , wl ) < 0 ) {
225- PRINT_ER (dev , "Failed to request IRQ\n" );
226- goto free_gpio ;
180+ PRINT_ER (dev , "Failed to request IRQ [%d]\n" ,
181+ wl -> dev_irq_num );
182+ return - EINVAL ;
227183 }
228184 } else {
229185 if (request_irq (wl -> dev_irq_num , host_wakeup_isr ,
230186 IRQF_TRIGGER_FALLING |
231187 IRQF_NO_SUSPEND ,
232188 "WILC_IRQ" , wl ) < 0 ) {
233- PRINT_ER (dev , "Failed to request IRQ\n" );
234- goto free_gpio ;
189+ PRINT_ER (dev , "Failed to request IRQ [%d]\n" ,
190+ wl -> dev_irq_num );
191+ return - EINVAL ;
235192 }
236193 }
237194
238195 PRINT_INFO (dev , GENERIC_DBG , "IRQ request succeeded IRQ-NUM= %d\n" ,
239196 wl -> dev_irq_num );
240197 enable_irq_wake (wl -> dev_irq_num );
241198 return 0 ;
242-
243- free_gpio :
244- #if KERNEL_VERSION (3 , 13 , 0 ) < LINUX_VERSION_CODE
245- gpiod_put (wl -> gpio_irq );
246- wl -> gpio_irq = NULL ;
247- #else
248- gpio_free (wl -> gpio_irq );
249- wl -> gpio_irq = 0 ;
250- #endif
251- return - EINVAL ;
252199}
253200
254201static void deinit_irq (struct net_device * dev )
@@ -257,24 +204,8 @@ static void deinit_irq(struct net_device *dev)
257204 struct wilc * wilc = vif -> wilc ;
258205
259206 /* Deinitialize IRQ */
260- if (wilc -> dev_irq_num > 0 ) {
207+ if (wilc -> dev_irq_num )
261208 free_irq (wilc -> dev_irq_num , wilc );
262- wilc -> dev_irq_num = -1 ;
263- }
264-
265- #if KERNEL_VERSION (3 , 13 , 0 ) < LINUX_VERSION_CODE
266- if (wilc -> gpio_irq ) {
267- gpiod_put (wilc -> gpio_irq );
268- wilc -> gpio_irq = NULL ;
269- }
270- #else
271- if (wilc -> gpio_irq > 0 ) {
272- gpio_free (wilc -> gpio_irq );
273- wilc -> gpio_irq = 0 ;
274- }
275-
276- #endif
277-
278209}
279210
280211void wilc_mac_indicate (struct wilc * wilc )
0 commit comments