On Mon, Dec 04, 2017 at 09:59:02PM +0200, Marcus Wolf wrote: > Keep in mind, that if you split the functions, in the interface > implementation you also need more code: > > SET_CHECKED(rf69_set_sync_enable(dev->spi, rx_cfg->enable_sync)); > > will have to be converted in something like > > if (rx_cfg->enable_sync) > SET_CHECKED(rf69_set_sync_enbable(dev->spi); > else > SET_CHECKED(rf69_set_sync_disable(dev->spi); >
Here's what the code looks like right now: 198 /* packet config */ 199 /* enable */ 200 SET_CHECKED(rf69_set_sync_enable(dev->spi, rx_cfg->enable_sync)); 201 if (rx_cfg->enable_sync == optionOn) 202 { 203 SET_CHECKED(rf69_set_fifo_fill_condition(dev->spi, afterSyncInterrupt)); 204 } 205 else 206 { 207 SET_CHECKED(rf69_set_fifo_fill_condition(dev->spi, always)); 208 } That's for the rx_cfg. We have related but different code for the tx_cfg. It's strange to me that we can enable sync for rx and not for tx... How does that work when the setting ends up getting stored in the same register? The new code would look like this: if (rx_cfg->enable_sync) { ret = rf69_enable_sync(spi); if (ret) return ret; ret = rf69_set_fifo_fill_condition(dev->spi, afterSyncInterrupt); if (ret) return ret; } else { ret = rf69_disable_sync(dev->spi); if (ret) return ret; ret = rf69_set_fifo_fill_condition(dev->spi, always); if (ret) return ret; } It's not the greatest, but it's not the worst... The configuration for ->enable_sync is a bit spread out and it might be nice to move it all to one function? I liked Simon's naming scheme and I thought it was clear what the rf69_set_sync(spi, false) function would do. Simon, it seems like Marcus and I both are Ok with your style choices. Do whatever seems best when you implement the code. If it's awkward to break up the functions then don't. regards, dan carpenter _______________________________________________ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel