Re: [PATCH v2 02/19] dlb2: initialize PF device

From: Greg KH
Date: Tue Aug 11 2020 - 13:06:27 EST


On Tue, Aug 11, 2020 at 11:27:15AM -0500, Gage Eads wrote:
> The driver detects the device type (PF/VF) at probe time, and assigns the
> corresponding 'ops' callbacks from that. These callbacks include mapping
> and unmapping the PCI BAR space, creating/destroying the device, and
> adding/deleting a char device.
>
> Signed-off-by: Gage Eads <gage.eads@xxxxxxxxx>
> Reviewed-by: Magnus Karlsson <magnus.karlsson@xxxxxxxxx>
> ---
> drivers/misc/dlb2/Makefile | 5 +-
> drivers/misc/dlb2/dlb2_hw_types.h | 28 +++++++++
> drivers/misc/dlb2/dlb2_main.c | 49 ++++++++++++++-
> drivers/misc/dlb2/dlb2_main.h | 30 +++++++++
> drivers/misc/dlb2/dlb2_pf_ops.c | 126 ++++++++++++++++++++++++++++++++++++++
> 5 files changed, 235 insertions(+), 3 deletions(-)
> create mode 100644 drivers/misc/dlb2/dlb2_pf_ops.c
>
> diff --git a/drivers/misc/dlb2/Makefile b/drivers/misc/dlb2/Makefile
> index 90ae953d2a8f..95e67e5bd8ff 100644
> --- a/drivers/misc/dlb2/Makefile
> +++ b/drivers/misc/dlb2/Makefile
> @@ -4,5 +4,6 @@
>
> obj-$(CONFIG_INTEL_DLB2) := dlb2.o
>
> -dlb2-objs := \
> - dlb2_main.o \
> +dlb2-objs := \
> + dlb2_main.o \
> + dlb2_pf_ops.o \
> diff --git a/drivers/misc/dlb2/dlb2_hw_types.h b/drivers/misc/dlb2/dlb2_hw_types.h
> index a0f908c603eb..10b26356535f 100644
> --- a/drivers/misc/dlb2/dlb2_hw_types.h
> +++ b/drivers/misc/dlb2/dlb2_hw_types.h
> @@ -5,6 +5,25 @@
> #ifndef __DLB2_HW_TYPES_H
> #define __DLB2_HW_TYPES_H
>
> +#include <linux/io.h>
> +
> +#define DLB2_PCI_REG_READ(addr) ioread32(addr)
> +#define DLB2_PCI_REG_WRITE(reg, value) iowrite32(value, reg)

Why create a macro that is larger than the native call, this saves
nothing except make the reviewer wonder what in the world is happening.

Just use the real call.