Skip to content

Commit 60481e6

Browse files
claudiubezneacristibirsan
authored andcommitted
staging: wilc1000: move power info to a data structure
Move power info to a data structure. This prepares the field for the following commits. Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
1 parent bd12fc9 commit 60481e6

2 files changed

Lines changed: 20 additions & 16 deletions

File tree

drivers/staging/wilc1000/bt.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -309,16 +309,16 @@ int wilc_bt_power_down(struct wilc *wilc, int source)
309309

310310
pr_info("source: %s, current bus status Wifi: %d, BT: %d\n",
311311
(source == DEV_WIFI ? "Wifi" : "BT"),
312-
wilc->power_status[DEV_WIFI],
313-
wilc->power_status[DEV_BT]);
312+
wilc->power.status[DEV_WIFI],
313+
wilc->power.status[DEV_BT]);
314314

315-
if (wilc->power_status[source] == false) {
315+
if (wilc->power.status[source] == false) {
316316
pr_err("power down request for already powered down source %s\n",
317317
(source == DEV_WIFI ? "Wifi" : "BT"));
318318
} else if (((source == DEV_WIFI) &&
319-
(wilc->power_status[DEV_BT] == true)) ||
319+
(wilc->power.status[DEV_BT] == true)) ||
320320
((source == DEV_BT) &&
321-
(wilc->power_status[DEV_WIFI] == true))) {
321+
(wilc->power.status[DEV_WIFI] == true))) {
322322
pr_warn("Another device is preventing power down. request source is %s\n",
323323
(source == DEV_WIFI ? "Wifi" : "BT"));
324324
} else {
@@ -328,7 +328,7 @@ int wilc_bt_power_down(struct wilc *wilc, int source)
328328
return ret;
329329
}
330330
}
331-
wilc->power_status[source] = false;
331+
wilc->power.status[source] = false;
332332

333333
mutex_unlock(&wilc->cs);
334334

@@ -346,24 +346,24 @@ int wilc_bt_power_up(struct wilc *wilc, int source)
346346

347347
pr_debug("source: %s, current bus status Wifi: %d, BT: %d\n",
348348
(source == DEV_WIFI ? "Wifi" : "BT"),
349-
wilc->power_status[DEV_WIFI],
350-
wilc->power_status[DEV_BT]);
349+
wilc->power.status[DEV_WIFI],
350+
wilc->power.status[DEV_BT]);
351351

352-
if (wilc->power_status[source] == true) {
352+
if (wilc->power.status[source] == true) {
353353
pr_err("power up request for already powered up source %s\n",
354354
(source == DEV_WIFI ? "Wifi" : "BT"));
355355
} else {
356356
/*Bug 215*/
357357
/*Avoid overlapping between BT and Wifi intialization*/
358-
if (wilc->power_status[DEV_WIFI] == true) {
358+
if (wilc->power.status[DEV_WIFI] == true) {
359359
while (!wilc->initialized) {
360360
msleep(100);
361361
if (++count > 20) {
362362
pr_warn("Wifi initialize timeout\n");
363363
break;
364364
}
365365
}
366-
} else if (wilc->power_status[DEV_BT] == true) {
366+
} else if (wilc->power.status[DEV_BT] == true) {
367367
while (!bt_init_done) {
368368
msleep(200);
369369
if (++count > 30) {
@@ -380,20 +380,20 @@ int wilc_bt_power_up(struct wilc *wilc, int source)
380380
}
381381
}
382382

383-
if ((wilc->power_status[DEV_WIFI] == true) ||
384-
(wilc->power_status[DEV_BT] == true)) {
383+
if ((wilc->power.status[DEV_WIFI] == true) ||
384+
(wilc->power.status[DEV_BT] == true)) {
385385
pr_info("Device already up. request source is %s\n",
386386
(source == DEV_WIFI ? "Wifi" : "BT"));
387387
} else {
388388
pr_info("WILC POWER UP\n");
389389
}
390-
wilc->power_status[source] = true;
390+
wilc->power.status[source] = true;
391391
mutex_unlock(&wilc->cs);
392392

393393
if (source == DEV_BT) {
394394
/*TicketId1092*/
395395
/*If WiFi is off, force BT*/
396-
if (wilc->power_status[DEV_WIFI] == false) {
396+
if (wilc->power.status[DEV_WIFI] == false) {
397397
acquire_bus(wilc, WILC_BUS_ACQUIRE_AND_WAKEUP, DEV_BT);
398398

399399
/*TicketId1115*/

drivers/staging/wilc1000/netdev.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,10 @@ struct wilc_vif {
372372
struct cfg80211_bss *bss;
373373
};
374374

375+
struct wilc_power {
376+
u8 status[DEV_MAX];
377+
};
378+
375379
struct wilc {
376380
struct wiphy *wiphy;
377381
const struct wilc_hif_func *hif_func;
@@ -433,7 +437,7 @@ struct wilc {
433437

434438
enum wilc_chip_type chip;
435439

436-
uint8_t power_status[DEV_MAX];
440+
struct wilc_power power;
437441
uint8_t keep_awake[DEV_MAX];
438442
struct mutex cs;
439443
struct workqueue_struct *hif_workqueue;

0 commit comments

Comments
 (0)