From patchwork Mon May 26 12:31:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Chaitanya X-Patchwork-Id: 4242021 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D38559F1E7 for ; Mon, 26 May 2014 12:32:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 99F7820127 for ; Mon, 26 May 2014 12:32:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2E06720121 for ; Mon, 26 May 2014 12:32:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751700AbaEZMcR (ORCPT ); Mon, 26 May 2014 08:32:17 -0400 Received: from mail-we0-f172.google.com ([74.125.82.172]:40787 "EHLO mail-we0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751616AbaEZMcQ (ORCPT ); Mon, 26 May 2014 08:32:16 -0400 Received: by mail-we0-f172.google.com with SMTP id k48so8112393wev.31 for ; Mon, 26 May 2014 05:32:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=xpDPd2Tic776i76vtoGL56fmpU6NCioVQdTnXu4n5Iw=; b=wT+FQQ2WhmU4xDBlMTQqb+nADT/+G2kTVwEDpVaB4wlia10IsEoAPLCOOypKxktxWs c/yuRaDx4UOW+J8U2vq1vuHd9Y0WbrRPaHZL8feMPlHcnapE/9DA8gMzChxExdiuHh6v L7GSZYa201ALft7Qu5DPOPmHxryPjS/WA2nQSVkj3L87AFWOBGQCgY1/9yhuMefnegvq 8jldOrZjdq08yx5ns4vnbJ8/ZdhifHRg7zPa3G2/FI5LgDwOaTXh6uxb3W4spqILwfxQ hwqm3uDgND4bPgHBQB/rSC1owI1gkSNgKL4F3s+sk7X6RneAGfGRYUWV9ct8FH+NINTV U4mg== X-Received: by 10.194.133.100 with SMTP id pb4mr30263856wjb.39.1401107534514; Mon, 26 May 2014 05:32:14 -0700 (PDT) Received: from chaitanya-desktop.hb.imgtec.org ([115.112.122.66]) by mx.google.com with ESMTPSA id vp5sm26570965wjc.31.2014.05.26.05.32.11 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 26 May 2014 05:32:13 -0700 (PDT) From: chaitanya.mgit@gmail.com To: linville@tuxdriver.com, mcgrof@gmail.com Cc: linux-wireless@vger.kernel.org, Chaitanya T K Subject: [PATCH V2] regdb: Generalize the mW to dBm power conversion Date: Mon, 26 May 2014 18:01:44 +0530 Message-Id: <1401107504-11385-1-git-send-email-chaitanya.mgit@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Generalize the power conversion from mW to dBm using log. This should fix the below compilation error for country NO which adds a new power value 2000mW which is not handled earlier. CC [M] net/wireless/wext-sme.o CC [M] net/wireless/regdb.o net/wireless/regdb.c:1130:1: error: Unknown undeclared here (not in a function) net/wireless/regdb.c:1130:9: error: expected } before power make[2]: *** [net/wireless/regdb.o] Error 1 make[1]: *** [net/wireless] Error 2 make: *** [net] Error 2 Reported-By: John Walker Signed-off-by: Chaitanya T K Acked-by: John W. Linville --- net/wireless/genregdb.awk | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/wireless/genregdb.awk b/net/wireless/genregdb.awk index 4119833..949ee38 100644 --- a/net/wireless/genregdb.awk +++ b/net/wireless/genregdb.awk @@ -68,17 +68,7 @@ function parse_reg_rule() sub(/,/, "", units) dfs_cac = $9 if (units == "mW") { - if (power == 100) { - power = 20 - } else if (power == 200) { - power = 23 - } else if (power == 500) { - power = 27 - } else if (power == 1000) { - power = 30 - } else { - print "Unknown power value in database!" - } + power = 10 * (log(power)/log(10)) } else { dfs_cac = $8 }