From patchwork Thu Mar 3 12:05:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaehyun Lim X-Patchwork-Id: 8492251 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 50048C0553 for ; Thu, 3 Mar 2016 12:06:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C0B64202E5 for ; Thu, 3 Mar 2016 12:06:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BFB382017D for ; Thu, 3 Mar 2016 12:06:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756219AbcCCMG2 (ORCPT ); Thu, 3 Mar 2016 07:06:28 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:33117 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756170AbcCCMG0 (ORCPT ); Thu, 3 Mar 2016 07:06:26 -0500 Received: by mail-pf0-f194.google.com with SMTP id 63so1210463pfe.0 for ; Thu, 03 Mar 2016 04:06:26 -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:in-reply-to:references; bh=GXpwV58nAjs3dWT1zGiHMfnFtsH4wpTXj/TgVjyz/8Y=; b=aFvn/QY7T6v7dNvwY9CIFKxkUeJClP//6CvbwbstiUqNbywfhur4mBXC26t2KGRLb/ NCOseMEsml8eBFxkLuCISwzAGWal2omS+JTNkAyxE+xrtLllfVCHPOm+M8jOgSA6IbOq TJw2bMDyS+2ivmzDAX929hihD8Of8IMS1QAQjlyfCK9+DaTqfkLe9lz9Bl8w9BkvYBkW 8hGxxCnQh5YooFJaDsp4vbLMpmBQNGvcsPEB/d9xrf9yFxlDYzRkHr3NGXmCZCAOxpRs pAbdeXmQ8khaTTg4y53axGR4gH3/zeg6vE5D2c7VO8q8J1aWbtKEEg4S3BPOYamxktIz XpUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GXpwV58nAjs3dWT1zGiHMfnFtsH4wpTXj/TgVjyz/8Y=; b=BWPVAdlj9luu2R1+3VmBUBumQRlt0Eju4TrpR9rpNhCGDwh45jdBC61LMU+myJ+SeD rb83Xc+qSZ8MqS7Kd8Ov7LDXNpeL2iu0NucbJWFjCuf3h4Y/kq+gnaxiHZTvhRj87u21 Zm4jXlnbB/riwTovuUWcPMc6This4g2DHH2Vkou7VMIpTLMheU3NZri6aJ24a256LJ2g QNLkJMQDZXw560Q4UjA5UPQSbqR1IVoHH6WYRMLnU8IQHblPpYG9PFxYNpQtMfFDFGW0 6TSbd3WoLXoFZQfwa7bqqDwXCesT5nPC8HmDDxgoHsZqMXb06Pa7NIICFB80xZWHFl/8 vpAQ== X-Gm-Message-State: AD7BkJIEkV2yq4Gq99208AF4CiCtrd79Qe+HK9JBPcWNPqKilpV/XJ8O2FrfnGWEo6d1DA== X-Received: by 10.98.74.17 with SMTP id x17mr3142799pfa.14.1457006785432; Thu, 03 Mar 2016 04:06:25 -0800 (PST) Received: from localhost.localdomain ([218.233.16.2]) by smtp.gmail.com with ESMTPSA id v9sm15845386pfi.50.2016.03.03.04.06.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 03 Mar 2016 04:06:24 -0800 (PST) From: Chaehyun Lim To: gregkh@linuxfoundation.org Cc: johnny.kim@atmel.com, austin.shin@atmel.com, chris.park@atmel.com, tony.cho@atmel.com, glen.lee@atmel.com, leo.kim@atmel.com, linux-wireless@vger.kernel.org, devel@driverdev.osuosl.org, Chaehyun Lim Subject: [PATCH 4/6] staging: wilc1000: add enum cfg_type_cmd Date: Thu, 3 Mar 2016 21:05:20 +0900 Message-Id: <1457006722-14400-4-git-send-email-chaehyun.lim@gmail.com> X-Mailer: git-send-email 2.7.1 In-Reply-To: <1457006722-14400-1-git-send-email-chaehyun.lim@gmail.com> References: <1457006722-14400-1-git-send-email-chaehyun.lim@gmail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 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 This patch adds a new enum cfg_type_cmd to change hard-coded command type. Signed-off-by: Chaehyun Lim --- drivers/staging/wilc1000/wilc_wlan_cfg.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c b/drivers/staging/wilc1000/wilc_wlan_cfg.c index 6a33187..9cf68b7 100644 --- a/drivers/staging/wilc1000/wilc_wlan_cfg.c +++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c @@ -18,6 +18,13 @@ * Global Data * ********************************************/ +enum cfg_cmd_type { + CFG_BYTE_CMD = 0, + CFG_HWORD_CMD = 1, + CFG_WORD_CMD = 2, + CFG_STR_CMD = 3, + CFG_BIN_CMD = 4 +}; struct wilc_mac_cfg { int mac_status; @@ -371,18 +378,18 @@ int wilc_wlan_cfg_set_wid(u8 *frame, u32 offset, u16 id, u8 *buf, int size) u8 type = (id >> 12) & 0xf; int ret = 0; - if (type == 0) { /* byte command */ + if (type == CFG_BYTE_CMD) { /* byte command */ if (size >= 1) ret = wilc_wlan_cfg_set_byte(frame, offset, id, *buf); - } else if (type == 1) { /* half word command */ + } else if (type == CFG_HWORD_CMD) { /* half word command */ if (size >= 2) ret = wilc_wlan_cfg_set_hword(frame, offset, id, *((u16 *)buf)); - } else if (type == 2) { /* word command */ + } else if (type == CFG_WORD_CMD) { /* word command */ if (size >= 4) ret = wilc_wlan_cfg_set_word(frame, offset, id, *((u32 *)buf)); - } else if (type == 3) { /* string command */ + } else if (type == CFG_STR_CMD) { /* string command */ ret = wilc_wlan_cfg_set_str(frame, offset, id, buf, size); - } else if (type == 4) { /* binary command */ + } else if (type == CFG_BIN_CMD) { /* binary command */ ret = wilc_wlan_cfg_set_bin(frame, offset, id, buf, size); } @@ -415,7 +422,7 @@ int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 buffer_size) } i = 0; - if (type == 0) { /* byte command */ + if (type == CFG_BYTE_CMD) { /* byte command */ do { if (g_cfg_byte[i].id == WID_NIL) break; @@ -427,7 +434,7 @@ int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 buffer_size) } i++; } while (1); - } else if (type == 1) { /* half word command */ + } else if (type == CFG_HWORD_CMD) { /* half word command */ do { if (g_cfg_hword[i].id == WID_NIL) break; @@ -439,7 +446,7 @@ int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 buffer_size) } i++; } while (1); - } else if (type == 2) { /* word command */ + } else if (type == CFG_WORD_CMD) { /* word command */ do { if (g_cfg_word[i].id == WID_NIL) break; @@ -451,7 +458,7 @@ int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 buffer_size) } i++; } while (1); - } else if (type == 3) { /* string command */ + } else if (type == CFG_STR_CMD) { /* string command */ do { if (g_cfg_str[i].id == WID_NIL) break;