linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
To: linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org
Cc: Martyn Welch <martyn.welch@ge.com>,
	Manohar Vanga <manohar.vanga@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Igor Alekseev <igor.alekseev@itep.ru>,
	Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Subject: [PATCHv4 1/4] staging: vme_user: remove forward declarations
Date: Sat, 13 Jun 2015 16:34:01 +0300	[thread overview]
Message-ID: <1434202444-25719-2-git-send-email-dmitry.kalinkin@gmail.com> (raw)
In-Reply-To: <1434202444-25719-1-git-send-email-dmitry.kalinkin@gmail.com>

Reorder code so that forward declarations are not needed.

Signed-off-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Cc: Igor Alekseev <igor.alekseev@itep.ru>
---
 drivers/staging/vme/devices/vme_user.c | 139 ++++++++++++++-------------------
 1 file changed, 60 insertions(+), 79 deletions(-)

diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c
index 449b8cd..8e46d60 100644
--- a/drivers/staging/vme/devices/vme_user.c
+++ b/drivers/staging/vme/devices/vme_user.c
@@ -116,44 +116,11 @@ static const int type[VME_DEVS] = {	MASTER_MINOR,	MASTER_MINOR,
 					CONTROL_MINOR
 				};
 
-
-static int vme_user_open(struct inode *, struct file *);
-static int vme_user_release(struct inode *, struct file *);
-static ssize_t vme_user_read(struct file *, char __user *, size_t, loff_t *);
-static ssize_t vme_user_write(struct file *, const char __user *, size_t,
-	loff_t *);
-static loff_t vme_user_llseek(struct file *, loff_t, int);
-static long vme_user_unlocked_ioctl(struct file *, unsigned int, unsigned long);
-static int vme_user_mmap(struct file *file, struct vm_area_struct *vma);
-
-static void vme_user_vm_open(struct vm_area_struct *vma);
-static void vme_user_vm_close(struct vm_area_struct *vma);
-
-static int vme_user_match(struct vme_dev *);
-static int vme_user_probe(struct vme_dev *);
-static int vme_user_remove(struct vme_dev *);
-
-static const struct file_operations vme_user_fops = {
-	.open = vme_user_open,
-	.release = vme_user_release,
-	.read = vme_user_read,
-	.write = vme_user_write,
-	.llseek = vme_user_llseek,
-	.unlocked_ioctl = vme_user_unlocked_ioctl,
-	.compat_ioctl = vme_user_unlocked_ioctl,
-	.mmap = vme_user_mmap,
-};
-
 struct vme_user_vma_priv {
 	unsigned int minor;
 	atomic_t refcnt;
 };
 
-static const struct vm_operations_struct vme_user_vm_ops = {
-	.open = vme_user_vm_open,
-	.close = vme_user_vm_close,
-};
-
 
 static int vme_user_open(struct inode *inode, struct file *file)
 {
@@ -582,6 +549,11 @@ static void vme_user_vm_close(struct vm_area_struct *vma)
 	kfree(vma_priv);
 }
 
+static const struct vm_operations_struct vme_user_vm_ops = {
+	.open = vme_user_vm_open,
+	.close = vme_user_vm_close,
+};
+
 static int vme_user_master_mmap(unsigned int minor, struct vm_area_struct *vma)
 {
 	int err;
@@ -623,6 +595,16 @@ static int vme_user_mmap(struct file *file, struct vm_area_struct *vma)
 	return -ENODEV;
 }
 
+static const struct file_operations vme_user_fops = {
+	.open = vme_user_open,
+	.release = vme_user_release,
+	.read = vme_user_read,
+	.write = vme_user_write,
+	.llseek = vme_user_llseek,
+	.unlocked_ioctl = vme_user_unlocked_ioctl,
+	.compat_ioctl = vme_user_unlocked_ioctl,
+	.mmap = vme_user_mmap,
+};
 
 /*
  * Unallocate a previously allocated buffer
@@ -649,52 +631,6 @@ static void buf_unalloc(int num)
 	}
 }
 
-static struct vme_driver vme_user_driver = {
-	.name = driver_name,
-	.match = vme_user_match,
-	.probe = vme_user_probe,
-	.remove = vme_user_remove,
-};
-
-
-static int __init vme_user_init(void)
-{
-	int retval = 0;
-
-	pr_info("VME User Space Access Driver\n");
-
-	if (bus_num == 0) {
-		pr_err("No cards, skipping registration\n");
-		retval = -ENODEV;
-		goto err_nocard;
-	}
-
-	/* Let's start by supporting one bus, we can support more than one
-	 * in future revisions if that ever becomes necessary.
-	 */
-	if (bus_num > VME_USER_BUS_MAX) {
-		pr_err("Driver only able to handle %d buses\n",
-		       VME_USER_BUS_MAX);
-		bus_num = VME_USER_BUS_MAX;
-	}
-
-	/*
-	 * Here we just register the maximum number of devices we can and
-	 * leave vme_user_match() to allow only 1 to go through to probe().
-	 * This way, if we later want to allow multiple user access devices,
-	 * we just change the code in vme_user_match().
-	 */
-	retval = vme_register_driver(&vme_user_driver, VME_MAX_SLOTS);
-	if (retval != 0)
-		goto err_reg;
-
-	return retval;
-
-err_reg:
-err_nocard:
-	return retval;
-}
-
 static int vme_user_match(struct vme_dev *vdev)
 {
 	int i;
@@ -916,6 +852,51 @@ static int vme_user_remove(struct vme_dev *dev)
 	return 0;
 }
 
+static struct vme_driver vme_user_driver = {
+	.name = driver_name,
+	.match = vme_user_match,
+	.probe = vme_user_probe,
+	.remove = vme_user_remove,
+};
+
+static int __init vme_user_init(void)
+{
+	int retval = 0;
+
+	pr_info("VME User Space Access Driver\n");
+
+	if (bus_num == 0) {
+		pr_err("No cards, skipping registration\n");
+		retval = -ENODEV;
+		goto err_nocard;
+	}
+
+	/* Let's start by supporting one bus, we can support more than one
+	 * in future revisions if that ever becomes necessary.
+	 */
+	if (bus_num > VME_USER_BUS_MAX) {
+		pr_err("Driver only able to handle %d buses\n",
+		       VME_USER_BUS_MAX);
+		bus_num = VME_USER_BUS_MAX;
+	}
+
+	/*
+	 * Here we just register the maximum number of devices we can and
+	 * leave vme_user_match() to allow only 1 to go through to probe().
+	 * This way, if we later want to allow multiple user access devices,
+	 * we just change the code in vme_user_match().
+	 */
+	retval = vme_register_driver(&vme_user_driver, VME_MAX_SLOTS);
+	if (retval != 0)
+		goto err_reg;
+
+	return retval;
+
+err_reg:
+err_nocard:
+	return retval;
+}
+
 static void __exit vme_user_exit(void)
 {
 	vme_unregister_driver(&vme_user_driver);
-- 
1.8.3.1


  reply	other threads:[~2015-06-13 13:34 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-28 12:06 [PATCHv3 00/16] vme DMA and user space driver improvements Dmitry Kalinkin
2015-05-28 12:06 ` [PATCHv3 01/16] Documentation: mention vme_master_mmap() in VME API Dmitry Kalinkin
2015-05-28 12:06 ` [PATCHv3 02/16] vme: tsi148: fix DMA lists longer that one item Dmitry Kalinkin
2015-05-28 12:07 ` [PATCHv3 03/16] vme: tsi148: fix first DMA item mapping Dmitry Kalinkin
2015-05-28 12:07 ` [PATCHv3 04/16] vme: stop DMA transfer on interruption Dmitry Kalinkin
2015-05-28 12:07 ` [PATCHv3 05/16] staging: vme_user: refactor llseek to switch(){} Dmitry Kalinkin
2015-05-28 12:07 ` [PATCHv3 06/16] vme: check for A64 overflow in vme_check_window() Dmitry Kalinkin
2015-05-28 12:07 ` [PATCHv3 07/16] vme: export vme_check_window() Dmitry Kalinkin
2015-05-28 12:07 ` [PATCHv3 08/16] staging: vme_user: provide DMA functionality Dmitry Kalinkin
2015-06-13  0:28   ` Greg Kroah-Hartman
2015-07-06 13:22     ` Martyn Welch
2015-07-06 13:50       ` Dmitry Kalinkin
2015-07-06 14:48         ` Martyn Welch
2015-07-06 17:24           ` Dmitry Kalinkin
2015-07-07  7:13             ` Alessio Igor Bogani
2015-07-08 13:22             ` Martyn Welch
2015-07-08 15:02               ` Generic VME UIO driver Dmitry Kalinkin
2015-07-20  8:09                 ` Martyn Welch
     [not found]             ` <CAPk1OjEX7YX5J=yMPOGyGg7ZT6P-iKtaGRDDv2oARPFUcdnKnQ@mail.gmail.com>
2015-07-07 10:52               ` [PATCHv3 08/16] staging: vme_user: provide DMA functionality Dmitry Kalinkin
2015-07-08 13:57                 ` Martyn Welch
2015-07-08 14:47                   ` Dmitry Kalinkin
     [not found]               ` <78FC1849-FFE4-49E5-8421-25D27324F790@gmail.com>
2015-07-07 12:51                 ` Alessio Igor Bogani
2015-07-07 13:04                   ` Dmitry Kalinkin
2015-07-08 13:41                   ` Martyn Welch
2015-07-08 14:39                     ` Dmitry Kalinkin
2015-07-08 14:42                     ` [PATCH] vme: lower alignment requirement in pci bridge drivers Dmitry Kalinkin
2015-07-08 13:28               ` [PATCHv3 08/16] staging: vme_user: provide DMA functionality Martyn Welch
2015-05-28 12:07 ` [PATCHv3 09/16] vme: ca91cx42: return error code on DMA error Dmitry Kalinkin
2015-05-28 12:07 ` [PATCHv3 10/16] vme: ca91cx42: fix LM_CTL address mask Dmitry Kalinkin
2015-05-28 12:07 ` [PATCHv3 11/16] staging: vme_user: remove unused counters Dmitry Kalinkin
2015-05-28 12:07 ` [PATCHv3 12/16] staging: vme_user: remove forward declarations Dmitry Kalinkin
2015-05-28 12:07 ` [PATCHv3 13/16] staging: vme_user: remove open/release Dmitry Kalinkin
2015-05-28 12:07 ` [PATCHv3 14/16] staging: vme_user: remove buf_unalloc helper Dmitry Kalinkin
2015-05-28 12:07 ` [PATCHv3 15/16] vme: tsi148: depend on HAS_DMA for Kconfig Dmitry Kalinkin
2015-05-28 12:07 ` [PATCHv3 16/16] vme: provide uapi header Dmitry Kalinkin
2015-06-13  0:30   ` Greg Kroah-Hartman
2015-05-31  3:06 ` [PATCHv3 00/16] vme DMA and user space driver improvements Greg Kroah-Hartman
2015-06-10 13:09   ` Dmitry Kalinkin
2015-06-13  0:31     ` Greg Kroah-Hartman
2015-06-13  2:04       ` Dmitry Kalinkin
2015-06-13  2:24         ` Greg Kroah-Hartman
2015-06-13  2:30           ` Dmitry Kalinkin
2015-06-13  4:40             ` Greg Kroah-Hartman
2015-06-13 13:34               ` [PATCHv4 0/4] " Dmitry Kalinkin
2015-06-13 13:34                 ` Dmitry Kalinkin [this message]
2015-06-13 13:34                 ` [PATCHv4 2/4] staging: vme_user: remove open/release Dmitry Kalinkin
2015-06-13 13:34                 ` [PATCHv4 3/4] staging: vme_user: remove buf_unalloc helper Dmitry Kalinkin
2015-06-13 13:34                 ` [PATCHv4 4/4] staging: vme_user: provide DMA functionality Dmitry Kalinkin
2015-06-13 21:47                 ` [PATCHv4 0/4] vme DMA and user space driver improvements Greg Kroah-Hartman

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=1434202444-25719-2-git-send-email-dmitry.kalinkin@gmail.com \
    --to=dmitry.kalinkin@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=igor.alekseev@itep.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manohar.vanga@gmail.com \
    --cc=martyn.welch@ge.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).