From: Xu Yilun <yilun.xu@intel.com>
To: mdf@kernel.org, linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: trix@redhat.com, lgoncalv@redhat.com, yilun.xu@intel.com,
hao.wu@intel.com
Subject: [PATCH v3 2/5] fpga: dfl: fix the definitions of type & feature_id for dfl devices
Date: Fri, 25 Sep 2020 00:59:58 +0800 [thread overview]
Message-ID: <1600966801-30586-3-git-send-email-yilun.xu@intel.com> (raw)
In-Reply-To: <1600966801-30586-1-git-send-email-yilun.xu@intel.com>
The value of the field fpga_dfl_device.type comes from the 12 bits
register field DFH_ID according to DFL spec. So this patch changes the
definition of the type field to u16.
Also it is not necessary to illustrate the valid bits of the type field
in comments. Instead we should explicitly define the possible values in
the enumeration type for it, because they are shared by hardware spec.
We should not let the compiler decide these values.
Similar changes are also applied to fpga_dfl_device.feature_id.
This patch also fixed the MODALIAS format according to the changes
above.
Signed-off-by: Xu Yilun <yilun.xu@intel.com>
---
drivers/fpga/dfl.c | 3 +--
drivers/fpga/dfl.h | 16 +++++++---------
2 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c
index f146cda..a906fa7 100644
--- a/drivers/fpga/dfl.c
+++ b/drivers/fpga/dfl.c
@@ -299,8 +299,7 @@ static int fpga_dfl_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
{
struct fpga_dfl_device *fddev = to_fpga_dfl_dev(dev);
- /* The type has 4 valid bits and feature_id has 12 valid bits */
- return add_uevent_var(env, "MODALIAS=fpga-dfl:t%01Xf%03X",
+ return add_uevent_var(env, "MODALIAS=fpga-dfl:t%04Xf%04X",
fddev->type, fddev->feature_id);
}
diff --git a/drivers/fpga/dfl.h b/drivers/fpga/dfl.h
index ba930a7..78f7c6f 100644
--- a/drivers/fpga/dfl.h
+++ b/drivers/fpga/dfl.h
@@ -520,21 +520,19 @@ long dfl_feature_ioctl_set_irq(struct platform_device *pdev,
* enum fpga_dfl_id_type - define the FPGA DFL FIU types
*/
enum fpga_dfl_id_type {
- FPGA_DFL_FME_ID,
- FPGA_DFL_PORT_ID,
+ FPGA_DFL_FME_ID = 0,
+ FPGA_DFL_PORT_ID = 1,
FPGA_DFL_ID_MAX,
};
/**
* struct fpga_dfl_device_id - fpga dfl device identifier
- * @type: contains 4 bits FPGA DFL FIU type of the device, see
- * enum fpga_dfl_id_type.
- * @feature_id: contains 12 bits feature identifier local to its FPGA DFL FIU
- * type.
+ * @type: FPGA DFL FIU type of the device, see enum fpga_dfl_id_type.
+ * @feature_id: feature identifier local to its FPGA DFL FIU type.
* @driver_data: driver specific data.
*/
struct fpga_dfl_device_id {
- u8 type;
+ u16 type;
u16 feature_id;
unsigned long driver_data;
};
@@ -545,7 +543,7 @@ struct fpga_dfl_device_id {
* @dev: generic device interface.
* @id: id of the fpga dfl device.
* @type: FPGA DFL FIU type of the device, see enum fpga_dfl_id_type.
- * @feature_id: 16 bits feature identifier local to its FPGA DFL FIU type.
+ * @feature_id: feature identifier local to its FPGA DFL FIU type.
* @mmio_res: mmio resource of this fpga dfl device.
* @irqs: list of Linux IRQ numbers of this fpga dfl device.
* @num_irqs: number of IRQs supported by this fpga dfl device.
@@ -555,7 +553,7 @@ struct fpga_dfl_device_id {
struct fpga_dfl_device {
struct device dev;
int id;
- u8 type;
+ u16 type;
u16 feature_id;
struct resource mmio_res;
int *irqs;
--
2.7.4
next prev parent reply other threads:[~2020-09-24 17:07 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-24 16:59 [PATCH v3 0/5] add DFL bus support to MODULE_DEVICE_TABLE() Xu Yilun
2020-09-24 16:59 ` [PATCH v3 1/5] fpga: dfl: rename the bus type "dfl" to "fpga-dfl" Xu Yilun
2020-09-24 17:27 ` Moritz Fischer
[not found] ` <20200926022346.GA5623@yilunxu-OptiPlex-7050>
2020-09-26 6:09 ` Greg KH
2020-09-26 19:22 ` Moritz Fischer
2020-09-27 5:51 ` Greg KH
2020-09-27 7:37 ` Xu Yilun
2020-09-27 7:54 ` Greg KH
[not found] ` <20200927083647.GC16433@yilunxu-OptiPlex-7050>
2020-09-29 1:23 ` Xu Yilun
2020-09-29 4:19 ` Moritz Fischer
2020-09-29 7:19 ` Xu Yilun
2020-10-09 6:20 ` Xu Yilun
2020-10-09 6:41 ` Greg KH
2020-10-09 7:34 ` Xu Yilun
2020-10-09 21:28 ` Moritz Fischer
2020-10-10 7:03 ` Greg KH
2020-09-24 19:01 ` Tom Rix
2020-09-25 2:41 ` Moritz Fischer
2020-09-25 3:15 ` Xu Yilun
2020-09-24 16:59 ` Xu Yilun [this message]
2020-09-24 16:59 ` [PATCH v3 3/5] fpga: dfl: move fpga_dfl_device_id to mod_devicetable.h Xu Yilun
2020-09-24 17:00 ` [PATCH v3 4/5] fpga: dfl: add fpga dfl bus support to MODULE_DEVICE_TABLE() Xu Yilun
2020-09-24 17:00 ` [PATCH v3 5/5] fpga: dfl: move fpga dfl bus related APIs to include/linux/fpga/dfl.h Xu Yilun
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=1600966801-30586-3-git-send-email-yilun.xu@intel.com \
--to=yilun.xu@intel.com \
--cc=hao.wu@intel.com \
--cc=lgoncalv@redhat.com \
--cc=linux-fpga@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mdf@kernel.org \
--cc=trix@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).