Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'i3c/for-6.19-2' of git://git.kernel.org/pub/scm/linux/kernel/git/i3c/linux

Pull further i3c update from Alexandre Belloni:
"We are removing a legacy API callback and having this sooner rather
than later will help ensuring no one introduces a new driver using it.

I've also added patches removing the "__free(...) = NULL" pattern
because I'm sure we won't avoid people sending those following the
mailing list discussion..."

* tag 'i3c/for-6.19-2' of git://git.kernel.org/pub/scm/linux/kernel/git/i3c/linux:
i3c: adi: Fix confusing cleanup.h syntax
i3c: master: Fix confusing cleanup.h syntax
i3c: master: cleanup callback .priv_xfers()
i3c: master: switch to use new callback .i3c_xfers() from .priv_xfers()

+28 -49
+3 -14
drivers/i3c/master.c
··· 1742 1742 struct i3c_dma *i3c_master_dma_map_single(struct device *dev, void *buf, 1743 1743 size_t len, bool force_bounce, enum dma_data_direction dir) 1744 1744 { 1745 - struct i3c_dma *dma_xfer __free(kfree) = NULL; 1746 1745 void *bounce __free(kfree) = NULL; 1747 1746 void *dma_buf = buf; 1748 1747 1749 - dma_xfer = kzalloc(sizeof(*dma_xfer), GFP_KERNEL); 1748 + struct i3c_dma *dma_xfer __free(kfree) = kzalloc(sizeof(*dma_xfer), GFP_KERNEL); 1750 1749 if (!dma_xfer) 1751 1750 return NULL; 1752 1751 ··· 2818 2819 2819 2820 static int i3c_master_check_ops(const struct i3c_master_controller_ops *ops) 2820 2821 { 2821 - if (!ops || !ops->bus_init || 2822 + if (!ops || !ops->bus_init || !ops->i3c_xfers || 2822 2823 !ops->send_ccc_cmd || !ops->do_daa || !ops->i2c_xfers) 2823 - return -EINVAL; 2824 - 2825 - /* Must provide one of priv_xfers (SDR only) or i3c_xfers (all modes) */ 2826 - if (!ops->priv_xfers && !ops->i3c_xfers) 2827 2824 return -EINVAL; 2828 2825 2829 2826 if (ops->request_ibi && ··· 3026 3031 if (mode != I3C_SDR && !(master->this->info.hdr_cap & BIT(mode))) 3027 3032 return -EOPNOTSUPP; 3028 3033 3029 - if (master->ops->i3c_xfers) 3030 - return master->ops->i3c_xfers(dev, xfers, nxfers, mode); 3031 - 3032 - if (mode != I3C_SDR) 3033 - return -EINVAL; 3034 - 3035 - return master->ops->priv_xfers(dev, xfers, nxfers); 3034 + return master->ops->i3c_xfers(dev, xfers, nxfers, mode); 3036 3035 } 3037 3036 3038 3037 int i3c_dev_disable_ibi_locked(struct i3c_dev_desc *dev)
+8 -10
drivers/i3c/master/adi-i3c-master.c
··· 332 332 struct i3c_ccc_cmd *cmd) 333 333 { 334 334 struct adi_i3c_master *master = to_adi_i3c_master(m); 335 - struct adi_i3c_xfer *xfer __free(kfree) = NULL; 336 335 struct adi_i3c_cmd *ccmd; 337 336 338 - xfer = adi_i3c_master_alloc_xfer(master, 1); 337 + struct adi_i3c_xfer *xfer __free(kfree) = adi_i3c_master_alloc_xfer(master, 1); 339 338 if (!xfer) 340 339 return -ENOMEM; 341 340 ··· 364 365 return 0; 365 366 } 366 367 367 - static int adi_i3c_master_priv_xfers(struct i3c_dev_desc *dev, 368 - struct i3c_priv_xfer *xfers, 369 - int nxfers) 368 + static int adi_i3c_master_i3c_xfers(struct i3c_dev_desc *dev, 369 + struct i3c_xfer *xfers, 370 + int nxfers, enum i3c_xfer_mode mode) 370 371 { 371 372 struct i3c_master_controller *m = i3c_dev_get_master(dev); 372 373 struct adi_i3c_master *master = to_adi_i3c_master(m); 373 - struct adi_i3c_xfer *xfer __free(kfree) = NULL; 374 374 int i, ret; 375 375 376 376 if (!nxfers) 377 377 return 0; 378 378 379 - xfer = adi_i3c_master_alloc_xfer(master, nxfers); 379 + struct adi_i3c_xfer *xfer __free(kfree) = adi_i3c_master_alloc_xfer(master, nxfers); 380 380 if (!xfer) 381 381 return -ENOMEM; 382 382 ··· 775 777 { 776 778 struct i3c_master_controller *m = i2c_dev_get_master(dev); 777 779 struct adi_i3c_master *master = to_adi_i3c_master(m); 778 - struct adi_i3c_xfer *xfer __free(kfree) = NULL; 779 780 int i; 780 781 781 782 if (!nxfers) ··· 783 786 if (xfers[i].flags & I2C_M_TEN) 784 787 return -EOPNOTSUPP; 785 788 } 786 - xfer = adi_i3c_master_alloc_xfer(master, nxfers); 789 + 790 + struct adi_i3c_xfer *xfer __free(kfree) = adi_i3c_master_alloc_xfer(master, nxfers); 787 791 if (!xfer) 788 792 return -ENOMEM; 789 793 ··· 917 919 .do_daa = adi_i3c_master_do_daa, 918 920 .supports_ccc_cmd = adi_i3c_master_supports_ccc_cmd, 919 921 .send_ccc_cmd = adi_i3c_master_send_ccc_cmd, 920 - .priv_xfers = adi_i3c_master_priv_xfers, 922 + .i3c_xfers = adi_i3c_master_i3c_xfers, 921 923 .i2c_xfers = adi_i3c_master_i2c_xfers, 922 924 .request_ibi = adi_i3c_master_request_ibi, 923 925 .enable_ibi = adi_i3c_master_enable_ibi,
+4 -4
drivers/i3c/master/dw-i3c-master.c
··· 902 902 return ret; 903 903 } 904 904 905 - static int dw_i3c_master_priv_xfers(struct i3c_dev_desc *dev, 906 - struct i3c_priv_xfer *i3c_xfers, 907 - int i3c_nxfers) 905 + static int dw_i3c_master_i3c_xfers(struct i3c_dev_desc *dev, 906 + struct i3c_xfer *i3c_xfers, 907 + int i3c_nxfers, enum i3c_xfer_mode mode) 908 908 { 909 909 struct dw_i3c_i2c_dev_data *data = i3c_dev_get_master_data(dev); 910 910 struct i3c_master_controller *m = i3c_dev_get_master(dev); ··· 1498 1498 .do_daa = dw_i3c_master_daa, 1499 1499 .supports_ccc_cmd = dw_i3c_master_supports_ccc_cmd, 1500 1500 .send_ccc_cmd = dw_i3c_master_send_ccc_cmd, 1501 - .priv_xfers = dw_i3c_master_priv_xfers, 1501 + .i3c_xfers = dw_i3c_master_i3c_xfers, 1502 1502 .attach_i2c_dev = dw_i3c_master_attach_i2c_dev, 1503 1503 .detach_i2c_dev = dw_i3c_master_detach_i2c_dev, 1504 1504 .i2c_xfers = dw_i3c_master_i2c_xfers,
+4 -4
drivers/i3c/master/i3c-master-cdns.c
··· 720 720 return ret; 721 721 } 722 722 723 - static int cdns_i3c_master_priv_xfers(struct i3c_dev_desc *dev, 724 - struct i3c_priv_xfer *xfers, 725 - int nxfers) 723 + static int cdns_i3c_master_i3c_xfers(struct i3c_dev_desc *dev, 724 + struct i3c_xfer *xfers, 725 + int nxfers, enum i3c_xfer_mode mode) 726 726 { 727 727 struct i3c_master_controller *m = i3c_dev_get_master(dev); 728 728 struct cdns_i3c_master *master = to_cdns_i3c_master(m); ··· 1519 1519 .detach_i2c_dev = cdns_i3c_master_detach_i2c_dev, 1520 1520 .supports_ccc_cmd = cdns_i3c_master_supports_ccc_cmd, 1521 1521 .send_ccc_cmd = cdns_i3c_master_send_ccc_cmd, 1522 - .priv_xfers = cdns_i3c_master_priv_xfers, 1522 + .i3c_xfers = cdns_i3c_master_i3c_xfers, 1523 1523 .i2c_xfers = cdns_i3c_master_i2c_xfers, 1524 1524 .enable_ibi = cdns_i3c_master_enable_ibi, 1525 1525 .disable_ibi = cdns_i3c_master_disable_ibi,
+4 -4
drivers/i3c/master/mipi-i3c-hci/core.c
··· 266 266 return hci->cmd->perform_daa(hci); 267 267 } 268 268 269 - static int i3c_hci_priv_xfers(struct i3c_dev_desc *dev, 270 - struct i3c_priv_xfer *i3c_xfers, 271 - int nxfers) 269 + static int i3c_hci_i3c_xfers(struct i3c_dev_desc *dev, 270 + struct i3c_xfer *i3c_xfers, int nxfers, 271 + enum i3c_xfer_mode mode) 272 272 { 273 273 struct i3c_master_controller *m = i3c_dev_get_master(dev); 274 274 struct i3c_hci *hci = to_i3c_hci(m); ··· 515 515 .bus_cleanup = i3c_hci_bus_cleanup, 516 516 .do_daa = i3c_hci_daa, 517 517 .send_ccc_cmd = i3c_hci_send_ccc_cmd, 518 - .priv_xfers = i3c_hci_priv_xfers, 518 + .i3c_xfers = i3c_hci_i3c_xfers, 519 519 .i2c_xfers = i3c_hci_i2c_xfers, 520 520 .attach_i3c_dev = i3c_hci_attach_i3c_dev, 521 521 .reattach_i3c_dev = i3c_hci_reattach_i3c_dev,
+3 -3
drivers/i3c/master/renesas-i3c.c
··· 794 794 return ret; 795 795 } 796 796 797 - static int renesas_i3c_priv_xfers(struct i3c_dev_desc *dev, struct i3c_priv_xfer *i3c_xfers, 798 - int i3c_nxfers) 797 + static int renesas_i3c_i3c_xfers(struct i3c_dev_desc *dev, struct i3c_xfer *i3c_xfers, 798 + int i3c_nxfers, enum i3c_xfer_mode mode) 799 799 { 800 800 struct i3c_master_controller *m = i3c_dev_get_master(dev); 801 801 struct renesas_i3c *i3c = to_renesas_i3c(m); ··· 1282 1282 .do_daa = renesas_i3c_daa, 1283 1283 .supports_ccc_cmd = renesas_i3c_supports_ccc_cmd, 1284 1284 .send_ccc_cmd = renesas_i3c_send_ccc_cmd, 1285 - .priv_xfers = renesas_i3c_priv_xfers, 1285 + .i3c_xfers = renesas_i3c_i3c_xfers, 1286 1286 .attach_i2c_dev = renesas_i3c_attach_i2c_dev, 1287 1287 .detach_i2c_dev = renesas_i3c_detach_i2c_dev, 1288 1288 .i2c_xfers = renesas_i3c_i2c_xfers,
+2 -10
include/linux/i3c/master.h
··· 417 417 * all CCC commands are supported. 418 418 * @send_ccc_cmd: send a CCC command 419 419 * This method is mandatory. 420 - * @priv_xfers: do one or several private I3C SDR transfers 421 - * This method is mandatory when i3c_xfers is not implemented. It 422 - * is deprecated. 423 - * @i3c_xfers: do one or several I3C SDR or HDR transfers 424 - * This method is mandatory when priv_xfers is not implemented but 425 - * should be implemented instead of priv_xfers. 420 + * @i3c_xfers: do one or several I3C SDR or HDR transfers. 421 + * This method is mandatory. 426 422 * @attach_i2c_dev: called every time an I2C device is attached to the bus. 427 423 * This is a good place to attach master controller specific 428 424 * data to I2C devices. ··· 474 478 const struct i3c_ccc_cmd *cmd); 475 479 int (*send_ccc_cmd)(struct i3c_master_controller *master, 476 480 struct i3c_ccc_cmd *cmd); 477 - /* Deprecated, please use i3c_xfers() */ 478 - int (*priv_xfers)(struct i3c_dev_desc *dev, 479 - struct i3c_priv_xfer *xfers, 480 - int nxfers); 481 481 int (*i3c_xfers)(struct i3c_dev_desc *dev, 482 482 struct i3c_xfer *xfers, 483 483 int nxfers, enum i3c_xfer_mode mode);