[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] linux-2.6.18/pcifront: consolidate messages


  • To: "xen-devel" <xen-devel@xxxxxxxxxxxxx>
  • From: "Jan Beulich" <JBeulich@xxxxxxxx>
  • Date: Wed, 28 Mar 2012 14:56:05 +0100
  • Delivery-date: Wed, 28 Mar 2012 13:55:34 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>

Primarily the code should exclusively use dev_{err,warn,info}().

Additionally remove some redundant information, adjust the wording in
a few cases, and do some other benign cleanup.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/drivers/xen/pcifront/pci_op.c
+++ b/drivers/xen/pcifront/pci_op.c
@@ -15,11 +15,11 @@
 static int verbose_request = 0;
 module_param(verbose_request, int, 0644);
 
-#ifdef __ia64__
 static void pcifront_init_sd(struct pcifront_sd *sd,
                             unsigned int domain, unsigned int bus,
                             struct pcifront_device *pdev)
 {
+#ifdef __ia64__
        int err, i, j, k, len, root_num, res_count;
        struct acpi_resource res;
        unsigned int d, b, byte;
@@ -66,7 +66,8 @@ static void pcifront_init_sd(struct pcif
                return; /* No resources, nothing to do */
 
        if (magic != (sizeof(res) * 2) + 1) {
-               printk(KERN_WARNING "pcifront: resource magic mismatch\n");
+               dev_warn(&pdev->xdev->dev,
+                        "pcifront: resource magic mismatch\n");
                return;
        }
 
@@ -104,9 +105,9 @@ static void pcifront_init_sd(struct pcif
                err = xenbus_scanf(XBT_NIL, pdev->xdev->otherend, str,
                                   "%s", buf);
                if (err != 1) {
-                       printk(KERN_WARNING "pcifront: error reading "
-                              "resource %d on bus %04x:%02x\n",
-                              j, domain, bus);
+                       dev_warn(&pdev->xdev->dev,
+                                "pcifront: error reading resource %d on bus 
%04x:%02x\n",
+                                j, domain, bus);
                        continue;
                }
 
@@ -128,8 +129,11 @@ static void pcifront_init_sd(struct pcif
                sd->windows++;
        }
        kfree(buf);
-}
+#else
+       sd->domain = domain;
+       sd->pdev = pdev;
 #endif
+}
 
 static int errno_to_pcibios_err(int errno)
 {
@@ -215,8 +219,7 @@ static int do_pci_op(struct pcifront_dev
        */
        if (test_bit(_XEN_PCIB_active, 
                        (unsigned long*)&pdev->sh_info->flags)) {
-               dev_err(&pdev->xdev->dev, 
-                       "schedule aer pcifront service\n");
+               dev_info(&pdev->xdev->dev, "schedule aer pcifront service\n");
                schedule_pcifront_aer_op(pdev);
        }
 
@@ -230,9 +233,9 @@ static int do_pci_op(struct pcifront_dev
 
 /* Access to this function is spinlocked in drivers/pci/access.c */
 static int pcifront_bus_read(struct pci_bus *bus, unsigned int devfn,
-                            int where, int size, u32 * val)
+                            int where, int size, u32 *val)
 {
-       int err = 0;
+       int err;
        struct xen_pci_op op = {
                .cmd    = XEN_PCI_OP_conf_read,
                .domain = pci_domain_nr(bus),
@@ -245,24 +248,24 @@ static int pcifront_bus_read(struct pci_
        struct pcifront_device *pdev = pcifront_get_pdev(sd);
 
        if (verbose_request)
-               dev_info(&pdev->xdev->dev,
-                        "read dev=%04x:%02x:%02x.%01x - offset %x size %d\n",
-                        pci_domain_nr(bus), bus->number, PCI_SLOT(devfn),
-                        PCI_FUNC(devfn), where, size);
+               dev_info(&pdev->xdev->dev, "read %02x.%u offset %x size %d\n",
+                        PCI_SLOT(devfn), PCI_FUNC(devfn), where, size);
 
        err = do_pci_op(pdev, &op);
 
        if (likely(!err)) {
                if (verbose_request)
-                       dev_info(&pdev->xdev->dev, "read got back value %x\n",
-                                op.value);
+                       dev_info(&pdev->xdev->dev, "read %02x.%u = %x\n",
+                                PCI_SLOT(devfn), PCI_FUNC(devfn), op.value);
 
                *val = op.value;
        } else if (err == -ENODEV) {
                /* No device here, pretend that it just returned 0 */
                err = 0;
                *val = 0;
-       }
+       } else if (verbose_request)
+               dev_info(&pdev->xdev->dev, "read %02x.%u -> %d\n",
+                        PCI_SLOT(devfn), PCI_FUNC(devfn), err);
 
        return errno_to_pcibios_err(err);
 }
@@ -285,15 +288,13 @@ static int pcifront_bus_write(struct pci
 
        if (verbose_request)
                dev_info(&pdev->xdev->dev,
-                        "write dev=%04x:%02x:%02x.%01x - "
-                        "offset %x size %d val %x\n",
-                        pci_domain_nr(bus), bus->number,
+                        "write %02x.%u offset %x size %d val %x\n",
                         PCI_SLOT(devfn), PCI_FUNC(devfn), where, size, val);
 
        return errno_to_pcibios_err(do_pci_op(pdev, &op));
 }
 
-struct pci_ops pcifront_bus_ops = {
+static struct pci_ops pcifront_bus_ops = {
        .read = pcifront_bus_read,
        .write = pcifront_bus_write,
 };
@@ -315,8 +316,9 @@ int pci_frontend_enable_msix(struct pci_
        struct pcifront_sd *sd = dev->bus->sysdata;
        struct pcifront_device *pdev = pcifront_get_pdev(sd);
 
-       if (nvec > SH_INFO_MAX_VEC) {
-               printk("too much vector for pci frontend%x\n", nvec);
+       if (nvec < 0 || nvec > SH_INFO_MAX_VEC) {
+               dev_err(&dev->dev, "too many (%d) vectors for pci frontend\n",
+                       nvec);
                return -EINVAL;
        }
 
@@ -330,22 +332,20 @@ int pci_frontend_enable_msix(struct pci_
        if (!err) {
                if (!op.value) {
                        /* we get the result */
-                       for ( i = 0; i < nvec; i++)
+                       for (i = 0; i < nvec; i++)
                                entries[i].vector = op.msix_entries[i].vector;
-                       return 0;
-               }
-               else {
-            printk("enable msix get value %x\n", op.value);
-                       return op.value;
+               } else {
+                       dev_err(&dev->dev, "enable MSI-X => %#x\n", op.value);
+                       err = op.value;
                }
+       } else {
+               dev_err(&dev->dev, "enable MSI-X -> %d\n", err);
+               err = -EINVAL;
        }
-       else {
-        printk("enable msix get err %x\n", err);
-               return err;
-       }
+       return err;
 }
 
-void pci_frontend_disable_msix(struct pci_dev* dev)
+void pci_frontend_disable_msix(struct pci_dev *dev)
 {
        int err;
        struct xen_pci_op op = {
@@ -361,7 +361,7 @@ void pci_frontend_disable_msix(struct pc
 
        /* What should do for error ? */
        if (err)
-               printk("pci_disable_msix get err %x\n", err);
+               dev_err(&dev->dev, "disable MSI-X -> %d\n", err);
 }
 
 int pci_frontend_enable_msi(struct pci_dev *dev)
@@ -377,18 +377,16 @@ int pci_frontend_enable_msi(struct pci_d
        struct pcifront_device *pdev = pcifront_get_pdev(sd);
 
        err = do_pci_op(pdev, &op);
-       if (likely(!err)) {
+       if (likely(!err))
                dev->irq = op.value;
-       }
        else {
-               printk("pci frontend enable msi failed for dev %x:%x \n",
-                               op.bus, op.devfn);
+               dev_err(&dev->dev, "enable MSI -> %d\n", err);
                err = -EINVAL;
        }
        return err;
 }
 
-void pci_frontend_disable_msi(struct pci_dev* dev)
+void pci_frontend_disable_msi(struct pci_dev *dev)
 {
        int err;
        struct xen_pci_op op = {
@@ -401,16 +399,10 @@ void pci_frontend_disable_msi(struct pci
        struct pcifront_device *pdev = pcifront_get_pdev(sd);
 
        err = do_pci_op(pdev, &op);
-       if (err == XEN_PCI_ERR_dev_not_found) {
-               /* XXX No response from backend, what shall we do? */
-               printk("get no response from backend for disable MSI\n");
-               return;
-       }
        if (likely(!err))
                dev->irq = op.value;
        else
-               /* how can pciback notify us fail? */
-               printk("get fake response frombackend \n");
+               dev_err(&dev->dev, "disable MSI -> %d\n", err);
 }
 #endif /* CONFIG_PCI_MSI */
 
@@ -436,18 +428,17 @@ int __devinit pcifront_scan_root(struct 
                                 unsigned int domain, unsigned int bus)
 {
        struct pci_bus *b;
-       struct pcifront_sd *sd = NULL;
-       struct pci_bus_entry *bus_entry = NULL;
+       struct pcifront_sd *sd;
+       struct pci_bus_entry *bus_entry;
        int err = 0;
 
 #ifndef CONFIG_PCI_DOMAINS
        if (domain != 0) {
                dev_err(&pdev->xdev->dev,
-                       "PCI Root in non-zero PCI Domain! domain=%d\n", domain);
+                       "PCI root in non-zero domain %x!\n", domain);
                dev_err(&pdev->xdev->dev,
                        "Please compile with CONFIG_PCI_DOMAINS\n");
-               err = -EINVAL;
-               goto err_out;
+               return -EINVAL;
        }
 #endif
 
@@ -500,7 +491,7 @@ int __devinit pcifront_rescan_root(struc
 #ifndef CONFIG_PCI_DOMAINS
        if (domain != 0) {
                dev_err(&pdev->xdev->dev,
-                       "PCI Root in non-zero PCI Domain! domain=%d\n", domain);
+                       "PCI root in non-zero domain %x\n", domain);
                dev_err(&pdev->xdev->dev,
                        "Please compile with CONFIG_PCI_DOMAINS\n");
                return -EINVAL;
@@ -529,8 +520,9 @@ int __devinit pcifront_rescan_root(struc
 
                d = pci_scan_single_device(b, devfn);
                if (d)
-                       dev_info(&pdev->xdev->dev, "New device on "
-                                "%04x:%02x:%02x.%02x found.\n", domain, bus,
+                       dev_info(&pdev->xdev->dev,
+                                "New device on %04x:%02x:%02x.%u\n",
+                                domain, bus,
                                 PCI_SLOT(devfn), PCI_FUNC(devfn));
        }
 
@@ -586,7 +578,7 @@ static pci_ers_result_t pcifront_common_
        int flag = 0;
 
        dev_dbg(&pdev->xdev->dev, 
-               "pcifront AER process: cmd %x (bus:%x, devfn%x)",
+               "pcifront AER process: cmd %x (bus %x devfn %x)",
                cmd, bus, devfn);
        result = PCI_ERS_RESULT_NONE;
 
@@ -619,8 +611,9 @@ static pci_ers_result_t pcifront_common_
                                        break;
                                default:
                                        dev_err(&pdev->xdev->dev,
-                                               "bad request in aer recovery 
operation!\n");
-
+                                               "bad request %x in aer recovery 
operation!\n",
+                                               cmd);
+                                       break;
                                }
                        }
                }
--- a/include/xen/pcifront.h
+++ b/include/xen/pcifront.h
@@ -26,14 +26,6 @@ pcifront_get_pdev(struct pcifront_sd *sd
        return sd->pdev;
 }
 
-static inline void pcifront_init_sd(struct pcifront_sd *sd,
-                                   unsigned int domain, unsigned int bus,
-                                   struct pcifront_device *pdev)
-{
-       sd->domain = domain;
-       sd->pdev = pdev;
-}
-
 #if defined(CONFIG_PCI_DOMAINS)
 static inline int pci_domain_nr(struct pci_bus *bus)
 {


Attachment: xen-pcifront-messages.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.