FMC: support carriers with no mezzanine
authorAlessandro Rubini <rubini@gnudd.com>
Thu, 30 Jan 2014 12:05:09 +0000 (13:05 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 15 Feb 2014 19:51:04 +0000 (11:51 -0800)
At registration and unregistration time, I was checking fmc->flags
for FMC_DEVICE_NO_MEZZANINE, to skip initialization and cleanup for
empty slots.  The check was wrong ("==" instead of "&") but
registration failed anyways (as expected) because we had no EEPROM.

This commit fixes one such checks and removes the other, so to
actually accept slots with no mezzanines. That's because the carrier
may offer some support anyways (the SPEC does), and working on the
carrier with no mezzanine-specific driver is common during
development.

Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
Acked-by: Juan David Gonzalez Cobas <dcobas@cern.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/fmc/fmc-core.c

index 24d52497524dce7b8935cb678c6084d39c6f2510..5a5e616c6324069bc79408abcfc60e33f0688963 100644 (file)
@@ -154,7 +154,7 @@ int fmc_device_register_n(struct fmc_device **devs, int n)
                        ret = -EINVAL;
                        break;
                }
-               if (fmc->flags == FMC_DEVICE_NO_MEZZANINE) {
+               if (fmc->flags & FMC_DEVICE_NO_MEZZANINE) {
                        dev_info(fmc->hwdev, "absent mezzanine in slot %d\n",
                                 fmc->slot_id);
                        continue;
@@ -189,9 +189,6 @@ int fmc_device_register_n(struct fmc_device **devs, int n)
        for (i = 0; i < n; i++) {
                fmc = devarray[i];
 
-               if (fmc->flags == FMC_DEVICE_NO_MEZZANINE)
-                       continue; /* dev_info already done above */
-
                fmc->nr_slots = n; /* each slot must know how many are there */
                fmc->devarray = devarray;
 
@@ -263,8 +260,6 @@ void fmc_device_unregister_n(struct fmc_device **devs, int n)
        kfree(devs[0]->devarray);
 
        for (i = 0; i < n; i++) {
-               if (devs[i]->flags == FMC_DEVICE_NO_MEZZANINE)
-                       continue;
                sysfs_remove_bin_file(&devs[i]->dev.kobj, &fmc_eeprom_attr);
                device_del(&devs[i]->dev);
                fmc_free_id_info(devs[i]);