forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-14 bedbef8ad3e75a304af6361af235302bcc61d06b
kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wldev_common.c
old mode 100644new mode 100755
....@@ -508,16 +508,30 @@
508508 int wldev_set_country(
509509 struct net_device *dev, char *country_code, bool notify, int revinfo)
510510 {
511
- int error = 0;
512511 #if defined(BCMDONGLEHOST)
513
- struct dhd_pub *dhd = dhd_get_pub(dev);
512
+ int error = -1;
513
+ wl_country_t cspec = {{0}, 0, {0}};
514514
515515 if (!country_code)
516
- return -1;
517
- error = dhd_conf_country(dhd, "country", country_code);
518
- dhd_bus_country_set(dev, &dhd->dhd_cspec, notify);
516
+ return error;
517
+
518
+ cspec.rev = revinfo;
519
+ strlcpy(cspec.country_abbrev, country_code, WL_CCODE_LEN + 1);
520
+ strlcpy(cspec.ccode, country_code, WL_CCODE_LEN + 1);
521
+ error = dhd_conf_map_country_list(dhd_get_pub(dev), &cspec);
522
+ if (error)
523
+ dhd_get_customized_country_code(dev, (char *)&cspec.country_abbrev, &cspec);
524
+ error = dhd_conf_set_country(dhd_get_pub(dev), &cspec);
525
+ if (error < 0) {
526
+ WLDEV_ERROR(("%s: set country for %s as %s rev %d failed\n",
527
+ __FUNCTION__, country_code, cspec.ccode, cspec.rev));
528
+ return error;
529
+ }
530
+ dhd_conf_fix_country(dhd_get_pub(dev));
531
+ dhd_conf_get_country(dhd_get_pub(dev), &cspec);
532
+ dhd_bus_country_set(dev, &cspec, notify);
519533 printf("%s: set country for %s as %s rev %d\n",
520
- __FUNCTION__, country_code, dhd->dhd_cspec.ccode, dhd->dhd_cspec.rev);
534
+ __FUNCTION__, country_code, cspec.ccode, cspec.rev);
521535 #endif /* defined(BCMDONGLEHOST) */
522
- return error;
536
+ return 0;
523537 }