--- x/drivers/i2c/i2c-core-base.c +++ y/drivers/i2c/i2c-core-base.c @@ -1826,8 +1826,6 @@ void i2c_del_adapter(struct i2c_adapter i2c_host_notify_irq_teardown(adap); - debugfs_remove_recursive(adap->debugfs); - /* wait until all references to the device are gone * * FIXME: This is old code and should ideally be replaced by an @@ -1844,6 +1842,8 @@ void i2c_del_adapter(struct i2c_adapter idr_remove(&i2c_adapter_idr, adap->nr); mutex_unlock(&core_lock); + debugfs_remove_recursive(adap->debugfs); + /* Clear the device structure in case this adapter is ever going to be added again */ memset(&adap->dev, 0, sizeof(adap->dev));