From: Philipp Hortmann <philipp.g.hortmann@gmail.com>
To: Forest Bond <forest@alittletooquiet.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: [PATCH 2/6] staging: vt6655: Create one function for four macros
Date: Sat, 30 Jul 2022 21:20:30 +0200 [thread overview]
Message-ID: <d4768227a7ea10ccec6d08eb0c55f8790ef70379.1659192760.git.philipp.g.hortmann@gmail.com> (raw)
In-Reply-To: <cover.1659192760.git.philipp.g.hortmann@gmail.com>
Create function vt6655_mac_en_dis_bits_u32_reg with three parameters to
cover functionality of four macros.
Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
drivers/staging/vt6655/device_main.c | 12 ++++++++++--
drivers/staging/vt6655/mac.h | 3 +++
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index 3565aa53f007..5f64204dc312 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -216,15 +216,23 @@ static void vt6655_mac_dma_ctl(void __iomem *iobase, u8 reg_index)
iowrite32(DMACTL_RUN, iobase + reg_index);
}
-static void MACvEnableProtectMD(void __iomem *iobase)
+static void vt6655_mac_en_dis_bits_u32_reg(void __iomem *iobase, bool en_not_dis, u32 bit_mask)
{
u32 reg_value;
reg_value = ioread32(iobase + MAC_REG_ENCFG);
- reg_value = reg_value | ENCFG_PROTECTMD;
+ if (en_not_dis)
+ reg_value = reg_value | bit_mask;
+ else
+ reg_value = reg_value & ~bit_mask;
iowrite32(reg_value, iobase + MAC_REG_ENCFG);
}
+static void MACvEnableProtectMD(void __iomem *iobase)
+{
+ vt6655_mac_en_dis_bits_u32_reg(iobase, ENABLE, ENCFG_PROTECTMD);
+}
+
/*
* Initialisation of MAC & BBP registers
*/
diff --git a/drivers/staging/vt6655/mac.h b/drivers/staging/vt6655/mac.h
index 84d203c56b1f..31e75df5f02f 100644
--- a/drivers/staging/vt6655/mac.h
+++ b/drivers/staging/vt6655/mac.h
@@ -21,6 +21,9 @@
#include "device.h"
/*--------------------- Export Definitions -------------------------*/
+#define ENABLE 1
+#define DISABLE 0
+
/* Registers in the MAC */
#define MAC_MAX_CONTEXT_SIZE_PAGE0 256
#define MAC_MAX_CONTEXT_SIZE_PAGE1 128
--
2.37.1
next prev parent reply other threads:[~2022-07-30 19:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-30 19:20 [PATCH 0/6] staging: vt6655: Create one base " Philipp Hortmann
2022-07-30 19:20 ` [PATCH 1/6] staging: vt6655: Convert macro MACvEnableProtectMD to function Philipp Hortmann
2022-07-30 19:20 ` Philipp Hortmann [this message]
2022-08-01 11:21 ` [PATCH 2/6] staging: vt6655: Create one function for four macros Dan Carpenter
2022-07-30 19:20 ` [PATCH 3/6] staging: vt6655: Rename function MACvEnableProtectMD Philipp Hortmann
2022-07-30 19:20 ` [PATCH 4/6] staging: vt6655: Convert macro MACvDisableProtectMD Philipp Hortmann
2022-07-30 19:20 ` [PATCH 5/6] staging: vt6655: Convert macro MACvEnableBarkerPreambleMd Philipp Hortmann
2022-07-30 19:21 ` [PATCH 6/6] staging: vt6655: Convert macro MACvDisableBarkerPreambleMd Philipp Hortmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d4768227a7ea10ccec6d08eb0c55f8790ef70379.1659192760.git.philipp.g.hortmann@gmail.com \
--to=philipp.g.hortmann@gmail.com \
--cc=forest@alittletooquiet.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®