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

Configure Feed

Select the types of activity you want to include in your feed.

Match data improvements for ak4642 driver

Merge series from Biju Das <biju.das.jz@bp.renesas.com>:

This patch series aims to add match data improvements for ak4642 driver.

This patch series is only compile tested.

+7 -21
+7 -21
sound/soc/codecs/ak4642.c
··· 628 628 #define ak4642_of_parse_mcko(d) 0 629 629 #endif 630 630 631 - static const struct of_device_id ak4642_of_match[]; 632 - static const struct i2c_device_id ak4642_i2c_id[]; 633 631 static int ak4642_i2c_probe(struct i2c_client *i2c) 634 632 { 635 633 struct device *dev = &i2c->dev; 636 - struct device_node *np = dev->of_node; 637 - const struct ak4642_drvdata *drvdata = NULL; 634 + const struct ak4642_drvdata *drvdata; 638 635 struct regmap *regmap; 639 636 struct ak4642_priv *priv; 640 637 struct clk *mcko = NULL; 641 638 642 - if (np) { 643 - const struct of_device_id *of_id; 644 - 639 + if (dev_fwnode(dev)) { 645 640 mcko = ak4642_of_parse_mcko(dev); 646 641 if (IS_ERR(mcko)) 647 642 mcko = NULL; 648 - 649 - of_id = of_match_device(ak4642_of_match, dev); 650 - if (of_id) 651 - drvdata = of_id->data; 652 - } else { 653 - const struct i2c_device_id *id = 654 - i2c_match_id(ak4642_i2c_id, i2c); 655 - drvdata = (const struct ak4642_drvdata *)id->driver_data; 656 643 } 657 644 658 - if (!drvdata) { 659 - dev_err(dev, "Unknown device type\n"); 660 - return -EINVAL; 661 - } 645 + drvdata = i2c_get_match_data(i2c); 646 + if (!drvdata) 647 + return dev_err_probe(dev, -EINVAL, "Unknown device type\n"); 662 648 663 649 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); 664 650 if (!priv) ··· 667 681 { .compatible = "asahi-kasei,ak4642", .data = &ak4642_drvdata}, 668 682 { .compatible = "asahi-kasei,ak4643", .data = &ak4643_drvdata}, 669 683 { .compatible = "asahi-kasei,ak4648", .data = &ak4648_drvdata}, 670 - {}, 684 + {} 671 685 }; 672 686 MODULE_DEVICE_TABLE(of, ak4642_of_match); 673 687 ··· 675 689 { "ak4642", (kernel_ulong_t)&ak4642_drvdata }, 676 690 { "ak4643", (kernel_ulong_t)&ak4643_drvdata }, 677 691 { "ak4648", (kernel_ulong_t)&ak4648_drvdata }, 678 - { } 692 + {} 679 693 }; 680 694 MODULE_DEVICE_TABLE(i2c, ak4642_i2c_id); 681 695