From: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
To: George Zhang <georgezhang@vmware.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"virtualization@lists.linux-foundation.org"
<virtualization@lists.linux-foundation.org>
Subject: Re: [PATCH 04/11] vmci_driver.patch: VMCI device driver.
Date: Thu, 30 Aug 2012 14:04:00 -0700 [thread overview]
Message-ID: <20120830210400.GB3276@kroah.com> (raw)
In-Reply-To: <15333E71B3DDCB48A90165AD57993F285685DB43DA@exch-mbx-114.vmware.com>
On Thu, Aug 30, 2012 at 09:40:34AM -0700, George Zhang wrote:
> +struct vmci_device {
> + struct mutex lock; /* Device access mutex */
> +
> + unsigned int ioaddr;
> + unsigned int ioaddr_size;
> + unsigned int irq;
> + unsigned int intr_type;
> + bool exclusive_vectors;
> + struct msix_entry msix_entries[VMCI_MAX_INTRS];
> +
> + bool enabled;
> + spinlock_t dev_spinlock; /* Lock for datagram access synchronization */
> + atomic_t datagrams_allowed;
> +};
Why are you ignoring the driver model with this code, and the rest of
your infractructure? Please don't, that's just rude. Hint, you should
have a "struct device dev" in this structure if you are doing things
right.
> +static long drv_driver_unlocked_ioctl(struct file *filp,
> + u_int iocmd,
> + unsigned long ioarg)
> +{
Ah, a new syscall. Why not just create a real syscall instead of
multiplexing here? Are you _sure_ all of these ioctls really are needed
(hint, I know they aren't...)
> +static int __devinit drv_probe_device(struct pci_dev *pdev,
> + const struct pci_device_id *id)
> +{
> + unsigned int ioaddr;
> + unsigned int ioaddr_size;
> + unsigned int capabilities;
> + int result;
> +
> + pr_info("Probing for vmci/PCI.");
This is pointless, why are you being noisy?
> + result = pci_enable_device(pdev);
> + if (result) {
> + pr_err("Cannot enable VMCI device %s: error %d",
> + pci_name(pdev), result);
Ick, please use dev_err() here, and other dev_* printk functions where
you can (hint, it's quite often in this file.)
> + return result;
> + }
> + pci_set_master(pdev); /* To enable QueuePair functionality. */
> + ioaddr = pci_resource_start(pdev, 0);
> + ioaddr_size = pci_resource_len(pdev, 0);
> +
> + /*
> + * Request I/O region with adjusted base address and size. The
> + * adjusted values are needed and used if we release the
> + * region in case of failure.
> + */
> + if (!request_region(ioaddr, ioaddr_size, MODULE_NAME)) {
> + pr_info(MODULE_NAME ": Another driver already loaded " \
> + "for device in slot %s.", pci_name(pdev));
> + goto pci_disable;
> + }
> +
> + pr_info("Found VMCI PCI device at %#x, irq %u.", ioaddr, pdev->irq);
Ick, noisy, you should NEVER print anything out if all goes well, that's
pointless.
greg k-h
next prev parent reply other threads:[~2012-08-30 21:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20120824171042.4775.36871.stgit@promb-2n-dhcp175.eng.vmware.com>
2012-08-30 16:35 ` [Pv-drivers] [vmw_vmci 00/11] VMCI driver for Linux George Zhang
[not found] ` <20120824171551.4775.87175.stgit@promb-2n-dhcp175.eng.vmware.com>
2012-08-30 16:38 ` [PATCH 01/11] vmci_context.patch: VMCI context list operations George Zhang
2012-08-30 20:57 ` gregkh
2012-08-30 21:05 ` gregkh
[not found] ` <20120824171556.4775.64978.stgit@promb-2n-dhcp175.eng.vmware.com>
2012-08-30 16:39 ` [PATCH 02/11] vmci_datagram.patch: VMCI datagram entity handling George Zhang
[not found] ` <20120824171607.4775.41134.stgit@promb-2n-dhcp175.eng.vmware.com>
2012-08-30 16:40 ` [PATCH 04/11] vmci_driver.patch: VMCI device driver George Zhang
2012-08-30 21:04 ` gregkh [this message]
[not found] ` <20120824171617.4775.63033.stgit@promb-2n-dhcp175.eng.vmware.com>
2012-08-30 16:41 ` [PATCH 06/11] vmci_handle_array.patch: VMCI array of vmci_handle George Zhang
[not found] ` <20120824171622.4775.49916.stgit@promb-2n-dhcp175.eng.vmware.com>
2012-08-30 16:41 ` [PATCH 07/11] vmci_hash_table.patch: VMCI hash table implementation George Zhang
[not found] ` <20120824171627.4775.50884.stgit@promb-2n-dhcp175.eng.vmware.com>
2012-08-30 16:41 ` [PATCH 08/11] vmci_queue_pair.patch: VMCI queue pair implementation George Zhang
[not found] ` <20120824171633.4775.49218.stgit@promb-2n-dhcp175.eng.vmware.com>
2012-08-30 16:42 ` [PATCH 09/11] vmci_resource.patch: VMCI resource hash table implementation George Zhang
[not found] ` <20120824171638.4775.22952.stgit@promb-2n-dhcp175.eng.vmware.com>
2012-08-30 16:42 ` [PATCH 10/11] vmci_route.patch: VMCI routing implementation George Zhang
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=20120830210400.GB3276@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=georgezhang@vmware.com \
--cc=linux-kernel@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.org \
/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