Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fpga: dfl: fix the definitions of type & feature_id for dfl devices

The value of the field 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 dfl_device.feature_id.

This patch also fixed the MODALIAS format according to the changes
above.

Reviewed-by: Tom Rix <trix@redhat.com>
Signed-off-by: Xu Yilun <yilun.xu@intel.com>
Signed-off-by: Moritz Fischer <mdf@kernel.org>
Link: https://lore.kernel.org/r/20210107043714.991646-4-mdf@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Xu Yilun and committed by
Greg Kroah-Hartman
e08b9e6d fa41d105

+8 -9
+1 -2
drivers/fpga/dfl.c
··· 298 298 { 299 299 struct dfl_device *ddev = to_dfl_dev(dev); 300 300 301 - /* The type has 4 valid bits and feature_id has 12 valid bits */ 302 - return add_uevent_var(env, "MODALIAS=dfl:t%01Xf%03X", 301 + return add_uevent_var(env, "MODALIAS=dfl:t%04Xf%04X", 303 302 ddev->type, ddev->feature_id); 304 303 } 305 304
+7 -7
drivers/fpga/dfl.h
··· 520 520 * enum dfl_id_type - define the DFL FIU types 521 521 */ 522 522 enum dfl_id_type { 523 - FME_ID, 524 - PORT_ID, 523 + FME_ID = 0, 524 + PORT_ID = 1, 525 525 DFL_ID_MAX, 526 526 }; 527 527 528 528 /** 529 529 * struct dfl_device_id - dfl device identifier 530 - * @type: contains 4 bits DFL FIU type of the device. See enum dfl_id_type. 531 - * @feature_id: contains 12 bits feature identifier local to its DFL FIU type. 530 + * @type: DFL FIU type of the device. See enum dfl_id_type. 531 + * @feature_id: feature identifier local to its DFL FIU type. 532 532 * @driver_data: driver specific data. 533 533 */ 534 534 struct dfl_device_id { 535 - u8 type; 535 + u16 type; 536 536 u16 feature_id; 537 537 unsigned long driver_data; 538 538 }; ··· 543 543 * @dev: generic device interface. 544 544 * @id: id of the dfl device. 545 545 * @type: type of DFL FIU of the device. See enum dfl_id_type. 546 - * @feature_id: 16 bits feature identifier local to its DFL FIU type. 546 + * @feature_id: feature identifier local to its DFL FIU type. 547 547 * @mmio_res: mmio resource of this dfl device. 548 548 * @irqs: list of Linux IRQ numbers of this dfl device. 549 549 * @num_irqs: number of IRQs supported by this dfl device. ··· 553 553 struct dfl_device { 554 554 struct device dev; 555 555 int id; 556 - u8 type; 556 + u16 type; 557 557 u16 feature_id; 558 558 struct resource mmio_res; 559 559 int *irqs;