From patchwork Tue Nov 20 23:54:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanislav Yakovlev X-Patchwork-Id: 1776161 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 49211DFF38 for ; Tue, 20 Nov 2012 21:54:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752249Ab2KTVy0 (ORCPT ); Tue, 20 Nov 2012 16:54:26 -0500 Received: from mail-pa0-f46.google.com ([209.85.220.46]:57517 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751462Ab2KTVyZ (ORCPT ); Tue, 20 Nov 2012 16:54:25 -0500 Received: by mail-pa0-f46.google.com with SMTP id bh2so1562991pad.19 for ; Tue, 20 Nov 2012 13:54:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=obarEpq8g799f5ZAVlGntijxqc236k8pbvPLqFVoL1k=; b=uBj7aodTA6YU+38xMGIKxk6rNNmgFsCmBIcXfbHIKrNESLOvruHkPrS/1tF9e6EdWk u+Q+0gB1IVa/fOoLwSO6sUKxFUD6r+5BhrFlQSMz/hO5o6ZYKd2X+Ybqr6fpZcFGXpgE sc5FnHIuQX8xse8CRHu5D8hhXOF95PcxgvsEImfENmBOQfrMJyw4g5YuuQ0MaaEJuYoY E7k2PQvVv9oFWaDTuFe1Sp89JDxCLpI9kwX8Elw7Cdj7RhBgFHP01Nm2oso69YljtwER +ncdL4lPbwpj6rjS8jyCcJyug6aiAISdhcM7WTChROruhmmXeTZkO1zjbmK87fbUwJmq dZqQ== Received: by 10.68.232.71 with SMTP id tm7mr53066455pbc.118.1353448465594; Tue, 20 Nov 2012 13:54:25 -0800 (PST) Received: from localhost.localdomain (50-0-191-227.dsl.static.sonic.net. [50.0.191.227]) by mx.google.com with ESMTPS id ni3sm8674259pbc.2.2012.11.20.13.54.22 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 20 Nov 2012 13:54:24 -0800 (PST) From: Stanislav Yakovlev To: linville@tuxdriver.com Cc: linux-wireless@vger.kernel.org, Stanislav Yakovlev Subject: [PATCH] net/wireless: ipw2200: introduce ipw_set_geo function Date: Tue, 20 Nov 2012 23:54:20 +0000 Message-Id: <1353455660-534-1-git-send-email-stas.yakovlev@gmail.com> X-Mailer: git-send-email 1.7.11.7 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Move regulatory domain initialization code to a separate function. Signed-off-by: Stanislav Yakovlev --- drivers/net/wireless/ipw2x00/ipw2200.c | 37 +++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c index fea96b5..482f505 100644 --- a/drivers/net/wireless/ipw2x00/ipw2200.c +++ b/drivers/net/wireless/ipw2x00/ipw2200.c @@ -11269,10 +11269,31 @@ static const struct libipw_geo ipw_geos[] = { } }; +static void ipw_set_geo(struct ipw_priv *priv) +{ + int j; + + for (j = 0; j < ARRAY_SIZE(ipw_geos); j++) { + if (!memcmp(&priv->eeprom[EEPROM_COUNTRY_CODE], + ipw_geos[j].name, 3)) + break; + } + + if (j == ARRAY_SIZE(ipw_geos)) { + IPW_WARNING("SKU [%c%c%c] not recognized.\n", + priv->eeprom[EEPROM_COUNTRY_CODE + 0], + priv->eeprom[EEPROM_COUNTRY_CODE + 1], + priv->eeprom[EEPROM_COUNTRY_CODE + 2]); + j = 0; + } + + libipw_set_geo(priv->ieee, &ipw_geos[j]); +} + #define MAX_HW_RESTARTS 5 static int ipw_up(struct ipw_priv *priv) { - int rc, i, j; + int rc, i; /* Age scan list entries found before suspend */ if (priv->suspend_time) { @@ -11310,19 +11331,7 @@ static int ipw_up(struct ipw_priv *priv) memcpy(priv->net_dev->dev_addr, priv->mac_addr, ETH_ALEN); memcpy(priv->net_dev->perm_addr, priv->mac_addr, ETH_ALEN); - for (j = 0; j < ARRAY_SIZE(ipw_geos); j++) { - if (!memcmp(&priv->eeprom[EEPROM_COUNTRY_CODE], - ipw_geos[j].name, 3)) - break; - } - if (j == ARRAY_SIZE(ipw_geos)) { - IPW_WARNING("SKU [%c%c%c] not recognized.\n", - priv->eeprom[EEPROM_COUNTRY_CODE + 0], - priv->eeprom[EEPROM_COUNTRY_CODE + 1], - priv->eeprom[EEPROM_COUNTRY_CODE + 2]); - j = 0; - } - libipw_set_geo(priv->ieee, &ipw_geos[j]); + ipw_set_geo(priv); if (priv->status & STATUS_RF_KILL_SW) { IPW_WARNING("Radio disabled by module parameter.\n");