Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp905989pxa; Sat, 1 Aug 2020 09:49:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5xzHr1lH+mS5towswt+BnUQelzHGz8aSK/9SI6p8YMiKirN+ttw31PMjDR9pQEmxGHTRX X-Received: by 2002:a17:906:b6d0:: with SMTP id ec16mr9234858ejb.94.1596300544847; Sat, 01 Aug 2020 09:49:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596300544; cv=none; d=google.com; s=arc-20160816; b=AWDj6nQIxft/OQBd/RfpTFZPW+HppK6XYz1/8XKfKAdnldG31eIazgR+bDMhy3aeUq tVPQGX5Gf7+EhuCo+gc8WQs/hUb+aSCtNjIaF+yMICHNOpKFV6vCtidesQ8iWit1lnO3 49TQLcJILoaUo1A35nUnUFFA331oTw4Acb5qo+v1a22dxfJ7OGmKw6ZcdBVn8kaepStA sSpPNGe3wKSCPyd7T7U1MTJR8MokM7rOvTM6eL83ZIdidHEZd9kQNARJzrtF8xcKNQDB Kxk/rcFAAOOtEjKACLr7wQEGeg9cs/VYUssxJ5pva3tPUfM3BB5deDdAcVrypyKaO0ob 8SYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=3DYnTPT4/sYGcNhT4ZL721tJCBoXUCz3sR7pfzy1uU0=; b=cKtXzwRffpmCuaTGKMU1+uDGc+3ze+CSTCGscbF1/N+1KcCCyzT7WXD8GAC/RyMmgL 1sh2ZJ7lc8Ky/ysnYw8ywu1bKi1VdXXhZpPRjw//Ne8bqgv+5wKF4bSStnh2wm5FI3EC xbC9cpOV3GYqt4qxCtavE9Zn6gE3WEDJwXTYaSBnv4WpSG6r9RLVduYM7sewv/5JGPUv UKQANooRiM4SA5PKziNdwQ5LMrc8ZfEEz0tP+5udMc1yGSFyez7Lcb7Eiko834Wg0opg yE8JP8l/B1DiOa4wXbUc4cZ8kjQJ6xaiym+9bJh+soZ8SxKaiaIcR+z1a5Wugf3lKPQ0 g9qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="c/tnSkc0"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h1si7400185ejc.200.2020.08.01.09.48.40; Sat, 01 Aug 2020 09:49:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="c/tnSkc0"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726946AbgHAQra (ORCPT + 99 others); Sat, 1 Aug 2020 12:47:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726494AbgHAQr3 (ORCPT ); Sat, 1 Aug 2020 12:47:29 -0400 Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACCE0C06174A for ; Sat, 1 Aug 2020 09:47:27 -0700 (PDT) Received: by mail-lj1-x244.google.com with SMTP id w25so13691ljo.12 for ; Sat, 01 Aug 2020 09:47:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=3DYnTPT4/sYGcNhT4ZL721tJCBoXUCz3sR7pfzy1uU0=; b=c/tnSkc0+P8PGPhCHlwixhH5M9Che6g4W8HnOizbI6Bpixtff5DuH18eT/ljOHzTZ/ t+eDhWKmmPKLNMad9VH+bRBcXXeA8swopsk3kr3VSmj3SuOAAQSGWuCdLNIuVTqVGMIl oPyohLjcoZsQBIAYmyRHnDwPn7bXnAAy7duzbgP0hHiXTYLyj9QFz9VPv+u1cbl13ob+ 18CEdaJvjCpt2JU8yAmexPZA4+Oc9B9foDs0lo/X2XwhlftUZj+kHWQ3zLp1cnlbpU1n NJsrS5Uk2Y9BkyK/mQMkW9zjZaTFm2yw++QbEKwAKQ6NKJZ+1HqH9F6/VI07Y4w4p9oT wjAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=3DYnTPT4/sYGcNhT4ZL721tJCBoXUCz3sR7pfzy1uU0=; b=XMF3dNLpNL/538FMSnTBMgaYSi69ZNNJVsJQbmm83XStEk7dIycQNxddgvmS7K8nea aILwwuwX+uouJuj4R5nKWwZI7JN2joM6J4U6EPcDxyMjWYR6fU95sBeli4c3/ZfE6NpF aQQ9eQW13VJEHDwccVLD/Vd1thq0tTjOkNZ+yn5qfwTcGicqha17YB5d2Gl1aBleRvM0 o8m/Uv1Ko3GnasLvDoZh6O3xM/V1BZrBB6QLBnVDsl5lQKxr398DyuwDhu13MGozfyJC goNPIJPxTfrr3r4C1Rhw5Tsa8SrhJzPYcLRUWiDGft3PgSmPf1V7poNGpjVRu86Ib6Kb PgQg== X-Gm-Message-State: AOAM531Z/XZgAsmOMimBtimymRukjc931e+pNEeX/phcq1t1oI3ykyYC JpP99R0UzjfU8XzNaZWSMj9evLM9 X-Received: by 2002:a2e:9f10:: with SMTP id u16mr4362676ljk.130.1596300446230; Sat, 01 Aug 2020 09:47:26 -0700 (PDT) Received: from alpha (10.177.smarthome.spb.ru. [109.71.177.10]) by smtp.gmail.com with ESMTPSA id e12sm2452360ljk.74.2020.08.01.09.47.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Aug 2020 09:47:25 -0700 (PDT) Received: (nullmailer pid 29254 invoked by uid 1000); Sat, 01 Aug 2020 16:52:33 -0000 From: Ivan Safonov To: Larry Finger Cc: Greg Kroah-Hartman , B K Karthik , Michael Straube , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Ivan Safonov Subject: [PATCH v2] staging: r8188eu: replace rtw_netdev_priv define with inline function Date: Sat, 1 Aug 2020 19:52:20 +0300 Message-Id: <20200801165220.29208-1-insafonov@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The function guarantees type checking of arguments and return value. Result of rtw_netdev_priv macro can be assigned to pointer with incompatible type without warning. The function allow compiler to perform this check. Signed-off-by: Ivan Safonov --- Changes in v2: - add blank line after function definition; - improve commit message. --- drivers/staging/rtl8188eu/include/osdep_service.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8188eu/include/osdep_service.h b/drivers/staging/rtl8188eu/include/osdep_service.h index 31d897f1d21f..6ca79b5fb638 100644 --- a/drivers/staging/rtl8188eu/include/osdep_service.h +++ b/drivers/staging/rtl8188eu/include/osdep_service.h @@ -71,8 +71,11 @@ struct rtw_netdev_priv_indicator { }; struct net_device *rtw_alloc_etherdev_with_old_priv(void *old_priv); -#define rtw_netdev_priv(netdev) \ - (((struct rtw_netdev_priv_indicator *)netdev_priv(netdev))->priv) +static inline struct adapter *rtw_netdev_priv(struct net_device *dev) +{ + return (((struct rtw_netdev_priv_indicator *)netdev_priv(dev))->priv); +} + void rtw_free_netdev(struct net_device *netdev); #define FUNC_NDEV_FMT "%s(%s)" -- 2.26.2