Re: [PATCH] Add RIFFA PCIe driver to staging tree

2018-10-16 Thread gre...@linuxfoundation.org
On Tue, Oct 16, 2018 at 07:41:45AM +, Cheng Fei Phung wrote:
> Patch changelog content:
> 
> Add a PCIe linux driver called RIFFA to the linux staging tree. It has full 
> duplex capability compared to the original RIFFA linux driver that you can 
> easily find from https://github.com/KastnerRG/riffa/tree/master/driver/linux
> 
> For more context, please refer to 
> https://github.com/promach/riffa/tree/full_duplex/driver/linux
> 
> 
> 
> phung@UbuntuHW15:~/linux$ cat 
> patches/0001-Added-a-full-duplex-riffa-PCIe-linux-staging-driver..patch
> >From 7c3050c7e86017d85c75c640ea38376f505b2763 Mon Sep 17 00:00:00 2001
> From: promach 
> Date: Mon, 15 Oct 2018 18:28:16 +0800
> Subject: [PATCH] Added a full duplex riffa PCIe linux staging driver.
>  Signed-off-by: PHUNG CHENG FEI (feiph...@hotmail.com)
> 

This whole format is very odd.  Please look at how other patches are
posted to the list.  I need a proper changelog and signed-off-by line in
the correct place.

Also, no need to 'cat' the file here, just use git send-email to send
the patch correctly.

Because of this, all of your tabs got converted to spaces, so the patch
you sent here is corrupted.

Try sending it to yourself first, run the result of that email through
scripts/checkpatch.pl and apply it to the tree to verify that it really
does work.

Also, for staging drivers I need a TODO file that lists the remaining
tasks that are left to be done in order to get the driver out of the
staging portion of the kernel tree.

Look at the patch that was sent today that added a new driver to the
staging portion of the kernel as an example of how to do all of this
correctly.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Add RIFFA PCIe driver to staging tree

2018-10-16 Thread Cheng Fei Phung
Patch changelog content:

Add a PCIe linux driver called RIFFA to the linux staging tree. It has full 
duplex capability compared to the original RIFFA linux driver that you can 
easily find from https://github.com/KastnerRG/riffa/tree/master/driver/linux

For more context, please refer to 
https://github.com/promach/riffa/tree/full_duplex/driver/linux



phung@UbuntuHW15:~/linux$ cat 
patches/0001-Added-a-full-duplex-riffa-PCIe-linux-staging-driver..patch
>From 7c3050c7e86017d85c75c640ea38376f505b2763 Mon Sep 17 00:00:00 2001
From: promach 
Date: Mon, 15 Oct 2018 18:28:16 +0800
Subject: [PATCH] Added a full duplex riffa PCIe linux staging driver.
 Signed-off-by: PHUNG CHENG FEI (feiph...@hotmail.com)

---
 drivers/staging/riffa/Makefile   |  157 +++
 drivers/staging/riffa/README.txt |   38 +
 drivers/staging/riffa/circ_queue.c   |  188 +++
 drivers/staging/riffa/circ_queue.h   |   96 ++
 drivers/staging/riffa/riffa.c    |  152 +++
 drivers/staging/riffa/riffa.h    |  121 ++
 drivers/staging/riffa/riffa_driver.c | 1633 ++
 drivers/staging/riffa/riffa_driver.h |  131 +++
 8 files changed, 2516 insertions(+)
 create mode 100644 drivers/staging/riffa/Makefile
 create mode 100644 drivers/staging/riffa/README.txt
 create mode 100644 drivers/staging/riffa/circ_queue.c
 create mode 100644 drivers/staging/riffa/circ_queue.h
 create mode 100644 drivers/staging/riffa/riffa.c
 create mode 100644 drivers/staging/riffa/riffa.h
 create mode 100644 drivers/staging/riffa/riffa_driver.c
 create mode 100644 drivers/staging/riffa/riffa_driver.h

diff --git a/drivers/staging/riffa/Makefile b/drivers/staging/riffa/Makefile
new file mode 100644
index ..3e3cb0c4a387
--- /dev/null
+++ b/drivers/staging/riffa/Makefile
@@ -0,0 +1,157 @@
+# --
+# Copyright (c) 2016, The Regents of the University of California All
+# rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above
+#   copyright notice, this list of conditions and the following
+#   disclaimer in the documentation and/or other materials provided
+#   with the distribution.
+#
+# * Neither the name of The Regents of the University of California
+#   nor the names of its contributors may be used to endorse or
+#   promote products derived from this software without specific
+#   prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL REGENTS OF THE
+# UNIVERSITY OF CALIFORNIA BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+# DAMAGE.
+# --
+
+# Filename: Makefile
+# Version: 2.0
+# Description: Makefile for Linux PCIe device driver for RIFFA.
+# Author: Matthew Jacobsen
+# History: @mattj: Initial release. Version 2.0.
+
+# You must specify the following variables. You can leave the defaults if you
+# like, but make sure they will work in your system.
+# The VENDOR_ID _must_ match what is configured on your FPGA's PCIe endpoint
+# header. Xilinx has a VENDOR_ID = 10EE.
+NAME := riffa
+VENDOR_ID0 := 10EE
+VENDOR_ID1 := 1172
+MAJNUM := 100
+
+# Build variables
+KVER := $(shell uname -r)
+KDIR := /lib/modules/`uname -r`/build
+RHR := /etc/redhat-release
+LIB_SRCS := riffa.c
+LIB_OBJS := $(patsubst %.c,%.o,$(LIB_SRCS))
+LIB_HDR := riffa.h
+LIB_VER_MAJ := 1
+LIB_VER_MIN := 0
+LIB_VER := $(LIB_VER_MAJ).$(LIB_VER_MIN)
+DRVR_HDR := riffa_driver.h
+DBUGVAL := DBUG
+
+obj-m += $(NAME).o
+$(NAME)-y := riffa_driver.o circ_queue.o
+
+# Helper functions
+define assert
+  $(if $1,,$(error Assertion failed: $2))
+endef
+define assert-not-null
+  $(call assert,$($1),The variable "$1" is null, please specify it.)
+endef
+define assert-variables
+    $(call assert-not-null,NAME)
+    $(call assert-not-null,MAJNUM)
+    $(call assert-not-null,VENDOR_ID0)
+    $(call assert-not-null,VENDOR_ID1)
+    @printf "Compiling driver for kernel: %s with the following values\n" 
$(KVER)
+    @printf " NAME: '%s'\n"