diff --git a/projects/RPi/patches/linux/linux-01-RPi_support.patch b/projects/RPi/patches/linux/linux-01-RPi_support.patch index 34e42117fb..185ca794d2 100644 --- a/projects/RPi/patches/linux/linux-01-RPi_support.patch +++ b/projects/RPi/patches/linux/linux-01-RPi_support.patch @@ -1,7 +1,7 @@ -From 4d31e91165e50dab3ce5b4b78bc589d67bd70e0b Mon Sep 17 00:00:00 2001 +From c0ef8025df345a15d43f4c2dfc0e620d31bd733e Mon Sep 17 00:00:00 2001 From: Steve Glendinning Date: Thu, 19 Feb 2015 18:47:12 +0000 -Subject: [PATCH 001/173] smsx95xx: fix crimes against truesize +Subject: [PATCH 001/199] smsx95xx: fix crimes against truesize smsc95xx is adjusting truesize when it shouldn't, and following a recent patch from Eric this is now triggering warnings. @@ -48,10 +48,10 @@ index 340c13484e5cc7dd5001577b7522d5a4318bd5b6..7d3d98f0405ad948f9ab3e035a70e15c usbnet_skb_return(dev, ax_skb); } -From 54fc9336b4a858bf7833f4549f96b16e187192b2 Mon Sep 17 00:00:00 2001 +From 1c84c1665679fdd0068d7fed765386491a91ee49 Mon Sep 17 00:00:00 2001 From: Sam Nazarko Date: Fri, 1 Apr 2016 17:27:21 +0100 -Subject: [PATCH 002/173] smsc95xx: Experimental: Enable turbo_mode and +Subject: [PATCH 002/199] smsc95xx: Experimental: Enable turbo_mode and packetsize=2560 by default See: http://forum.kodi.tv/showthread.php?tid=285288 @@ -94,10 +94,10 @@ index 7d3d98f0405ad948f9ab3e035a70e15c667e4fa1..8d34e517db08d895e6135f785c42bf63 netif_dbg(dev, ifup, dev->net, "rx_urb_size=%ld\n", -From 9c3373c84a4a3740f9e502e256b6cf6b75499e53 Mon Sep 17 00:00:00 2001 +From 880434cf92735720f5cfc191266fe0fd5bc9cfb4 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 26 Mar 2013 17:26:38 +0000 -Subject: [PATCH 003/173] Allow mac address to be set in smsc95xx +Subject: [PATCH 003/199] Allow mac address to be set in smsc95xx Signed-off-by: popcornmix --- @@ -193,10 +193,10 @@ index 8d34e517db08d895e6135f785c42bf639671815c..5df7e105c41532c3185e46ee54f43a37 eth_hw_addr_random(dev->net); netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n"); -From 4733376458500aefc53f7bb02e16c6fd57439295 Mon Sep 17 00:00:00 2001 +From 2a79c6c02f4b2d233b9a601a57ede0e9f1f05e44 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 13 Mar 2015 12:43:36 +0000 -Subject: [PATCH 004/173] Protect __release_resource against resources without +Subject: [PATCH 004/199] Protect __release_resource against resources without parents Without this patch, removing a device tree overlay can crash here. @@ -224,10 +224,10 @@ index 9b5f04404152c296af3a96132f27cfc80ffa9af9..f8a9af6e6b915812be2ba2c1c2b40106 for (;;) { tmp = *p; -From 6ae5f9ee8ed27f0a0646a8949b27747a60df627e Mon Sep 17 00:00:00 2001 +From fb3ac3b9d01033534f532fcf381e6cd2897ff023 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 4 Dec 2015 17:41:50 +0000 -Subject: [PATCH 005/173] irq-bcm2836: Prevent spurious interrupts, and trap +Subject: [PATCH 005/199] irq-bcm2836: Prevent spurious interrupts, and trap them early The old arch-specific IRQ macros included a dsb to ensure the @@ -254,10 +254,10 @@ index e7463e3c08143acae3e8cc5682f918c6a0b07ebd..a8db33b50ad9ff83d284fa54fe4d3b65 #endif } else if (stat) { -From df9ca00f2536bd3c258fd212fbc50f0388ec0051 Mon Sep 17 00:00:00 2001 +From 8d744d7637c556d38d958112260ddbaa453407c7 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 9 Feb 2017 14:33:30 +0000 -Subject: [PATCH 006/173] irq-bcm2836: Avoid "Invalid trigger warning" +Subject: [PATCH 006/199] irq-bcm2836: Avoid "Invalid trigger warning" Initialise the level for each IRQ to avoid a warning from the arm arch timer code. @@ -281,10 +281,10 @@ index a8db33b50ad9ff83d284fa54fe4d3b65f859df0f..c4e151451cf8c8ebde5225515eac2786 static void -From 738c1a7eac3f687fc2e828be2ab02a173367afe3 Mon Sep 17 00:00:00 2001 +From f886f712e6b6fcd52f3d5e893080ae58a22211a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 12 Jun 2015 19:01:05 +0200 -Subject: [PATCH 007/173] irqchip: bcm2835: Add FIQ support +Subject: [PATCH 007/199] irqchip: bcm2835: Add FIQ support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -413,10 +413,10 @@ index 44d7c38dde479d771f3552e914bf8c1c1f5019f7..42ff5e6a8e0d532f5b60a1e7af7cc4d9 } -From 2088067b398e00f0fb16984d0723193853ebe910 Mon Sep 17 00:00:00 2001 +From 7c54bfb906c5315b85c947da06027c4c6bba309a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 23 Oct 2015 16:26:55 +0200 -Subject: [PATCH 008/173] irqchip: irq-bcm2835: Add 2836 FIQ support +Subject: [PATCH 008/199] irqchip: irq-bcm2835: Add 2836 FIQ support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -515,10 +515,10 @@ index 42ff5e6a8e0d532f5b60a1e7af7cc4d941bd5008..eccf6ed025299cb480884f5bcbe77abf for (b = 0; b < NR_BANKS; b++) { for (i = 0; i < bank_irqs[b]; i++) { -From 5f9a37381bb18029137e2d8e6c269a15586f82a8 Mon Sep 17 00:00:00 2001 +From 4627b248f0048227f7fcdf283d891bc1f67a431a Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 14 Jul 2015 10:26:09 +0100 -Subject: [PATCH 009/173] spidev: Add "spidev" compatible string to silence +Subject: [PATCH 009/199] spidev: Add "spidev" compatible string to silence warning See: https://github.com/raspberrypi/linux/issues/1054 @@ -539,10 +539,10 @@ index cda10719d1d1b21b32866d2b79363faa461ab8e1..4f3779d3aa0960640506725bde918075 }; MODULE_DEVICE_TABLE(of, spidev_dt_ids); -From da0f0b0a74f2827634a1914ac8fa0460a611d722 Mon Sep 17 00:00:00 2001 +From 697efaaf511abb4f49a2f02fc7616111196315db Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 3 Jan 2017 18:25:01 +0000 -Subject: [PATCH 010/173] Revert "pinctrl: bcm2835: switch to GPIOLIB_IRQCHIP" +Subject: [PATCH 010/199] Revert "pinctrl: bcm2835: switch to GPIOLIB_IRQCHIP" This reverts commit 85ae9e512f437cd09bf61564bdba29ab88bab3e3. --- @@ -841,10 +841,10 @@ index 230883168e99a1a3fecc7916ef0a7e0de7e8b3f1..ff3789a11b3c36b922b9d08035abb638 if (IS_ERR(pc->pctl_dev)) { gpiochip_remove(&pc->gpio_chip); -From 0c433b8e5412030ca229b85830abdda47c841eed Mon Sep 17 00:00:00 2001 +From 50667c5da8f225a498d1d8c0abc991bf96858cdd Mon Sep 17 00:00:00 2001 From: notro Date: Thu, 10 Jul 2014 13:59:47 +0200 -Subject: [PATCH 011/173] pinctrl-bcm2835: Set base to 0 give expected gpio +Subject: [PATCH 011/199] pinctrl-bcm2835: Set base to 0 give expected gpio numbering Signed-off-by: Noralf Tronnes @@ -866,10 +866,10 @@ index ff3789a11b3c36b922b9d08035abb638187c2f5a..d2b537572095c86576f78536f737c102 .can_sleep = false, }; -From d9319a075ad9a562fcd70597768b0f52d5c88a4e Mon Sep 17 00:00:00 2001 +From cfe2553b0cd96571188700b2f8316eb7036eca59 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 26 Feb 2015 09:58:22 +0000 -Subject: [PATCH 012/173] pinctrl-bcm2835: Only request the interrupts listed +Subject: [PATCH 012/199] pinctrl-bcm2835: Only request the interrupts listed in the DTB Although the GPIO controller can generate three interrupts (four counting @@ -896,10 +896,10 @@ index d2b537572095c86576f78536f737c102487f99f4..a9d480df32562defbf8be0faf0a39bfe pc->irq_data[i].irqgroup = i; -From 81ba2330c131e7da3bca1b59f01cd254d11d5fa4 Mon Sep 17 00:00:00 2001 +From 9dda59819c2cf3ca64ffc5a211be0ae9deddde13 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 24 Jun 2015 14:10:44 +0100 -Subject: [PATCH 013/173] spi-bcm2835: Support pin groups other than 7-11 +Subject: [PATCH 013/199] spi-bcm2835: Support pin groups other than 7-11 The spi-bcm2835 driver automatically uses GPIO chip-selects due to some unreliability of the native ones. In doing so it chooses the @@ -980,10 +980,10 @@ index f35cc10772f6670397ea923ad30158270dd68578..5dfe20ffc2866fa6789825016c585175 /* and set up the "mode" and level */ dev_info(&spi->dev, "setting up native-CS%i as GPIO %i\n", -From 26b6abf66e4e353b6d308fcf6d50e36053b16db0 Mon Sep 17 00:00:00 2001 +From 1857e16e50b7243664507bf679ff08961c1ff373 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 1 Jul 2016 22:09:24 +0100 -Subject: [PATCH 014/173] spi-bcm2835: Disable forced software CS +Subject: [PATCH 014/199] spi-bcm2835: Disable forced software CS Select software CS in bcm2708_common.dtsi, and disable the automatic conversion in the driver to allow hardware CS to be re-enabled with an @@ -1017,10 +1017,10 @@ index 5dfe20ffc2866fa6789825016c585175a29705b6..8493474d286f7a1ac6454a22c61c8c2c return 0; } -From f9164bc59cb04046bd40a67c7779b0cfc6075d5f Mon Sep 17 00:00:00 2001 +From d9ece314316906c6d8bd0faeb480d5f52f9f6be2 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 8 Nov 2016 21:35:38 +0000 -Subject: [PATCH 015/173] spi-bcm2835: Remove unused code +Subject: [PATCH 015/199] spi-bcm2835: Remove unused code --- drivers/spi/spi-bcm2835.c | 61 ----------------------------------------------- @@ -1108,10 +1108,10 @@ index 8493474d286f7a1ac6454a22c61c8c2cef9121bf..33d75ad38a7f77d085321ace9101900a } -From 6f25ff462e75767582fdace353a5408fe684ab04 Mon Sep 17 00:00:00 2001 +From 38d5debf709990dc093fa736d3ea722f699840ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Wed, 3 Jun 2015 12:26:13 +0200 -Subject: [PATCH 016/173] ARM: bcm2835: Set Serial number and Revision +Subject: [PATCH 016/199] ARM: bcm2835: Set Serial number and Revision MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -1164,10 +1164,10 @@ index 0c1edfc98696da0e0bb7f4a18cdfbcdd27a9795d..8f152266ba9b470df2eaaed9ebcf158e static const char * const bcm2835_compat[] = { -From de38cbe1a0cb31cc4fe4e0768dd0be0b92183907 Mon Sep 17 00:00:00 2001 +From ba48f8c54271772e424ed3e227bbd10a54a7d71b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sat, 3 Oct 2015 22:22:55 +0200 -Subject: [PATCH 017/173] dmaengine: bcm2835: Load driver early and support +Subject: [PATCH 017/199] dmaengine: bcm2835: Load driver early and support legacy API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -1270,10 +1270,10 @@ index 6204cc32d09c5096df8aec304c3c37b3bcb6be44..599c218dc8a73172dd4bd4a058fc8f95 MODULE_ALIAS("platform:bcm2835-dma"); MODULE_DESCRIPTION("BCM2835 DMA engine driver"); -From d7df3482e5e76edbf7f4d6847b8823cd1743535c Mon Sep 17 00:00:00 2001 +From 374f6c02f860169e156d21193ecd76057a398c17 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 25 Jan 2016 17:25:12 +0000 -Subject: [PATCH 018/173] firmware: Updated mailbox header +Subject: [PATCH 018/199] firmware: Updated mailbox header --- include/soc/bcm2835/raspberrypi-firmware.h | 9 +++++++++ @@ -1334,10 +1334,10 @@ index cb979ad90401e299344dd5fae38d09c489d8bd58..30fb37fe175df604a738258a2a632bca RPI_FIRMWARE_VCHIQ_INIT = 0x00048010, -From 8b0d445303d35756ce6bcc859ab12a70d589c291 Mon Sep 17 00:00:00 2001 +From 9c86b4bfa7f318bbbc55a8e055668d624cecc7b0 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 15 Jun 2016 16:48:41 +0100 -Subject: [PATCH 019/173] rtc: Add SPI alias for pcf2123 driver +Subject: [PATCH 019/199] rtc: Add SPI alias for pcf2123 driver Without this alias, Device Tree won't cause the driver to be loaded. @@ -1357,10 +1357,10 @@ index 8895f77726e8da5444afcd602dceff8f25a9b3fd..1833b8853ceb0e6147cceb93a00e558c MODULE_LICENSE("GPL"); +MODULE_ALIAS("spi:rtc-pcf2123"); -From d635eba91a9931609ed9295098d577eb01c3608e Mon Sep 17 00:00:00 2001 +From 9295b4da9ccbdb9d89ca5e29a9bbb488165ea787 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 7 Oct 2016 16:50:59 +0200 -Subject: [PATCH 020/173] watchdog: bcm2835: Support setting reboot partition +Subject: [PATCH 020/199] watchdog: bcm2835: Support setting reboot partition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -1462,10 +1462,10 @@ index b339e0e67b4c1275fd4992fea4f1e24c0575b783..26b7177573fac2af1cd4ab5488d2686f static int bcm2835_wdt_probe(struct platform_device *pdev) -From e011b348aadd95d8a1fe0169305a1e50ce1fc480 Mon Sep 17 00:00:00 2001 +From 174585be9597561522543fb1521ada01a893229d Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 5 Apr 2016 19:40:12 +0100 -Subject: [PATCH 021/173] reboot: Use power off rather than busy spinning when +Subject: [PATCH 021/199] reboot: Use power off rather than busy spinning when halt is requested --- @@ -1488,10 +1488,10 @@ index 3b2aa9a9fe268d45335f781c4aa22cf573753a1b..0180d89a34af45c56243fe0f17fbe209 /* -From 4b568920b166692346db6adf3a8aa94a76b5a0ed Mon Sep 17 00:00:00 2001 +From 3bac0c145da630d2d6d59d2c32ce3f4a79cd2b09 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 9 Nov 2016 13:02:52 +0000 -Subject: [PATCH 022/173] bcm: Make RASPBERRYPI_POWER depend on PM +Subject: [PATCH 022/199] bcm: Make RASPBERRYPI_POWER depend on PM --- drivers/soc/bcm/Kconfig | 1 + @@ -1510,10 +1510,10 @@ index 49f1e2a75d614bc21db152327c7b425ae2504f8d..dccd2374ed00631abd441e3e9d78ee74 help This enables support for the RPi power domains which can be enabled -From bb1668bb395ef4cc0ece7b7ac18fbfa7b7c5b642 Mon Sep 17 00:00:00 2001 +From 1bcc04b9c2cb5a2a72ab16da5f92cccd020c1878 Mon Sep 17 00:00:00 2001 From: Martin Sperl Date: Fri, 2 Sep 2016 16:45:27 +0100 -Subject: [PATCH 023/173] Register the clocks early during the boot process, so +Subject: [PATCH 023/199] Register the clocks early during the boot process, so that special/critical clocks can get enabled early on in the boot process avoiding the risk of disabling a clock, pll_divider or pll when a claiming driver fails to install propperly - maybe it needs to defer. @@ -1558,10 +1558,10 @@ index 58ce6af8452db9ca8b4d3c380a06e448919f6a8d..11d89d106026f15719ea25047d6f357b MODULE_AUTHOR("Eric Anholt "); MODULE_DESCRIPTION("BCM2835 clock driver"); -From 198027c8f72b1c11e435eddf7c81e02dde1ec2aa Mon Sep 17 00:00:00 2001 +From 7fa1fcb860062fb2edc75665992d5bcd553cc98e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 6 Dec 2016 17:05:39 +0000 -Subject: [PATCH 024/173] bcm2835-rng: Avoid initialising if already enabled +Subject: [PATCH 024/199] bcm2835-rng: Avoid initialising if already enabled Avoids the 0x40000 cycles of warmup again if firmware has already used it --- @@ -1587,10 +1587,10 @@ index 574211a495491d9d6021dcaefe4274a63ed02055..e66c0fca8c6090e32f72796c0877a1cf err = hwrng_register(&bcm2835_rng_ops); if (err) { -From 1b4b16d21a4bcf96dc625ad9444c69c28eeef072 Mon Sep 17 00:00:00 2001 +From dc515006b6bb6fb26b41b3ba3ca2cc770c6c1c34 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 24 Aug 2016 16:28:44 +0100 -Subject: [PATCH 025/173] kbuild: Ignore dtco targets when filtering symbols +Subject: [PATCH 025/199] kbuild: Ignore dtco targets when filtering symbols --- scripts/Kbuild.include | 2 +- @@ -1610,10 +1610,10 @@ index 9ffd3dda3889c56a7a72229bed21ff5c49d62856..00da6c9bacbf33334233e22ca5209ade esac | tr ";" "\n" | sed -rn 's/^.*=== __KSYM_(.*) ===.*$$/KSYM_\1/p' -From 1b013838bed35a7ba38be239e8590414ab5bfa08 Mon Sep 17 00:00:00 2001 +From cb7635c5281e962458b556d22b496b5b682600df Mon Sep 17 00:00:00 2001 From: Robert Tiemann Date: Mon, 20 Jul 2015 11:01:25 +0200 -Subject: [PATCH 026/173] BCM2835_DT: Fix I2S register map +Subject: [PATCH 026/199] BCM2835_DT: Fix I2S register map --- Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt | 4 ++-- @@ -1651,10 +1651,10 @@ index 65783de0aedf3da79adc36fd077b7a89954ddb6b..a89fe4220fdc3f26f75ee66daf187554 dmas = <&dma 2>, <&dma 3>; -From 3541d2299cb53a29213bd9a653fa4c4c636a251c Mon Sep 17 00:00:00 2001 +From 262f5378b7353bcfb20578e70573cd71f5e44ef7 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 13 Feb 2017 17:20:08 +0000 -Subject: [PATCH 027/173] clk-bcm2835: Mark used PLLs and dividers CRITICAL +Subject: [PATCH 027/199] clk-bcm2835: Mark used PLLs and dividers CRITICAL The VPU configures and relies on several PLLs and dividers. Mark all enabled dividers and their PLLs as CRITICAL to prevent the kernel from @@ -1682,10 +1682,10 @@ index 11d89d106026f15719ea25047d6f357b4bfcb2c5..fe8f5d65f2749cb3ddc878df61664826 divider->data = data; -From ef265510cf7bcb062ecf5026e9d916ef0ab58dd4 Mon Sep 17 00:00:00 2001 +From a685d676e7f8b10189e7b2dd95a52bf62b1a22df Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 13 Feb 2017 17:20:08 +0000 -Subject: [PATCH 028/173] clk-bcm2835: Add claim-clocks property +Subject: [PATCH 028/199] clk-bcm2835: Add claim-clocks property The claim-clocks property can be used to prevent PLLs and dividers from being marked as critical. It contains a vector of clock IDs, @@ -1787,10 +1787,10 @@ index fe8f5d65f2749cb3ddc878df616648267441e0ee..92b5e0f5145b32d3bfc3592fe381e8be sizeof(cprman_parent_names)); of_clk_parent_fill(dev->of_node, cprman->real_parent_names, -From b0cd805d9a43ad2112f2cb57ac6e417b3d7423b1 Mon Sep 17 00:00:00 2001 +From 6d889451f7cb79e35ab73ea54e92be3bc763c838 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 6 Mar 2017 09:06:18 +0000 -Subject: [PATCH 029/173] clk-bcm2835: Read max core clock from firmware +Subject: [PATCH 029/199] clk-bcm2835: Read max core clock from firmware The VPU is responsible for managing the core clock, usually under direction from the bcm2835-cpufreq driver but not via the clk-bcm2835 @@ -1905,10 +1905,10 @@ index 92b5e0f5145b32d3bfc3592fe381e8be3cd90c72..336f8c9c44325d0a94e591a8557f7af2 for (i = 0; !of_property_read_u32_index(pdev->dev.of_node, "claim-clocks", -From d61da4f3762793e7d7a28dd51ca8505110f679ba Mon Sep 17 00:00:00 2001 +From 9ce26bedac45240e0f26c06a2740e667e696a23c Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 9 Feb 2017 14:36:44 +0000 -Subject: [PATCH 030/173] sound: Demote deferral errors to INFO level +Subject: [PATCH 030/199] sound: Demote deferral errors to INFO level At present there is no mechanism to specify driver load order, which can lead to deferrals and repeated retries until successful. @@ -1943,10 +1943,10 @@ index 13c875e2392a40ec5651d7c12a28b9ac9f3aab85..23d56057e49b5ff6b6c3c352c150fee8 goto _err_defer; } -From f933329702240c201e0b4e4fbc18243d2e81f144 Mon Sep 17 00:00:00 2001 +From cad06a693f80f570ddf05c15350a9b64207ae480 Mon Sep 17 00:00:00 2001 From: Claggy3 Date: Sat, 11 Feb 2017 14:00:30 +0000 -Subject: [PATCH 031/173] Update vfpmodule.c +Subject: [PATCH 031/199] Update vfpmodule.c Christopher Alexander Tobias Schulze - May 2, 2015, 11:57 a.m. This patch fixes a problem with VFP state save and restore related @@ -2083,10 +2083,10 @@ index a71a48e71fffa8626fe90106815376c44bbe679b..d6c0a5a0a5ae3510db3ace5e3f5d3410 /* * Save the userland NEON/VFP state. Under UP, -From 281224342f791bcaa650dd6112a313ce76b13f92 Mon Sep 17 00:00:00 2001 +From e0be6e1b8715ebc9527155fbc68e9c05abf9bd6d Mon Sep 17 00:00:00 2001 From: Matt Flax Date: Wed, 8 Mar 2017 21:13:24 +1100 -Subject: [PATCH 032/173] ASoC: bcm2835_i2s.c: relax the ch2 register setting +Subject: [PATCH 032/199] ASoC: bcm2835_i2s.c: relax the ch2 register setting for 8 channels This patch allows ch2 registers to be set for 8 channels of audio. @@ -2107,10 +2107,10 @@ index 6ba20498202ed36906b52096893a88867a79269f..56df7d8a43d0aac055a91b0d24aca8e1 format |= BCM2835_I2S_CH1(BCM2835_I2S_CHPOS(ch1pos)); format |= BCM2835_I2S_CH2(BCM2835_I2S_CHPOS(ch2pos)); -From 1d225fa894026b0a705f35363b18fed51fd6b977 Mon Sep 17 00:00:00 2001 +From 060a1edd625429eb91e89dbbb414ecd048bdb8e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Tue, 1 Nov 2016 15:15:41 +0100 -Subject: [PATCH 033/173] i2c: bcm2835: Add debug support +Subject: [PATCH 033/199] i2c: bcm2835: Add debug support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -2299,10 +2299,10 @@ index cd07a69e2e9355540442785f95e90823b05c9d10..47167f403cc8329bd811b47c7011c299 if (i2c_dev->msg_err & BCM2835_I2C_S_ERR) return -EREMOTEIO; -From 4f96629b6c09bc6d99e205e145e8398611183658 Mon Sep 17 00:00:00 2001 +From c7a3bb4ffdf4611b3a0939b79ac3e2c2d312381d Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 12 May 2013 12:24:19 +0100 -Subject: [PATCH 034/173] Main bcm2708/bcm2709 linux port +Subject: [PATCH 034/199] Main bcm2708/bcm2709 linux port MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -2490,10 +2490,10 @@ index cfb4b4496dd9f61362dea012176c146120fada07..d9c6c217c4d6a2408abe2665bf7f2700 MODULE_AUTHOR("Lubomir Rintel "); MODULE_DESCRIPTION("BCM2835 mailbox IPC driver"); -From 2cf89e248c1f9d4fe0cbc6721141d9aadd427187 Mon Sep 17 00:00:00 2001 +From ce7638012ddc3277b86c82a7c0b7096b91fdf6dd Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 May 2013 19:46:17 +0100 -Subject: [PATCH 035/173] Add dwc_otg driver +Subject: [PATCH 035/199] Add dwc_otg driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -63635,10 +63635,10 @@ index 0000000000000000000000000000000000000000..cdc9963176e5a4a0d5250613b61e26c5 +test_main(); +0; -From a40d36f39959c4f362ac2358c81a024725e44f94 Mon Sep 17 00:00:00 2001 +From 4ca9284f269d7a605e7e4f547309668bcf8f9b4c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 17 Jun 2015 17:06:34 +0100 -Subject: [PATCH 036/173] bcm2708 framebuffer driver +Subject: [PATCH 036/199] bcm2708 framebuffer driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -67097,10 +67097,10 @@ index 3c14e43b82fefe1d32f591d1b2f61d2cd28d0fa8..7626beb6a5bb8df601ddf0f6e6909d1f +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 -From 1753129c47da9aadf7041d176407003fc466d9df Mon Sep 17 00:00:00 2001 +From 278b0bc44b4fc7ebfbc23c479d3aaa328af07795 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 14:22:53 +0100 -Subject: [PATCH 037/173] dmaengine: Add support for BCM2708 +Subject: [PATCH 037/199] dmaengine: Add support for BCM2708 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -67731,10 +67731,10 @@ index 0000000000000000000000000000000000000000..c5bfff2765be4606077e6c8af73040ec + +#endif /* _PLAT_BCM2708_DMA_H */ -From c9c5b3c903a77dbef477d199e2a5916d056fe4ed Mon Sep 17 00:00:00 2001 +From c2490058d14f3bc40a41ccd80be9da800bc9f31d Mon Sep 17 00:00:00 2001 From: gellert Date: Fri, 15 Aug 2014 16:35:06 +0100 -Subject: [PATCH 038/173] MMC: added alternative MMC driver +Subject: [PATCH 038/199] MMC: added alternative MMC driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -69456,10 +69456,10 @@ index 0000000000000000000000000000000000000000..4fe8d1fe44578fbefcd48f8c327ba3d0 +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Gellert Weisz"); -From 7c111fc21e11126c810c8dd325ae4334bd54b9b2 Mon Sep 17 00:00:00 2001 +From be2f4cc3a33dc133234a2bb7553652ee95ce5cf3 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 25 Mar 2015 17:49:47 +0000 -Subject: [PATCH 039/173] Adding bcm2835-sdhost driver, and an overlay to +Subject: [PATCH 039/199] Adding bcm2835-sdhost driver, and an overlay to enable it BCM2835 has two SD card interfaces. This driver uses the other one. @@ -71865,10 +71865,10 @@ index 0000000000000000000000000000000000000000..9c6f199a7830959f31012d86bc1f8b1a +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Phil Elwell"); -From ea3ad2b086d049e17be572c35e6c5bba86ebe6e4 Mon Sep 17 00:00:00 2001 +From d2a80e57c13c2c153b7e8b8dba361c1b8692ba1a Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 28 Oct 2016 15:36:43 +0100 -Subject: [PATCH 040/173] vc_mem: Add vc_mem driver for querying firmware +Subject: [PATCH 040/199] vc_mem: Add vc_mem driver for querying firmware memory addresses MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -72393,10 +72393,10 @@ index 0000000000000000000000000000000000000000..20a475377eb3078ea1ecaef2b24efc35 + +#endif /* _VC_MEM_H */ -From 5d1c473f557525d28a8b9f4a29330f6d8b746a1f Mon Sep 17 00:00:00 2001 +From 84929fb2f82a7f5b0a2fbe12617a665196f8599b Mon Sep 17 00:00:00 2001 From: Tim Gover Date: Tue, 22 Jul 2014 15:41:04 +0100 -Subject: [PATCH 041/173] vcsm: VideoCore shared memory service for BCM2835 +Subject: [PATCH 041/199] vcsm: VideoCore shared memory service for BCM2835 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -76851,10 +76851,10 @@ index 0000000000000000000000000000000000000000..334f36d0d697b047df2922b5f2db67f3 + +#endif /* __VMCS_SM_IOCTL_H__INCLUDED__ */ -From 7b75205c2cd9672a52e657b0075ffa7355bf5093 Mon Sep 17 00:00:00 2001 +From cc56debc252777c1212638269c1b22702e66e575 Mon Sep 17 00:00:00 2001 From: Luke Wren Date: Fri, 21 Aug 2015 23:14:48 +0100 -Subject: [PATCH 042/173] Add /dev/gpiomem device for rootless user GPIO access +Subject: [PATCH 042/199] Add /dev/gpiomem device for rootless user GPIO access Signed-off-by: Luke Wren @@ -77162,10 +77162,10 @@ index 0000000000000000000000000000000000000000..f5e7f1ba8fb6f18dee77fad06a17480c +MODULE_DESCRIPTION("gpiomem driver for accessing GPIO from userspace"); +MODULE_AUTHOR("Luke Wren "); -From 2c20cabf60049a431c4946d2c8bbbd940dc43355 Mon Sep 17 00:00:00 2001 +From 49a86dca3ebee1a82de6e6926eda0073c63b6679 Mon Sep 17 00:00:00 2001 From: Luke Wren Date: Sat, 5 Sep 2015 01:14:45 +0100 -Subject: [PATCH 043/173] Add SMI driver +Subject: [PATCH 043/199] Add SMI driver Signed-off-by: Luke Wren --- @@ -79116,10 +79116,10 @@ index 0000000000000000000000000000000000000000..ee3a75edfc033eeb0d90a687ffb68b10 + +#endif /* BCM2835_SMI_H */ -From 674631fb6af7dc61e7c2d2d9b50d96e29b46a72a Mon Sep 17 00:00:00 2001 +From c8ba2948c4be512930cac3e5b91747c12db1da59 Mon Sep 17 00:00:00 2001 From: Martin Sperl Date: Tue, 26 Apr 2016 14:59:21 +0000 -Subject: [PATCH 044/173] MISC: bcm2835: smi: use clock manager and fix reload +Subject: [PATCH 044/199] MISC: bcm2835: smi: use clock manager and fix reload issues Use clock manager instead of self-made clockmanager. @@ -79289,10 +79289,10 @@ index 63a4ea08b9930a3a31a985f0a1d969b488ed49ec..1261540703127d1d63b9f3c87042c6e5 return 0; } -From 437fba9ae6f282ea8d2fd7e568358f529640e222 Mon Sep 17 00:00:00 2001 +From af1adb0b5369053c77b970fd26d894d1d1e42f24 Mon Sep 17 00:00:00 2001 From: Luke Wren Date: Sat, 5 Sep 2015 01:16:10 +0100 -Subject: [PATCH 045/173] Add SMI NAND driver +Subject: [PATCH 045/199] Add SMI NAND driver Signed-off-by: Luke Wren --- @@ -79657,10 +79657,10 @@ index 0000000000000000000000000000000000000000..02adda6da18bd0ba9ab19a104975b79d + ("Driver for NAND chips using Broadcom Secondary Memory Interface"); +MODULE_AUTHOR("Luke Wren "); -From 2ac4a21d9ef42dd54a9e532cffef4cac2ee31750 Mon Sep 17 00:00:00 2001 +From 3f10836ba73c3243ce82d4db696aebbdf1e8062e Mon Sep 17 00:00:00 2001 From: Aron Szabo Date: Sat, 16 Jun 2012 12:15:55 +0200 -Subject: [PATCH 046/173] lirc: added support for RaspberryPi GPIO +Subject: [PATCH 046/199] lirc: added support for RaspberryPi GPIO lirc_rpi: Use read_current_timer to determine transmitter delay. Thanks to jjmz and others See: https://github.com/raspberrypi/linux/issues/525 @@ -80520,10 +80520,10 @@ index 0000000000000000000000000000000000000000..fb69624ccef00ddbdccf8256d6baf1b1 + +#endif -From 751fe8b7692ced63db9d9e88a5e079ca9f3f632b Mon Sep 17 00:00:00 2001 +From b19b4f31feb4344c91b7a7a8fe2b865f26a235a0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:49:20 +0100 -Subject: [PATCH 047/173] Add cpufreq driver +Subject: [PATCH 047/199] Add cpufreq driver Signed-off-by: popcornmix --- @@ -80790,10 +80790,10 @@ index 0000000000000000000000000000000000000000..414fbdc10dfbfc6e4bb47870a7af3fd5 +module_init(bcm2835_cpufreq_module_init); +module_exit(bcm2835_cpufreq_module_exit); -From 5ce7c9c8296f76830f0674046a97234e5a8c66e4 Mon Sep 17 00:00:00 2001 +From 08d5cb79d90de584c1c50b0105b9b09201722ae6 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 17 Jun 2015 15:44:08 +0100 -Subject: [PATCH 048/173] Add Chris Boot's i2c driver +Subject: [PATCH 048/199] Add Chris Boot's i2c driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -81458,10 +81458,10 @@ index 0000000000000000000000000000000000000000..962f2e5c7455d91bf32925d785f5f16b +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:" DRV_NAME); -From 15fbd36ded7f781a25e607281877489e64d157b9 Mon Sep 17 00:00:00 2001 +From a986279e4623e0ea9fa652445ee4be39081f31cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 26 Jun 2015 14:27:06 +0200 -Subject: [PATCH 049/173] char: broadcom: Add vcio module +Subject: [PATCH 049/199] char: broadcom: Add vcio module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -81686,10 +81686,10 @@ index 0000000000000000000000000000000000000000..c19bc2075c77879563ef5e59038b5a14 +MODULE_DESCRIPTION("Mailbox userspace access"); +MODULE_LICENSE("GPL"); -From 4d25c2b0be3edd7396a0b22a2e793c32a31e9f49 Mon Sep 17 00:00:00 2001 +From 8ee90476cff1615c2cbb26b5ebfe609e4d6f149d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 26 Jun 2015 14:25:01 +0200 -Subject: [PATCH 050/173] firmware: bcm2835: Support ARCH_BCM270x +Subject: [PATCH 050/199] firmware: bcm2835: Support ARCH_BCM270x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -81772,10 +81772,10 @@ index dd506cd3a5b874f9e1acd07efb8cd151bb6145d1..3f070bd38a91511c986e3fb114b15bd4 MODULE_AUTHOR("Eric Anholt "); MODULE_DESCRIPTION("Raspberry Pi firmware driver"); -From 121799ce3c68fd5c4982dab632114b83ef46f27d Mon Sep 17 00:00:00 2001 +From bca807b5aaf5a51bbe552b128d0e1f7da0b9ca80 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 11 May 2015 09:00:42 +0100 -Subject: [PATCH 051/173] scripts: Add mkknlimg and knlinfo scripts from tools +Subject: [PATCH 051/199] scripts: Add mkknlimg and knlinfo scripts from tools repo The Raspberry Pi firmware looks for a trailer on the kernel image to @@ -82302,10 +82302,10 @@ index 0000000000000000000000000000000000000000..84be2593ec1de8f97b0167ff06b3e05d + return $trailer; +} -From a5e82c204eb88de5fa9f1ea33cf39bf57f28c09b Mon Sep 17 00:00:00 2001 +From 28c36d896d2fde6815cbe6a644c8e5d6c0e4f518 Mon Sep 17 00:00:00 2001 From: notro Date: Wed, 9 Jul 2014 14:46:08 +0200 -Subject: [PATCH 052/173] BCM2708: Add core Device Tree support +Subject: [PATCH 052/199] BCM2708: Add core Device Tree support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -93750,10 +93750,10 @@ index 58c05e5d9870b6c18a72da7dc44ff3112994946d..9842523b225a88505d796cc689c04f40 # Bzip2 -From 6b4c72c0307a6de6dda6ffae1eae88bf174ccd52 Mon Sep 17 00:00:00 2001 +From 254e07fa77675b31244fb9a84bf4a2c423fa8a30 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 6 Feb 2015 13:50:57 +0000 -Subject: [PATCH 053/173] BCM270x_DT: Add pwr_led, and the required "input" +Subject: [PATCH 053/199] BCM270x_DT: Add pwr_led, and the required "input" trigger The "input" trigger makes the associated GPIO an input. This is to support @@ -93928,10 +93928,10 @@ index 64c56d454f7df9f864a5242ce4212df586f66886..3fd74c8737871cb56f0355c858fc135e /* set_brightness_work / blink_timer flags, atomic, private. */ unsigned long work_flags; -From d1c26c42c63b3606fd7951c008b83864621ffc3f Mon Sep 17 00:00:00 2001 +From 87d1f0938731dbcb98ec31c6b6d4246d4533a5cd Mon Sep 17 00:00:00 2001 From: Siarhei Siamashka Date: Mon, 17 Jun 2013 13:32:11 +0300 -Subject: [PATCH 054/173] fbdev: add FBIOCOPYAREA ioctl +Subject: [PATCH 054/199] fbdev: add FBIOCOPYAREA ioctl Based on the patch authored by Ali Gholami Rudi at https://lkml.org/lkml/2009/7/13/153 @@ -94199,10 +94199,10 @@ index fb795c3b3c178ad3cd7c9e9e4547ffd492bac181..703fa8a70574323abe2fb32599254582 __u32 dx; /* screen-relative */ __u32 dy; -From 9c7384a03b7b1f487a69293d8dc3b1a3b70ddb9d Mon Sep 17 00:00:00 2001 +From 6916b81b798eefd9ceb95eb50627117608b4f451 Mon Sep 17 00:00:00 2001 From: Harm Hanemaaijer Date: Thu, 20 Jun 2013 20:21:39 +0200 -Subject: [PATCH 055/173] Speed up console framebuffer imageblit function +Subject: [PATCH 055/199] Speed up console framebuffer imageblit function Especially on platforms with a slower CPU but a relatively high framebuffer fill bandwidth, like current ARM devices, the existing @@ -94411,10 +94411,10 @@ index a2bb276a8b2463eee98eb237c4647bc00cd93601..436494fba15abecb400ef28688466faf start_index, pitch_index); } else -From d0718fee7b3a522e9660f108423528f001c88049 Mon Sep 17 00:00:00 2001 +From 707c7c4548d85e7d7dce820fa46529843408545a Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 8 May 2013 11:46:50 +0100 -Subject: [PATCH 056/173] enabling the realtime clock 1-wire chip DS1307 and +Subject: [PATCH 056/199] enabling the realtime clock 1-wire chip DS1307 and 1-wire on GPIO4 (as a module) 1-wire: Add support for configuring pin for w1-gpio kernel module @@ -94664,10 +94664,10 @@ index 90cbe7e65059f6b604a87c6bf39cd9bbeae7684c..a52be51ee0a5511a75d4eaa8dacaec5e u8, w1_slave_found_callback); }; -From be35652a05671e3011baea91e94db18e7ea6a384 Mon Sep 17 00:00:00 2001 +From e41ab7ae06a93ef0c4b78d14bcb8e82c5b947e28 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 14 Jul 2014 22:02:09 +0100 -Subject: [PATCH 057/173] hid: Reduce default mouse polling interval to 60Hz +Subject: [PATCH 057/199] hid: Reduce default mouse polling interval to 60Hz Reduces overhead when using X --- @@ -94699,10 +94699,10 @@ index c008847e0b20a2accb00451b10fb1c648f67925b..4a86428a3b4e3d51e9ac6ce9c9c11097 break; case HID_GD_JOYSTICK: -From 2ed02be91b7155dbe5d0c0a850bf761d8150806a Mon Sep 17 00:00:00 2001 +From cdda900d07b28dbb9345b916861252ca167b6b1e Mon Sep 17 00:00:00 2001 From: Gordon Hollingworth Date: Tue, 12 May 2015 14:47:56 +0100 -Subject: [PATCH 058/173] rpi-ft5406: Add touchscreen driver for pi LCD display +Subject: [PATCH 058/199] rpi-ft5406: Add touchscreen driver for pi LCD display Fix driver detection failure Check that the buffer response is non-zero meaning the touchscreen was detected @@ -95060,10 +95060,10 @@ index 30fb37fe175df604a738258a2a632bca3bfff33f..4a3d79d3b48eb483a4e4bf498f617515 RPI_FIRMWARE_FRAMEBUFFER_SET_BACKLIGHT = 0x0004800f, -From 9c0b94406c5c1ec11a41bf9b2710051c36ce70e8 Mon Sep 17 00:00:00 2001 +From 760ef6fcb57abe6a1db43c38efd8bfd881f4b632 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 28 Nov 2016 16:50:04 +0000 -Subject: [PATCH 059/173] Improve __copy_to_user and __copy_from_user +Subject: [PATCH 059/199] Improve __copy_to_user and __copy_from_user performance Provide a __copy_from_user that uses memcpy. On BCM2708, use @@ -96638,10 +96638,10 @@ index 17ec37811c32f09126ed42753037e055c5cec115..c08f81812d0d56a0d90c1eb6777d0622 bool "Broadcom BCM63xx DSL SoC" depends on ARCH_MULTI_V7 -From 348a5e09f4bb1417fe37049c1334664d6dc4b5f3 Mon Sep 17 00:00:00 2001 +From d6b095b294a15dc298cc4f5e6d2a91be5e040486 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 25 Jun 2015 12:16:11 +0100 -Subject: [PATCH 060/173] gpio-poweroff: Allow it to work on Raspberry Pi +Subject: [PATCH 060/199] gpio-poweroff: Allow it to work on Raspberry Pi The Raspberry Pi firmware manages the power-down and reboot process. To do this it installs a pm_power_off handler, causing @@ -96676,10 +96676,10 @@ index be3d81ff51cc3f510d85e4eed7a52960e51e7bc1..a030ae9fb1fca325061c093696e82186 "%s: pm_power_off function already registered", __func__); -From 90f2efe61b9ba3c4a3bb0aed6c5aa76484b6d899 Mon Sep 17 00:00:00 2001 +From 25251ff87ca45c92a7c74e68587ba96e8ccd7d70 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 14 Jul 2015 14:32:47 +0100 -Subject: [PATCH 061/173] mfd: Add Raspberry Pi Sense HAT core driver +Subject: [PATCH 061/199] mfd: Add Raspberry Pi Sense HAT core driver --- drivers/input/joystick/Kconfig | 8 + @@ -97544,10 +97544,10 @@ index 0000000000000000000000000000000000000000..56196dc2af10e464a1e3f98b028dca1c + +#endif -From 0d38f30ad88b8ad88309340e9171341ce8e98831 Mon Sep 17 00:00:00 2001 +From 8601452700f05c77b2368b01dac0db7721b0390f Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 19:19:08 +0100 -Subject: [PATCH 062/173] ASoC: Add support for HifiBerry DAC +Subject: [PATCH 062/199] ASoC: Add support for HifiBerry DAC This adds a machine driver for the HifiBerry DAC. It is a sound card that can @@ -97722,10 +97722,10 @@ index 0000000000000000000000000000000000000000..ee9f133953544629282631e5ef3f73fe +MODULE_DESCRIPTION("ASoC Driver for HifiBerry DAC"); +MODULE_LICENSE("GPL v2"); -From 95d9c85a641399f9d3a569db4ea02029f9bf12c8 Mon Sep 17 00:00:00 2001 +From 281166ab55ccc24f9eeb7b72a2ecfdd580d37b3a Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Mon, 25 Jan 2016 15:48:59 +0000 -Subject: [PATCH 063/173] ASoC: Add support for Rpi-DAC +Subject: [PATCH 063/199] ASoC: Add support for Rpi-DAC --- sound/soc/bcm/Kconfig | 7 +++ @@ -98009,10 +98009,10 @@ index 0000000000000000000000000000000000000000..afe1b419582aa40c4b2729d242bb13cd +MODULE_AUTHOR("Florian Meier "); +MODULE_LICENSE("GPL v2"); -From 9fc26baae7c35ba5d07b9a95827d3228680c0705 Mon Sep 17 00:00:00 2001 +From de08c6cbae3e35f1b3c77836cc3b740394e002b1 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Wed, 15 Jan 2014 21:41:23 +0100 -Subject: [PATCH 064/173] ASoC: wm8804: Implement MCLK configuration options, +Subject: [PATCH 064/199] ASoC: wm8804: Implement MCLK configuration options, add 32bit support WM8804 can run with PLL frequencies of 256xfs and 128xfs for most sample rates. At 192kHz only 128xfs is supported. The existing driver selects 128xfs automatically for some lower samples rates. By using an @@ -98061,10 +98061,10 @@ index af95d648265b3e92e345101542b332aee35191d4..513f56ba132929662802d15cdc653af3 .component_driver = { .dapm_widgets = wm8804_dapm_widgets, -From 37aa9704aff6efd6cb8c9593dab934a0896efa7b Mon Sep 17 00:00:00 2001 +From c4c4c2def63057e2a10cb563db6ad37d400d680c Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Wed, 15 Jan 2014 21:42:08 +0100 -Subject: [PATCH 065/173] ASoC: BCM:Add support for HiFiBerry Digi. Driver is +Subject: [PATCH 065/199] ASoC: BCM:Add support for HiFiBerry Digi. Driver is based on the patched WM8804 driver. Signed-off-by: Daniel Matuschek @@ -98408,10 +98408,10 @@ index 0000000000000000000000000000000000000000..7620dd02de40b6d644ff038b445d375d +MODULE_DESCRIPTION("ASoC Driver for HifiBerry Digi"); +MODULE_LICENSE("GPL v2"); -From 133a00f5a6cd57787cca59ab2f7913ba5e362517 Mon Sep 17 00:00:00 2001 +From cc8c37ea04c575b57ef52345c5959ade7ffef299 Mon Sep 17 00:00:00 2001 From: Gordon Garrity Date: Sat, 8 Mar 2014 16:56:57 +0000 -Subject: [PATCH 066/173] Add IQaudIO Sound Card support for Raspberry Pi +Subject: [PATCH 066/199] Add IQaudIO Sound Card support for Raspberry Pi Set a limit of 0dB on Digital Volume Control @@ -98746,10 +98746,10 @@ index 0000000000000000000000000000000000000000..1ee4097c846376666775272ed692ca33 +MODULE_DESCRIPTION("ASoC Driver for IQAudio DAC"); +MODULE_LICENSE("GPL v2"); -From b87d532365fca2082ac3b45e057010e60eb09bf9 Mon Sep 17 00:00:00 2001 +From 0688bcd09c8d89959ca4974fcd57d5e32f2818b0 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Mon, 4 Aug 2014 10:06:56 +0200 -Subject: [PATCH 067/173] Added support for HiFiBerry DAC+ +Subject: [PATCH 067/199] Added support for HiFiBerry DAC+ The driver is based on the HiFiBerry DAC driver. However HiFiBerry DAC+ uses a different codec chip (PCM5122), therefore a new driver is necessary. @@ -99379,10 +99379,10 @@ index 72b19e62f6267698aea45d2410d616d91c1825cb..c6839ef6e16754ed9de2698507b8986a dev_err(dev, "No LRCLK?\n"); return -EINVAL; -From 563426f03b8ebee2e70b8b1d0027329348b5d05c Mon Sep 17 00:00:00 2001 +From 61b6a93d26d82226bc51b7a0e56e78d1b95d8ac3 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Mon, 4 Aug 2014 11:09:58 +0200 -Subject: [PATCH 068/173] Added driver for HiFiBerry Amp amplifier add-on board +Subject: [PATCH 068/199] Added driver for HiFiBerry Amp amplifier add-on board The driver contains a low-level hardware driver for the TAS5713 and the drivers for the Raspberry Pi I2S subsystem. @@ -100217,10 +100217,10 @@ index 0000000000000000000000000000000000000000..8f019e04898754d2f87e9630137be9e8 + +#endif /* _TAS5713_H */ -From 554deb30893bb040bd210b2caf2cf4011b85acfd Mon Sep 17 00:00:00 2001 +From 443e7d0bca07aee073c197d5429cc7a6c20da529 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Wed, 25 Mar 2015 09:26:17 +0100 -Subject: [PATCH 069/173] Add driver for rpi-proto +Subject: [PATCH 069/199] Add driver for rpi-proto Forward port of 3.10.x driver from https://github.com/koalo We are using a custom board and would like to use rpi 3.18.x @@ -100435,10 +100435,10 @@ index 0000000000000000000000000000000000000000..fadbfade100228aaafabb0d3bdf35c01 +MODULE_DESCRIPTION("ASoC Driver for Raspberry Pi connected to PROTO board (WM8731)"); +MODULE_LICENSE("GPL"); -From 1db46d8581da2dc1918791cf285b358f61915072 Mon Sep 17 00:00:00 2001 +From 5c7bbbec5ea19ab3ad27138803cc392ded3359c1 Mon Sep 17 00:00:00 2001 From: Jan Grulich Date: Mon, 24 Aug 2015 16:03:47 +0100 -Subject: [PATCH 070/173] RaspiDAC3 support +Subject: [PATCH 070/199] RaspiDAC3 support Signed-off-by: Jan Grulich @@ -100681,10 +100681,10 @@ index 0000000000000000000000000000000000000000..ad2b5b89bc8213dc2e277306ef50d6e3 +MODULE_DESCRIPTION("ASoC Driver for RaspiDAC Rev.3x"); +MODULE_LICENSE("GPL v2"); -From 3e9ea889a1832600d5d85e95ca8f9e1208636aca Mon Sep 17 00:00:00 2001 +From 9aece405c1735a0c20066c75d57b6da40edb1b4f Mon Sep 17 00:00:00 2001 From: Aaron Shaw Date: Thu, 7 Apr 2016 21:26:21 +0100 -Subject: [PATCH 071/173] Add Support for JustBoom Audio boards +Subject: [PATCH 071/199] Add Support for JustBoom Audio boards justboom-dac: Adjust for ALSA API change @@ -101140,10 +101140,10 @@ index 0000000000000000000000000000000000000000..909cf8928f2f4313982316f9c5b8a709 +MODULE_DESCRIPTION("ASoC Driver for JustBoom PI Digi HAT Sound Card"); +MODULE_LICENSE("GPL v2"); -From f9f3c49616174451761f9650eeb54a7cd3d0c4a7 Mon Sep 17 00:00:00 2001 +From 12b89895a8ffc4222b381111c37303ec1cd0d7c7 Mon Sep 17 00:00:00 2001 From: Andrey Grodzovsky Date: Tue, 3 May 2016 22:10:59 -0400 -Subject: [PATCH 072/173] ARM: adau1977-adc: Add basic machine driver for +Subject: [PATCH 072/199] ARM: adau1977-adc: Add basic machine driver for adau1977 codec driver. This commit adds basic support for the codec usage including: Device tree overlay, @@ -101325,10 +101325,10 @@ index 0000000000000000000000000000000000000000..f3d7e5db7bb912e1d7ca6f8e8d42df5f +MODULE_DESCRIPTION("ASoC Driver for ADAU1977 ADC"); +MODULE_LICENSE("GPL v2"); -From 89146d6df7d2f1f0ac537dc1a6fab18d45745bac Mon Sep 17 00:00:00 2001 +From 0dd1a66f045710d880bfa5c96c53d883b39e27cd Mon Sep 17 00:00:00 2001 From: Matt Flax Date: Mon, 16 May 2016 21:36:31 +1000 -Subject: [PATCH 073/173] New AudioInjector.net Pi soundcard with low jitter +Subject: [PATCH 073/199] New AudioInjector.net Pi soundcard with low jitter audio in and out. Contains the sound/soc/bcm ALSA machine driver and necessary alterations to the Kconfig and Makefile. @@ -101579,10 +101579,10 @@ index 0000000000000000000000000000000000000000..ef54e0f07ea03f59e9957b5d98f3e7fd +MODULE_ALIAS("platform:audioinjector-pi-soundcard"); + -From d2152e820d65214d326d86028f5e58f35b329688 Mon Sep 17 00:00:00 2001 +From da3f26748547b6d52f1b35c375a45205aba921cf Mon Sep 17 00:00:00 2001 From: DigitalDreamtime Date: Thu, 30 Jun 2016 18:38:42 +0100 -Subject: [PATCH 074/173] Add IQAudIO Digi WM8804 board support +Subject: [PATCH 074/199] Add IQAudIO Digi WM8804 board support Support IQAudIO Digi board with iqaudio_digi machine driver and iqaudio-digi-wm8804-audio overlay. @@ -101882,10 +101882,10 @@ index 0000000000000000000000000000000000000000..33aa2be8a43a12a12cfb5d844dd9732c +MODULE_DESCRIPTION("ASoC Driver for IQAudIO WM8804 Digi"); +MODULE_LICENSE("GPL v2"); -From 1660ae420d3e1bf946ab26d857a3efa44ed18399 Mon Sep 17 00:00:00 2001 +From 04900d8d8c36d123f3c437c6f6ec9b7021619641 Mon Sep 17 00:00:00 2001 From: escalator2015 Date: Tue, 24 May 2016 16:20:09 +0100 -Subject: [PATCH 075/173] New driver for RRA DigiDAC1 soundcard using WM8741 + +Subject: [PATCH 075/199] New driver for RRA DigiDAC1 soundcard using WM8741 + WM8804 --- @@ -102358,10 +102358,10 @@ index 0000000000000000000000000000000000000000..f200688bb4ae32b90a0ced555aed94b0 +MODULE_DESCRIPTION("ASoC Driver for RRA DigiDAC1"); +MODULE_LICENSE("GPL v2"); -From 314dc26021276267e532ae3a6695b3c730d670ca Mon Sep 17 00:00:00 2001 +From 5121a600bb82a3c7a835daa4dde1f74eb47ef292 Mon Sep 17 00:00:00 2001 From: DigitalDreamtime Date: Sat, 2 Jul 2016 16:26:19 +0100 -Subject: [PATCH 076/173] Add support for Dion Audio LOCO DAC-AMP HAT +Subject: [PATCH 076/199] Add support for Dion Audio LOCO DAC-AMP HAT Using dedicated machine driver and pcm5102a codec driver. @@ -102534,10 +102534,10 @@ index 0000000000000000000000000000000000000000..65e03741d349a2dc5bd91f69855ea952 +MODULE_DESCRIPTION("ASoC Driver for DionAudio LOCO"); +MODULE_LICENSE("GPL v2"); -From 5f645d53ff8cd061433ae75986e3c29d672d413f Mon Sep 17 00:00:00 2001 +From 3aa340cb5d67bf17ddf70b913a7c6804af0ff3d2 Mon Sep 17 00:00:00 2001 From: Clive Messer Date: Mon, 19 Sep 2016 14:01:04 +0100 -Subject: [PATCH 077/173] Allo Piano DAC boards: Initial 2 channel (stereo) +Subject: [PATCH 077/199] Allo Piano DAC boards: Initial 2 channel (stereo) support (#1645) Add initial 2 channel (stereo) support for Allo Piano DAC (2.0/2.1) boards, @@ -102744,10 +102744,10 @@ index 0000000000000000000000000000000000000000..eaf50fb6dbca1970ae1c6f8662088b0f +MODULE_DESCRIPTION("ALSA ASoC Machine Driver for Allo Piano DAC"); +MODULE_LICENSE("GPL v2"); -From 9122ceca49ddb8ce8a648cd5181e8bdd9c582086 Mon Sep 17 00:00:00 2001 +From f454c7bbdd01560f2598720c3538fb0915d97f57 Mon Sep 17 00:00:00 2001 From: Raashid Muhammed Date: Mon, 27 Mar 2017 12:35:00 +0530 -Subject: [PATCH 078/173] Add support for Allo Piano DAC 2.1 plus add-on board +Subject: [PATCH 078/199] Add support for Allo Piano DAC 2.1 plus add-on board for Raspberry Pi. The Piano DAC 2.1 has support for 4 channels with subwoofer. @@ -103492,10 +103492,10 @@ index 0000000000000000000000000000000000000000..56e43f98846b41e487b3089813f7edc3 +MODULE_DESCRIPTION("ALSA ASoC Machine Driver for Allo Piano DAC Plus"); +MODULE_LICENSE("GPL v2"); -From 74245f043c6887e406fe0a5cb7c75074985b8ca5 Mon Sep 17 00:00:00 2001 +From 99177cea77971faf0a40928bba8672321560b8a1 Mon Sep 17 00:00:00 2001 From: BabuSubashChandar Date: Tue, 28 Mar 2017 20:04:42 +0530 -Subject: [PATCH 079/173] Add support for Allo Boss DAC add-on board for +Subject: [PATCH 079/199] Add support for Allo Boss DAC add-on board for Raspberry Pi. (#1924) Signed-off-by: Baswaraj K @@ -104198,10 +104198,10 @@ index 0000000000000000000000000000000000000000..203ab76c7045b081578e23bda1099dd1 +MODULE_DESCRIPTION("ALSA ASoC Machine Driver for Allo Boss DAC"); +MODULE_LICENSE("GPL v2"); -From 73c0d15d727f497ee7df6fa6f9e0829e04fe1d70 Mon Sep 17 00:00:00 2001 +From 2b4f81ee788866bccb81d6c116f73120b91ccdc8 Mon Sep 17 00:00:00 2001 From: gtrainavicius Date: Sun, 23 Oct 2016 12:06:53 +0300 -Subject: [PATCH 080/173] Support for Blokas Labs pisound board +Subject: [PATCH 080/199] Support for Blokas Labs pisound board Pisound dynamic overlay (#1760) @@ -105400,10 +105400,10 @@ index 0000000000000000000000000000000000000000..06ff1e53dc9d860946965b6303577762 +MODULE_DESCRIPTION("ASoC Driver for pisound, http://blokas.io/pisound"); +MODULE_LICENSE("GPL v2"); -From 3dd54e337ec7f50b718a63db94550d7f3bced8e7 Mon Sep 17 00:00:00 2001 +From c827b76c4ee6a9da9701f466282c852750d6f427 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 22 Jan 2017 12:49:37 +0100 -Subject: [PATCH 081/173] ASoC: Add driver for Cirrus Logic Audio Card +Subject: [PATCH 081/199] ASoC: Add driver for Cirrus Logic Audio Card Note: due to problems with deferred probing of regulators the following softdep should be added to a modprobe.d file @@ -106468,10 +106468,10 @@ index 0000000000000000000000000000000000000000..ac8651ddff7bd3701dffe22c7fb88352 +MODULE_DESCRIPTION("ASoC driver for Cirrus Logic Audio Card"); +MODULE_LICENSE("GPL"); -From bc36160418de7ebd7bf4c4d2a52f0d769194954b Mon Sep 17 00:00:00 2001 +From acaf57bbffafca6ac323bb86be1e08e079bcd6bd Mon Sep 17 00:00:00 2001 From: Miquel Date: Fri, 24 Feb 2017 20:51:06 +0100 -Subject: [PATCH 082/173] sound: Support for Dion Audio LOCO-V2 DAC-AMP HAT +Subject: [PATCH 082/199] sound: Support for Dion Audio LOCO-V2 DAC-AMP HAT Signed-off-by: Miquel Blauw --- @@ -106666,10 +106666,10 @@ index 0000000000000000000000000000000000000000..a009c49477972a9832175d86f201b035 +MODULE_DESCRIPTION("ASoC Driver for DionAudio LOCO-V2"); +MODULE_LICENSE("GPL v2"); -From 314df407eb4bf4166ab8b91da5e3f73609946f50 Mon Sep 17 00:00:00 2001 +From 909bf34f09ed99e7dc9160d1c8facdb8ac0b91bb Mon Sep 17 00:00:00 2001 From: Fe-Pi Date: Wed, 1 Mar 2017 04:42:43 -0700 -Subject: [PATCH 083/173] Add support for Fe-Pi audio sound card. (#1867) +Subject: [PATCH 083/199] Add support for Fe-Pi audio sound card. (#1867) Fe-Pi Audio Sound Card is based on NXP SGTL5000 codec. Mechanical specification of the board is the same the Raspberry Pi Zero. @@ -106883,10 +106883,10 @@ index 0000000000000000000000000000000000000000..015b56fd73cc36be5b5eecd17548fd03 +MODULE_DESCRIPTION("ASoC Driver for Fe-Pi Audio"); +MODULE_LICENSE("GPL v2"); -From e3ee86733ec6df9188b0d64d70877adb452c9ad6 Mon Sep 17 00:00:00 2001 +From dc07f0d2ca6061d98ed134edc1cb518579569bd9 Mon Sep 17 00:00:00 2001 From: Matt Flax Date: Wed, 8 Mar 2017 20:04:13 +1100 -Subject: [PATCH 084/173] Add support for the AudioInjector.net Octo sound card +Subject: [PATCH 084/199] Add support for the AudioInjector.net Octo sound card AudioInjector Octo: sample rates, regulators, reset @@ -107288,10 +107288,10 @@ index 0000000000000000000000000000000000000000..dcf403ab37639ba79e38278d7e4b1ade +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:audioinjector-octo-soundcard"); -From 87a8a2b436a1694ede168fa77994e29c16fec183 Mon Sep 17 00:00:00 2001 +From 88d45791930a8182c4a958fa2e4a5de27dd9ec25 Mon Sep 17 00:00:00 2001 From: Peter Malkin Date: Mon, 27 Mar 2017 16:38:21 -0700 -Subject: [PATCH 085/173] Driver support for Google voiceHAT soundcard. +Subject: [PATCH 085/199] Driver support for Google voiceHAT soundcard. --- sound/soc/bcm/Kconfig | 7 ++ @@ -107682,10 +107682,10 @@ index 0000000000000000000000000000000000000000..225854b8e5298b3c3018f59a49404354 +MODULE_DESCRIPTION("ASoC Driver for Google voiceHAT SoundCard"); +MODULE_LICENSE("GPL v2"); -From ef2d4677dbd95942ef4b799dc343411183e53f5b Mon Sep 17 00:00:00 2001 +From df80b7c7680397e758392a7db950b512d82894b4 Mon Sep 17 00:00:00 2001 From: P33M Date: Wed, 21 Oct 2015 14:55:21 +0100 -Subject: [PATCH 086/173] rpi_display: add backlight driver and overlay +Subject: [PATCH 086/199] rpi_display: add backlight driver and overlay Add a mailbox-driven backlight controller for the Raspberry Pi DSI touchscreen display. Requires updated GPU firmware to recognise the @@ -107854,10 +107854,10 @@ index 0000000000000000000000000000000000000000..14a0d9b037395497c1fdae2961feccd5 +MODULE_DESCRIPTION("Raspberry Pi mailbox based Backlight Driver"); +MODULE_LICENSE("GPL"); -From 80071abd1a5757097e30e3474d7945df9e5e1540 Mon Sep 17 00:00:00 2001 +From 74414ea558e4944606017dea505ccc180f16bac8 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 23 Feb 2016 19:56:04 +0000 -Subject: [PATCH 087/173] bcm2835-virtgpio: Virtual GPIO driver +Subject: [PATCH 087/199] bcm2835-virtgpio: Virtual GPIO driver Add a virtual GPIO driver that uses the firmware mailbox interface to request that the VPU toggles LEDs. @@ -108131,10 +108131,10 @@ index 4a3d79d3b48eb483a4e4bf498f617515e3ad158f..5f34e1257117fb48013c9926a8a223d6 RPI_FIRMWARE_FRAMEBUFFER_SET_BACKLIGHT = 0x0004800f, -From 8bda6e9cef790aab89b07d56fbbea72db787bc32 Mon Sep 17 00:00:00 2001 +From 5856009e6c33a26c0ed7eaad482be179e102dd6a Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Mon, 20 Feb 2017 17:01:21 +0000 -Subject: [PATCH 088/173] bcm2835-gpio-exp: Driver for GPIO expander via +Subject: [PATCH 088/199] bcm2835-gpio-exp: Driver for GPIO expander via mailbox service Pi3 and Compute Module 3 have a GPIO expander that the @@ -108460,10 +108460,10 @@ index 5f34e1257117fb48013c9926a8a223d64a598ab7..c819c21b0158a59c1308882e5a40e3f3 /* Dispmanx TAGS */ RPI_FIRMWARE_FRAMEBUFFER_ALLOCATE = 0x00040001, -From 4982ff8f2f3780a6d82f03da3f52375b602e0d28 Mon Sep 17 00:00:00 2001 +From 1429f8125e1da9b233d79f61a5cbf7a02469fd50 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 23 Feb 2016 17:26:48 +0000 -Subject: [PATCH 089/173] amba_pl011: Don't use DT aliases for numbering +Subject: [PATCH 089/199] amba_pl011: Don't use DT aliases for numbering The pl011 driver looks for DT aliases of the form "serial", and if found uses as the device ID. This can cause @@ -108492,10 +108492,10 @@ index 1888d168a41c87c605962da2605df8ab1c02bd20..e22b9e79836a6aeef4c8f9fb618b9595 uap->old_cr = 0; uap->port.dev = dev; -From a9fa581c618a4ad0f041e7ff6f82e5fad0f7cdb4 Mon Sep 17 00:00:00 2001 +From c7a41e7ed777fee2617ff4e2a51cba459f18b917 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 1 Mar 2017 16:07:39 +0000 -Subject: [PATCH 090/173] amba_pl011: Round input clock up +Subject: [PATCH 090/199] amba_pl011: Round input clock up The UART clock is initialised to be as close to the requested frequency as possible without exceeding it. Now that there is a @@ -108581,10 +108581,10 @@ index e22b9e79836a6aeef4c8f9fb618b9595c551500f..4b815abbf9913075885ee60f4d9ad49d /* unregisters the driver also if no more ports are left */ static void pl011_unregister_port(struct uart_amba_port *uap) -From 7bae3b057de6271cc60c5fb58df61de79ba11ff5 Mon Sep 17 00:00:00 2001 +From fbe8a3d3438cd6c3e3bfeb60f7c28c045037c6e3 Mon Sep 17 00:00:00 2001 From: Pantelis Antoniou Date: Wed, 3 Dec 2014 13:23:28 +0200 -Subject: [PATCH 091/173] OF: DT-Overlay configfs interface +Subject: [PATCH 091/199] OF: DT-Overlay configfs interface This is a port of Pantelis Antoniou's v3 port that makes use of the new upstreamed configfs support for binary attributes. @@ -109016,10 +109016,10 @@ index 0000000000000000000000000000000000000000..0037e6868a6cda8706c88194c6a4454b +} +late_initcall(of_cfs_init); -From ee744cbd4f413ecab6f664274972c3807c9d606e Mon Sep 17 00:00:00 2001 +From e2d6f47cb3e1d1f8aa668c5042924bb21f799a4a Mon Sep 17 00:00:00 2001 From: Cheong2K Date: Fri, 26 Feb 2016 18:20:10 +0800 -Subject: [PATCH 092/173] brcm: adds support for BCM43341 wifi +Subject: [PATCH 092/199] brcm: adds support for BCM43341 wifi brcmfmac: Disable power management @@ -109151,10 +109151,10 @@ index f3556122c6ace17c419e13023057861957a507fa..f8d4647016a1cde3d51dd43da07a46ce BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, 43362), BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, 4339), -From 862219e4c44154cb99abcdd78281a2082de3d53f Mon Sep 17 00:00:00 2001 +From 226c2f122350faed258b25771bee1c67291f56fd Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 17 Feb 2017 15:26:13 +0000 -Subject: [PATCH 093/173] brcmfmac: Mute expected startup 'errors' +Subject: [PATCH 093/199] brcmfmac: Mute expected startup 'errors' The brcmfmac WiFi driver always complains about the '00' country code. Modify the driver to ignore '00' silently. @@ -109178,10 +109178,10 @@ index 508cab2d0817914d454958f92167d350c74d9a5d..987b1f5b999b0ecb68b6ce741b8e3ddb req->alpha2[0], req->alpha2[1]); return; -From 1c5d4e984dc9d4729c336c7d56f41507f0973806 Mon Sep 17 00:00:00 2001 +From 8d02a39e97f408198f347647a1351b03c31b8bfa Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 17 Dec 2015 13:37:07 +0000 -Subject: [PATCH 094/173] hci_h5: Don't send conf_req when ACTIVE +Subject: [PATCH 094/199] hci_h5: Don't send conf_req when ACTIVE Without this patch, a modem and kernel can continuously bombard each other with conf_req and conf_rsp messages, in a demented game of tag. @@ -109204,10 +109204,10 @@ index c0e4e26dc30d7c3c6a771b7b86df88c8cf763646..7308287259eedcaf229f8a496a0e3826 if (H5_HDR_LEN(hdr) > 2) h5->tx_win = (data[2] & 0x07); -From 3de80acbf475780288c867ec9b885da847d90d4a Mon Sep 17 00:00:00 2001 +From 42d9325a007a9a4f166f22f9b09bf37afe6452e1 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 13 Apr 2015 17:16:29 +0100 -Subject: [PATCH 095/173] config: Add default configs +Subject: [PATCH 095/199] config: Add default configs --- arch/arm/configs/bcm2709_defconfig | 1312 +++++++++++++++++++++++++++++++++++ @@ -111859,10 +111859,10 @@ index 0000000000000000000000000000000000000000..29fd2abc2cbfcaed37cb630b5edffaa5 +CONFIG_CRC_ITU_T=y +CONFIG_LIBCRC32C=y -From aa0d7e5a28f52a73aa338d6460da265ff880861b Mon Sep 17 00:00:00 2001 +From ca58cd14d77105a95a2b7abf6660e9453e8a1333 Mon Sep 17 00:00:00 2001 From: Michael Zoran Date: Wed, 24 Aug 2016 03:35:56 -0700 -Subject: [PATCH 096/173] Add arm64 configuration and device tree differences. +Subject: [PATCH 096/199] Add arm64 configuration and device tree differences. Disable MMC_BCM2835_SDHOST and MMC_BCM2835 since these drivers are crashing at the moment. @@ -113276,10 +113276,10 @@ index 0000000000000000000000000000000000000000..e6b09fafa27eed2b762e3d53b55041f7 +CONFIG_LIBCRC32C=y +CONFIG_BCM2835_VCHIQ=n -From 8e2219a0baafc84fd4d99777767c2fb2af678d61 Mon Sep 17 00:00:00 2001 +From c1b44639558d397e5c5efa884a69880ee64d5a5f Mon Sep 17 00:00:00 2001 From: Electron752 Date: Thu, 12 Jan 2017 07:07:08 -0800 -Subject: [PATCH 097/173] ARM64: Make it work again on 4.9 (#1790) +Subject: [PATCH 097/199] ARM64: Make it work again on 4.9 (#1790) * Invoke the dtc compiler with the same options used in arm mode. * ARM64 now uses the bcm2835 platform just like ARM32. @@ -113688,10 +113688,10 @@ index e6b09fafa27eed2b762e3d53b55041f793683d27..c7e891d72969a388d9b135a36dbfc9c9 CONFIG_LIBCRC32C=y -CONFIG_BCM2835_VCHIQ=n -From 22c1d2230b0a3c24579468f54d01fa5de1596eb4 Mon Sep 17 00:00:00 2001 +From 1e28e06eea4a398c7efd323e4c542aa0c74f8187 Mon Sep 17 00:00:00 2001 From: Michael Zoran Date: Thu, 12 Jan 2017 19:10:07 -0800 -Subject: [PATCH 098/173] ARM64: Enable HDMI audio and vc04_services in +Subject: [PATCH 098/199] ARM64: Enable HDMI audio and vc04_services in bcmrpi3_defconfig Signed-off-by: Michael Zoran @@ -113720,10 +113720,10 @@ index c7e891d72969a388d9b135a36dbfc9c9cb609bf8..4b90f9b64abe9f089ba56b13d5a00de3 CONFIG_BCM2835_MBOX=y # CONFIG_IOMMU_SUPPORT is not set -From 7b4499e2b9552b0b365016240a16c8072bb5f627 Mon Sep 17 00:00:00 2001 +From 9415b9d030e48d72531f5427ffd2f6eef6a10cfc Mon Sep 17 00:00:00 2001 From: Michael Zoran Date: Thu, 12 Jan 2017 19:14:03 -0800 -Subject: [PATCH 099/173] ARM64: Run bcmrpi3_defconfig through savedefconfig. +Subject: [PATCH 099/199] ARM64: Run bcmrpi3_defconfig through savedefconfig. Signed-off-by: Michael Zoran --- @@ -113768,10 +113768,10 @@ index 4b90f9b64abe9f089ba56b13d5a00de33343bfb9..dac962ca1634662ce7d966f1ffb53b5b CONFIG_FB_TFT_AGM1264K_FL=m CONFIG_FB_TFT_BD663474=m -From 17093b0945689c18b8695f59f9994313671ab152 Mon Sep 17 00:00:00 2001 +From 87cdf802723bc18edc7a23a498305a0c034fc7fa Mon Sep 17 00:00:00 2001 From: Electron752 Date: Sat, 14 Jan 2017 02:54:26 -0800 -Subject: [PATCH 100/173] ARM64: Enable Kernel Address Space Randomization +Subject: [PATCH 100/199] ARM64: Enable Kernel Address Space Randomization (#1792) Randomization allows the mapping between virtual addresses and physical @@ -113803,10 +113803,10 @@ index dac962ca1634662ce7d966f1ffb53b5bfa27c506..aae33b4b3c3e736ea7cd3ca242158ad6 CONFIG_BINFMT_MISC=y CONFIG_COMPAT=y -From 4e8ce0d9fe85bd01daead09f28aa2be3cbce7edb Mon Sep 17 00:00:00 2001 +From 5b36fd225f5b04ee9d01fa0d2b1a5be0b194e5a1 Mon Sep 17 00:00:00 2001 From: Michael Zoran Date: Sun, 15 Jan 2017 07:31:59 -0800 -Subject: [PATCH 101/173] ARM64: Enable RTL8187/RTL8192CU wifi in build config +Subject: [PATCH 101/199] ARM64: Enable RTL8187/RTL8192CU wifi in build config These drivers build now, so they can be enabled back in the build configuration just like they are for @@ -113831,10 +113831,10 @@ index aae33b4b3c3e736ea7cd3ca242158ad6ba558aff..b7d762df19b85e369a32cd823dfd0621 CONFIG_ZD1211RW=m CONFIG_MAC80211_HWSIM=m -From 5144c8dd8cfdaecf22c4bc4b7aabbae11faa034f Mon Sep 17 00:00:00 2001 +From c746af6cb3b2197c46621f2430c0ef6f2f9a49e1 Mon Sep 17 00:00:00 2001 From: Michael Zoran Date: Sat, 14 Jan 2017 21:33:51 -0800 -Subject: [PATCH 102/173] ARM64/DWC_OTG: Port dwc_otg driver to ARM64 +Subject: [PATCH 102/199] ARM64/DWC_OTG: Port dwc_otg driver to ARM64 In ARM64, the FIQ mechanism used by this driver is not current implemented. As a workaround, reqular IRQ is used instead @@ -114177,10 +114177,10 @@ index 6b2c7d0c93f36a63863ff4b0ecc1f3eab77e058b..d7b700ff17821ad1944e36721fe6b2db /** The OS page size */ #define DWC_OS_PAGE_SIZE PAGE_SIZE -From 1776d57f4d2d9e1241edd81b0f94b54d44d911bd Mon Sep 17 00:00:00 2001 +From 7df3f200104eb850efc44d8637a8c3bfe9915b76 Mon Sep 17 00:00:00 2001 From: Michael Zoran Date: Sat, 14 Jan 2017 21:43:57 -0800 -Subject: [PATCH 103/173] ARM64: Round-Robin dispatch IRQs between CPUs. +Subject: [PATCH 103/199] ARM64: Round-Robin dispatch IRQs between CPUs. IRQ-CPU mapping is round robined on ARM64 to increase concurrency and allow multiple interrupts to be serviced @@ -114254,10 +114254,10 @@ index c4e151451cf8c8ebde5225515eac2786d6f61d46..9a7ee04ee0d9b7aa734cf3159ed59c19 .name = "bcm2836-gpu", .irq_mask = bcm2836_arm_irqchip_mask_gpu_irq, -From 32cdec81d123f94e87194e77a0e45b639880b130 Mon Sep 17 00:00:00 2001 +From c70733205699a8736e3211e9fcc4252fa1c09182 Mon Sep 17 00:00:00 2001 From: Michael Zoran Date: Sat, 14 Jan 2017 21:45:03 -0800 -Subject: [PATCH 104/173] ARM64: Enable DWC_OTG Driver In ARM64 Build +Subject: [PATCH 104/199] ARM64: Enable DWC_OTG Driver In ARM64 Build Config(bcmrpi3_defconfig) Signed-off-by: Michael Zoran @@ -114278,10 +114278,10 @@ index b7d762df19b85e369a32cd823dfd062145bdefa7..4d85c231c5ea0244e1b05fb4a5e3c8fd CONFIG_USB_STORAGE=y CONFIG_USB_STORAGE_REALTEK=m -From 3503301d0f63751ed4be814d6bf4c9c4e0cc0148 Mon Sep 17 00:00:00 2001 +From 01a717501acaf2fa10a897780bc5ceadb90c6e42 Mon Sep 17 00:00:00 2001 From: Michael Zoran Date: Sat, 11 Feb 2017 01:18:31 -0800 -Subject: [PATCH 105/173] ARM64: Force hardware emulation of deprecated +Subject: [PATCH 105/199] ARM64: Force hardware emulation of deprecated instructions. --- @@ -114309,10 +114309,10 @@ index f0e6d717885b1fcf3b22f64c10c38f19c25f809d..0cb830d30fb6d2bd26ab572efe893649 case INSN_OBSOLETE: insn->current_mode = INSN_UNDEF; -From c75fea4314f25493f1a4fa41c0495dccb07d45a2 Mon Sep 17 00:00:00 2001 +From a40a623fb150828587960a458d5359be72a5a47a Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Fri, 10 Feb 2017 17:57:08 -0800 -Subject: [PATCH 106/173] build/arm64: Add rules for .dtbo files for dts +Subject: [PATCH 106/199] build/arm64: Add rules for .dtbo files for dts overlays We now create overlays as .dtbo files. @@ -114337,10 +114337,10 @@ index 9b41f1e3b1a039cd45fe842e10abff0181186fdf..dc2859b8eed168ed52e95c503e7a5ce3 dtbs: prepare scripts -From 2f1efd7d3d0b00d0ee8d633a19534ac7442f3de4 Mon Sep 17 00:00:00 2001 +From c461e7d7be901677c7c644fd2cd9900c96d732d4 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 9 May 2016 17:28:18 -0700 -Subject: [PATCH 107/173] clk: bcm2835: Mark GPIO clocks enabled at boot as +Subject: [PATCH 107/199] clk: bcm2835: Mark GPIO clocks enabled at boot as critical. These divide off of PLLD_PER and are used for the ethernet and wifi @@ -114378,10 +114378,10 @@ index 336f8c9c44325d0a94e591a8557f7af246adc857..caa05e5ad0b7b5cd683e04fb3591a3df * rate changes on at least of the parents. */ -From 3fc8182fc7a7b27f4867368e5ded2b76f9deefa6 Mon Sep 17 00:00:00 2001 +From 2707c76678d5f062a8bcc7bdcea2cc360012f95b Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 24 Feb 2015 13:40:50 +0000 -Subject: [PATCH 108/173] pinctrl-bcm2835: Fix interrupt handling for GPIOs +Subject: [PATCH 108/199] pinctrl-bcm2835: Fix interrupt handling for GPIOs 28-31 and 46-53 Contrary to the documentation, the BCM2835 GPIO controller actually has @@ -114414,10 +114414,10 @@ index a9d480df32562defbf8be0faf0a39bfe06ff71f9..18c92bae3b2e7e9f8208ca0d4487b08b .suppress_bind_attrs = true, }, -From 8d5d79c2d7ee7973c9901827d6a192b248f2a2eb Mon Sep 17 00:00:00 2001 +From 59dac86438c76757e3486ed71ed0f3547ad2040f Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 23 Mar 2017 10:06:56 +0000 -Subject: [PATCH 109/173] ASoC: Add prompt for ICS43432 codec +Subject: [PATCH 109/199] ASoC: Add prompt for ICS43432 codec Without a prompt string, a config setting can't be included in a defconfig. Give CONFIG_SND_SOC_ICS43432 a prompt so that Pi soundcards @@ -114442,10 +114442,10 @@ index aca3a53f08dba8762307f7c25a5d7c5561b9cf71..a3be6e005a895b995897cc007bb85c78 config SND_SOC_INNO_RK3036 tristate "Inno codec driver for RK3036 SoC" -From cacb59c057cd62127e01ef15603e71ddb7fcc7ce Mon Sep 17 00:00:00 2001 +From 6cfd9b45e95966f54ec1ddb7295add5d58eede7b Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 23 Mar 2017 16:34:46 +0000 -Subject: [PATCH 110/173] bcm2835-aux: Add aux interrupt controller +Subject: [PATCH 110/199] bcm2835-aux: Add aux interrupt controller The AUX block has a shared interrupt line with a register indicating which devices have active IRQs. Expose this as a nested interrupt @@ -114609,10 +114609,10 @@ index bd750cf2238d61489811e7d7bd3b5f9950ed53c8..41e0702fae4692221980b0d02aed1ba6 BCM2835_AUX_CLOCK_COUNT, GFP_KERNEL); if (!onecell) -From f2512ac2b55b875a24a50e59b889afc8140c254e Mon Sep 17 00:00:00 2001 +From 541b179130ab76694bf3d62f27c15146c2876f2f Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Fri, 29 Apr 2016 10:32:17 -0700 -Subject: [PATCH 111/173] mmc: read mmc alias from device tree +Subject: [PATCH 111/199] mmc: read mmc alias from device tree To get the SD/MMC host device ID, read the alias from the device tree. @@ -114669,10 +114669,10 @@ index 1503412f826cd0e0e9ad37a0554b31596a49eb77..2f5b3cf86293b96b104eac7c6d48a583 kfree(host); return NULL; -From ecf97118ac5de61d3bf2d83b466280ee29a63822 Mon Sep 17 00:00:00 2001 +From 27a313cf19bffa4d005c6f93db0b5e86425b51a6 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 11 May 2016 12:50:33 +0100 -Subject: [PATCH 112/173] mmc: Add MMC_QUIRK_ERASE_BROKEN for some cards +Subject: [PATCH 112/199] mmc: Add MMC_QUIRK_ERASE_BROKEN for some cards Some SD cards have been found that corrupt data when small blocks are erased. Add a quirk to indicate that ERASE should not be used, @@ -114812,10 +114812,10 @@ index 46c73e97e61f08a41d9753079345f5965caebbc5..388c551ed11e9d06ea1c25b6553d47a8 unsigned int erase_size; /* erase size in sectors */ -From c8b7e3062f047e73581ea9467b79a0c7ca70282c Mon Sep 17 00:00:00 2001 +From be214c817e1c8b75dae09c41df825be00a34a68d Mon Sep 17 00:00:00 2001 From: Yasunari Takiguchi Date: Fri, 14 Apr 2017 10:43:57 +0100 -Subject: [PATCH 113/173] This is the driver for Sony CXD2880 DVB-T2/T tuner + +Subject: [PATCH 113/199] This is the driver for Sony CXD2880 DVB-T2/T tuner + demodulator. It includes the CXD2880 driver and the CXD2880 SPI adapter. The current CXD2880 driver version is 1.4.1 - 1.0.1 released on April 13, 2017. @@ -130947,10 +130947,10 @@ index 0000000000000000000000000000000000000000..82e122349055be817eb74ed5bbcd7560 +MODULE_AUTHOR("Sony Semiconductor Solutions Corporation"); +MODULE_LICENSE("GPL v2"); -From 2572d44289de83da22f0c5537264db7ab390d054 Mon Sep 17 00:00:00 2001 +From f84647ba6a7b448ac028b16837a4a233281d4c5b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 14 Sep 2016 09:18:09 +0100 -Subject: [PATCH 114/173] raspberrypi-firmware: Define the MBOX channel in the +Subject: [PATCH 114/199] raspberrypi-firmware: Define the MBOX channel in the header. Signed-off-by: Eric Anholt @@ -130972,10 +130972,10 @@ index c819c21b0158a59c1308882e5a40e3f3fe73cbdf..de2a3dcd562beb752266eaf0070e5586 enum rpi_firmware_property_status { -From 6a1197ebcdaf028b90367012c289167371d085c8 Mon Sep 17 00:00:00 2001 +From 2cc8481ced77925ef4a150b368b33f35a453a55f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 14 Sep 2016 09:16:19 +0100 -Subject: [PATCH 115/173] raspberrypi-firmware: Export the general transaction +Subject: [PATCH 115/199] raspberrypi-firmware: Export the general transaction function. The vc4-firmware-kms module is going to be doing the MBOX FB call. @@ -131019,10 +131019,10 @@ index de2a3dcd562beb752266eaf0070e55861d553f5f..dc7fd58afd5dddebf9b17065bb069a1d #endif /* __SOC_RASPBERRY_FIRMWARE_H__ */ -From ca0b875af245f0577d38b589bd7c32680ef13e0c Mon Sep 17 00:00:00 2001 +From 444cc6c9a1a6245f41cd0d4ed517fb697c10a0bf Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 14 Sep 2016 08:39:33 +0100 -Subject: [PATCH 116/173] drm/vc4: Add a mode for using the closed firmware for +Subject: [PATCH 116/199] drm/vc4: Add a mode for using the closed firmware for display. Signed-off-by: Eric Anholt @@ -131794,10 +131794,10 @@ index 0000000000000000000000000000000000000000..7dd233eed677c1689492ab95bc864753 + }, +}; -From 8d12d4e3904b051c0df8fcfa3aa5dedc93ec6e6c Mon Sep 17 00:00:00 2001 +From 22eee465cf18360c31415a35bff8b991d7560223 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 1 Feb 2017 17:09:18 -0800 -Subject: [PATCH 117/173] drm/vc4: Name the primary and cursor planes in fkms. +Subject: [PATCH 117/199] drm/vc4: Name the primary and cursor planes in fkms. This makes debugging nicer, compared to trying to remember what the IDs are. @@ -131821,10 +131821,10 @@ index 7dd233eed677c1689492ab95bc86475330d2d63b..e6097046fb25361bc61d657083d95b63 if (type == DRM_PLANE_TYPE_PRIMARY) { vc4_plane->fbinfo = -From f561f2b6efcfec7d3daae3b9c3288533d192c6d6 Mon Sep 17 00:00:00 2001 +From e812ab5501b645d4a2939fd4c15eccf7f4c7cf10 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 1 Feb 2017 17:10:09 -0800 -Subject: [PATCH 118/173] drm/vc4: Add DRM_DEBUG_ATOMIC for the insides of +Subject: [PATCH 118/199] drm/vc4: Add DRM_DEBUG_ATOMIC for the insides of fkms. Trying to debug weston on fkms involved figuring out what calls I was @@ -131894,10 +131894,10 @@ index e6097046fb25361bc61d657083d95b634232aabc..72d0b9cffe3d2997d69040c46f4aee11 RPI_FIRMWARE_SET_CURSOR_STATE, &packet_state, -From 59e5aba1a8af1803c655cfec60ba4ef0fda99424 Mon Sep 17 00:00:00 2001 +From bb2165fbe6a22c281525245f0c3f1cdfb62968e0 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 2 Feb 2017 09:42:18 -0800 -Subject: [PATCH 119/173] drm/vc4: Fix sending of page flip completion events +Subject: [PATCH 119/199] drm/vc4: Fix sending of page flip completion events in FKMS mode. In the rewrite of vc4_crtc.c for fkms, I dropped the part of the @@ -131939,10 +131939,10 @@ index 72d0b9cffe3d2997d69040c46f4aee11e22aa213..185f9bd3c1b2d47d0c1fc5293db4199b static void vc4_crtc_handle_page_flip(struct vc4_crtc *vc4_crtc) -From 86905ab00857eb22f1eb8909858ba2e7e3a9165a Mon Sep 17 00:00:00 2001 +From 296a55719cbd424eef3248de8c6845b1fe064150 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 18 Apr 2017 21:43:46 +0100 -Subject: [PATCH 120/173] vc4_fkms: Apply firmware overscan offset to hardware +Subject: [PATCH 120/199] vc4_fkms: Apply firmware overscan offset to hardware cursor --- @@ -131999,10 +131999,10 @@ index 185f9bd3c1b2d47d0c1fc5293db4199bd8963023..072f377b7423ee603d73ace2bf6d620f return 0; -From 4a5fef4b0d90416a76e64de8f4dbc2d75924894f Mon Sep 17 00:00:00 2001 +From b8c3bb12f30704ebe5737db5aaf0890e46b5584b Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 16 May 2017 14:39:49 +0100 -Subject: [PATCH 121/173] mmc: Change downstream MMC driver CONFIG option +Subject: [PATCH 121/199] mmc: Change downstream MMC driver CONFIG option The upstream SDHOST driver has now claimed CONFIG_MMC_BCM2835, which clashes with the downstream MMC driver. Rename the downstream option to @@ -132050,10 +132050,10 @@ index cd3a47d8965958ccf3ac3d186a05bbd437494154..9ba643d3b2e12960f5ce4b0eb5d75c1c obj-$(CONFIG_MMC_WBSD) += wbsd.o obj-$(CONFIG_MMC_AU1X) += au1xmmc.o -From 451c7dce838d727f0e9d6ad48ccdff3e8365a20e Mon Sep 17 00:00:00 2001 +From 1a6c973113643f8338a07c7e4df262e2bbc757d0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 16 May 2017 19:34:52 +0100 -Subject: [PATCH 122/173] config: Add CONFIG_I2C_ROBOTFUZZ_OSIF +Subject: [PATCH 122/199] config: Add CONFIG_I2C_ROBOTFUZZ_OSIF --- arch/arm/configs/bcm2709_defconfig | 1 + @@ -132085,10 +132085,10 @@ index 29fd2abc2cbfcaed37cb630b5edffaa5b4994f6e..05d6d108cb2d013588ccc971c83dcd21 CONFIG_SPI_BCM2835=m CONFIG_SPI_BCM2835AUX=m -From e9a21552d4dbd7a939b72176dab7d056724fdf8b Mon Sep 17 00:00:00 2001 +From d326f9cdd067fb314592215077193120fe5da082 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 18 May 2017 11:40:43 +0100 -Subject: [PATCH 123/173] config: Add FB_TFT_ST7789V module +Subject: [PATCH 123/199] config: Add FB_TFT_ST7789V module --- arch/arm/configs/bcm2709_defconfig | 1 + @@ -132120,10 +132120,10 @@ index 05d6d108cb2d013588ccc971c83dcd212308f230..54175b3c558e89d56b7d65752bccc6bd CONFIG_FB_TFT_TLS8204=m CONFIG_FB_TFT_UC1701=m -From 65838dba857839a2f18ea265152747eaf9738da9 Mon Sep 17 00:00:00 2001 +From ffa030ae69d9b214c58ea93a73738503db84c7fd Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 18 May 2017 15:36:46 +0100 -Subject: [PATCH 124/173] staging: bcm2835-audio: Fix memory corruption +Subject: [PATCH 124/199] staging: bcm2835-audio: Fix memory corruption I'm all for fixing memory leaks, but freeing a block while it is still being used is a recipe for hard-to-debug kernel exeptions. @@ -132158,10 +132158,10 @@ index 5f3d8f2339e34834d11edfa8de1d5819e3e32b4f..89f96f3c02805f4114ec9b488e18d00e return ret; } -From 65e912f0f3280b6facb6f9e89747c498cb38d706 Mon Sep 17 00:00:00 2001 +From af4818a3d2a92c4d5494f0c2a89d79ea1d7554a0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 15 May 2017 16:40:05 +0100 -Subject: [PATCH 125/173] config: Add CONFIG_TOUCHSCREEN_GOODIX +Subject: [PATCH 125/199] config: Add CONFIG_TOUCHSCREEN_GOODIX --- arch/arm/configs/bcm2709_defconfig | 1 + @@ -132193,10 +132193,10 @@ index 54175b3c558e89d56b7d65752bccc6bdaebcfd5a..1d2d27cb950b5e799370b7ca557f4bcb CONFIG_TOUCHSCREEN_RPI_FT5406=m CONFIG_TOUCHSCREEN_USB_COMPOSITE=m -From 128dd2e40b0ddd9e1259a063cd9d3aac04d289d6 Mon Sep 17 00:00:00 2001 +From 0000bac8a1278b1a1b78a938e3fb5e97cc194822 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 16 May 2017 15:58:00 +0100 -Subject: [PATCH 126/173] config: Add CONFIG_TOUCHSCREEN_EDT_FT5X06 +Subject: [PATCH 126/199] config: Add CONFIG_TOUCHSCREEN_EDT_FT5X06 --- arch/arm/configs/bcm2709_defconfig | 1 + @@ -132228,10 +132228,10 @@ index 1d2d27cb950b5e799370b7ca557f4bcb2508169b..de0b998202e23eec39fafce0e8cd346e CONFIG_TOUCHSCREEN_USB_COMPOSITE=m CONFIG_TOUCHSCREEN_STMPE=m -From d9e51f8dfd5eee9e765b27ae146f0ad190eca7c1 Mon Sep 17 00:00:00 2001 +From 0304459815418228cc15a0645598c2da3c063b68 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 22 May 2017 13:35:28 +0100 -Subject: [PATCH 127/173] config: Add CONFIG_IPV6_SIT_6RD +Subject: [PATCH 127/199] config: Add CONFIG_IPV6_SIT_6RD --- arch/arm/configs/bcm2709_defconfig | 1 + @@ -132263,10 +132263,10 @@ index de0b998202e23eec39fafce0e8cd346e68817f6c..c4d82bec0aefc191c6049500fbeda6ea CONFIG_IPV6_MULTIPLE_TABLES=y CONFIG_IPV6_SUBTREES=y -From ec2378c3a78dff7313dc551eb857e74cb36e5bd2 Mon Sep 17 00:00:00 2001 +From 6aaea037ba350b3fe30184f480e65c53a1dba06f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 22 May 2017 15:28:27 +0100 -Subject: [PATCH 128/173] config: Add CONFIG_IPV6_ROUTE_INFO +Subject: [PATCH 128/199] config: Add CONFIG_IPV6_ROUTE_INFO --- arch/arm/configs/bcm2709_defconfig | 1 + @@ -132298,10 +132298,10 @@ index c4d82bec0aefc191c6049500fbeda6ea0a47f590..7d3522df2b28e53cb63a081316891879 CONFIG_INET6_ESP=m CONFIG_INET6_IPCOMP=m -From 30f1a565079205ce4c5d797b03f62001d5b1e119 Mon Sep 17 00:00:00 2001 +From 800cbca9570bf663f007749736fabd127c713823 Mon Sep 17 00:00:00 2001 From: P33M Date: Thu, 25 May 2017 16:04:53 +0100 -Subject: [PATCH 129/173] dwc_otg: make periodic scheduling behave properly for +Subject: [PATCH 129/199] dwc_otg: make periodic scheduling behave properly for FS buses If the root port is in full-speed mode, transfer times at 12mbit/s @@ -132472,10 +132472,10 @@ index 85a6d431ca54b47dc10573aa72d1ad69d06f2e36..4b1dd9de99e9e08b2e006fb5f8a7ef92 status = check_max_xfer_size(hcd, qh); if (status) { -From 513a113092ed066fbe36cfc3c08389deb1c04acf Mon Sep 17 00:00:00 2001 +From a3e19ec5100f95382f64a318192f2d1496f1b2b0 Mon Sep 17 00:00:00 2001 From: P33M Date: Fri, 26 May 2017 12:50:31 +0100 -Subject: [PATCH 130/173] dwc_otg: fiq_fsm: Make isochronous compatibility +Subject: [PATCH 130/199] dwc_otg: fiq_fsm: Make isochronous compatibility checks work properly Get rid of the spammy printk and local pointer mangling. @@ -132539,10 +132539,10 @@ index 38bf5fc792d32352f9e208e0e90f968599b9bc31..71834cf365e67d7ad995bba7869216c4 return 1; } -From 179f3d51610b2d63525037a97c7a41e2a3dec0b5 Mon Sep 17 00:00:00 2001 +From ee3c56dd38f4d066164704ec499346955312b9d4 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 12 Jun 2017 13:05:43 +0100 -Subject: [PATCH 131/173] config: Add CONFIG_CAN_GS_USB +Subject: [PATCH 131/199] config: Add CONFIG_CAN_GS_USB --- arch/arm/configs/bcm2709_defconfig | 1 + @@ -132574,10 +132574,10 @@ index 7d3522df2b28e53cb63a0813168918792b65becb..bf0d3fd830a0a0cc9443ef52e7f167eb CONFIG_IRLAN=m CONFIG_IRNET=m -From 0334f3d7c7cf1025d9939521423c78b276df45c2 Mon Sep 17 00:00:00 2001 +From 07b47fafda89cdf5a75e97c51737a8b1ab486b69 Mon Sep 17 00:00:00 2001 From: P33M Date: Mon, 12 Jun 2017 16:10:03 +0100 -Subject: [PATCH 132/173] dwc_otg: add module parameter int_ep_interval_min +Subject: [PATCH 132/199] dwc_otg: add module parameter int_ep_interval_min Add a module parameter (defaulting to ignored) that clamps the polling rate of high-speed Interrupt endpoints to a minimum microframe interval. @@ -132659,10 +132659,10 @@ index 4b1dd9de99e9e08b2e006fb5f8a7ef92f20c2553..fe8e8f841f03660c2ad49ab8e66193be DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD QH Initialized\n"); -From a016915f594e2e4e5fe411b6e9a70fd4aed38223 Mon Sep 17 00:00:00 2001 +From 4c549a2c20952bf101f0668aab839c78abd4684b Mon Sep 17 00:00:00 2001 From: P33M Date: Tue, 20 Jun 2017 13:44:01 +0100 -Subject: [PATCH 133/173] dwc_otg: fiq_fsm: Add non-periodic TT exclusivity +Subject: [PATCH 133/199] dwc_otg: fiq_fsm: Add non-periodic TT exclusivity constraints Certain hub types do not discriminate between pipe direction (IN or OUT) @@ -132829,10 +132829,10 @@ index 71834cf365e67d7ad995bba7869216c4091c3a74..7710370b30363e3170bf9bf522597c5f st->fsm = FIQ_PER_SSPLIT_STARTED; } else { -From 7d234795e354ec54b088e8f3d3b1ee0db815722d Mon Sep 17 00:00:00 2001 +From 46faca77a318b878f85497c0c00ba58fc7ca6872 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 26 May 2017 13:03:41 +0100 -Subject: [PATCH 134/173] BCM270X_DT: Add midi-uart1 overlay +Subject: [PATCH 134/199] BCM270X_DT: Add midi-uart1 overlay Add a scaler to the ttyS0 clock so that requesting 38400 baud results in an approximately 31250 baud signal. This is analagous to @@ -132930,10 +132930,10 @@ index 0000000000000000000000000000000000000000..e0bc410acbff3a7a175dd5d53b3ab0d0 + }; +}; -From 5dfe95ff49ef769f8d7674639e0c4561f50b847b Mon Sep 17 00:00:00 2001 +From 3fcb98a4d1c28d554f7af00692e0b6d975f1ccfc Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Sat, 20 May 2017 22:10:14 +0100 -Subject: [PATCH 135/173] overlays: README: remove vestigial SDIO parameters +Subject: [PATCH 135/199] overlays: README: remove vestigial SDIO parameters Signed-off-by: Phil Elwell --- @@ -132987,10 +132987,10 @@ index ec9e7b1941678796facf625b3770c20ed0b15b25..499cd1920fd373702cfbc9f6e0fcaebc (default on: polling once at boot-time) -From eaf3d7aa7038a5f1b13fd2b62cd0674f915824d4 Mon Sep 17 00:00:00 2001 +From b595deb87a6c6fe627083d27e9770fd78d084709 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 27 Jun 2017 15:07:14 +0100 -Subject: [PATCH 136/173] SQUASH: mmc: Apply ERASE_BROKEN quirks correctly +Subject: [PATCH 136/199] SQUASH: mmc: Apply ERASE_BROKEN quirks correctly Squash with: mmc: Add MMC_QUIRK_ERASE_BROKEN for some cards @@ -133020,10 +133020,10 @@ index 05c8d7381fff5ae88531129d9a5ddd554bddb43e..c9d5d644688c1509d7febcff0322fbab END_FIXUP }; -From 5e831629bc1d7eefbe3a98bea00f0758a9fb1990 Mon Sep 17 00:00:00 2001 +From 148f74b9bd4ddb53da30cc68483cda09f3141128 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 7 May 2017 11:34:26 +0200 -Subject: [PATCH 137/173] ASoC: bcm2835: Add support for TDM modes +Subject: [PATCH 137/199] ASoC: bcm2835: Add support for TDM modes bcm2835 supports arbitrary positioning of channel data within a frame and thus is capable of supporting TDM modes. Since @@ -133425,10 +133425,10 @@ index 56df7d8a43d0aac055a91b0d24aca8e1b4e308e4..dcacf7f83c9371df539a788ea33fedcf dev->dev = &pdev->dev; dev_set_drvdata(&pdev->dev, dev); -From a6b31aa9fe739751f7f3990027408f1a6bde3cf0 Mon Sep 17 00:00:00 2001 +From ed59e6a2dcabd5acbcd729f41e89883903db5f3c Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 7 May 2017 15:30:50 +0200 -Subject: [PATCH 138/173] ASoC: bcm2835: Support left/right justified and DSP +Subject: [PATCH 138/199] ASoC: bcm2835: Support left/right justified and DSP modes DSP modes and left/right justified modes can be supported @@ -133674,10 +133674,10 @@ index dcacf7f83c9371df539a788ea33fedcf97d64690..3a706fda4f39e42efbe12f19d87af9b1 } -From 44e6d969cd8d8978d9d6e96cfde02566954ea6d9 Mon Sep 17 00:00:00 2001 +From 1d0d7a35213b5f4c125ee3b8ad2683d6bc0416dd Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 7 May 2017 16:19:54 +0200 -Subject: [PATCH 139/173] ASoC: bcm2835: Support additional samplerates up to +Subject: [PATCH 139/199] ASoC: bcm2835: Support additional samplerates up to 384kHz Sample rates are only restricted by the capabilities of the @@ -133720,10 +133720,10 @@ index 3a706fda4f39e42efbe12f19d87af9b100a348a5..43f5715a0d5dda851731ecf7ff27e76c | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE -From 35185a071e2e90872f7ccc8ba5110949300ce6fd Mon Sep 17 00:00:00 2001 +From 8c57e176565695388f73a7b32fb03cbd5c3057a8 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 7 May 2017 16:24:57 +0200 -Subject: [PATCH 140/173] ASoC: bcm2835: Enforce full symmetry +Subject: [PATCH 140/199] ASoC: bcm2835: Enforce full symmetry bcm2835's configuration registers can't be changed when a stream is running, which means asymmetric configurations aren't supported. @@ -133759,10 +133759,10 @@ index 43f5715a0d5dda851731ecf7ff27e76c48fb6e57..2e449d7173fcecbcd647f90a26bd58b6 static bool bcm2835_i2s_volatile_reg(struct device *dev, unsigned int reg) -From 45e973ed24dd64930b942ecfe824904f561cc00e Mon Sep 17 00:00:00 2001 +From e48bde7e25413678347f7df5e7f8c6f7a800414f Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Thu, 6 Jul 2017 18:52:16 +0200 -Subject: [PATCH 141/173] config: add missing arizona regulator modules +Subject: [PATCH 141/199] config: add missing arizona regulator modules In kernel 4.12 CONFIG_REGULATOR_ARIZONA was replaced by 2 separate options for LDO1 and MICSUPP regulators. Enable these, they are @@ -133812,10 +133812,10 @@ index bf0d3fd830a0a0cc9443ef52e7f167eb704ed152..06d0520e332f21afaa27ac112c0eee6c CONFIG_MEDIA_CAMERA_SUPPORT=y CONFIG_MEDIA_ANALOG_TV_SUPPORT=y -From 023dc39250043ccc51c52feac97e463813042707 Mon Sep 17 00:00:00 2001 +From 90114950656a0d9296e94dbf8a94fffc0446b88a Mon Sep 17 00:00:00 2001 From: Matt Flax Date: Tue, 4 Apr 2017 19:20:59 +1000 -Subject: [PATCH 142/173] Audioinjector : make the octo and pi sound cards have +Subject: [PATCH 142/199] Audioinjector : make the octo and pi sound cards have different driver names This patch gives the audioinjector octo and pi soundcards different driver @@ -133852,10 +133852,10 @@ index ef54e0f07ea03f59e9957b5d98f3e7fdc998e469..491906bbf446826e55dd843f28e4860f .of_match_table = audioinjector_pi_soundcard_of_match, }, -From d7ddfc8a6b3f9fce8c4ebc1b5f99219d2cc93289 Mon Sep 17 00:00:00 2001 +From 25a06d83084ed15b81d56b85174a50192709e86c Mon Sep 17 00:00:00 2001 From: Matt Flax Date: Tue, 4 Apr 2017 19:23:04 +1000 -Subject: [PATCH 143/173] Audioinjector octo : Make the playback and capture +Subject: [PATCH 143/199] Audioinjector octo : Make the playback and capture symmetric This patch ensures that the sample rate and channel count of the audioinjector @@ -133878,10 +133878,10 @@ index 49115c8e20ce1a2ba5a99feb8983a1cafb052ca2..5e79f4eff93a21ed3495c77a90f73525 }; -From 9d033a4fbcf7494550753f3d2d978300b6a9c9aa Mon Sep 17 00:00:00 2001 +From b09654f8d85cb6c9fbc59279bd3f2a4564126b39 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Sun, 23 Apr 2017 19:36:53 +0100 -Subject: [PATCH 144/173] BCM270X_DT: Add bme280 and bmp180 to i2c-sensor +Subject: [PATCH 144/199] BCM270X_DT: Add bme280 and bmp180 to i2c-sensor overlay Signed-off-by: Phil Elwell @@ -133955,10 +133955,10 @@ index 606b2d5012abf2e85712be631c42ea40a0b512c5..e23e34b32a0a8927c14203d7384e8008 lm75 = <&lm75>,"status"; lm75addr = <&lm75>,"reg:0"; -From bc28b940403b534e37ded263719bf201b6552eab Mon Sep 17 00:00:00 2001 +From b7fc8e2213909c6d61e41b60ef4fc78f3bd89ead Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Sun, 23 Apr 2017 19:38:06 +0100 -Subject: [PATCH 145/173] config: Add CONFIG_BMP280 (and CONFIG_BMP280_I2C) +Subject: [PATCH 145/199] config: Add CONFIG_BMP280 (and CONFIG_BMP280_I2C) Signed-off-by: Phil Elwell --- @@ -133991,10 +133991,10 @@ index 06d0520e332f21afaa27ac112c0eee6c36a9a9df..515f335d2a638de60d07a45df19ce52a CONFIG_PWM_PCA9685=m CONFIG_RASPBERRYPI_FIRMWARE=y -From 05b3c24c5689b336a7b3114e08bb75ff07df5507 Mon Sep 17 00:00:00 2001 +From 4f1d23ff9a0a14fbf2917b305c3b0c858bdfaf18 Mon Sep 17 00:00:00 2001 From: Scott Ellis Date: Tue, 25 Apr 2017 10:46:09 -0400 -Subject: [PATCH 146/173] config: Enable TI TMP102 temp sensor module +Subject: [PATCH 146/199] config: Enable TI TMP102 temp sensor module Signed-off-by: Scott Ellis --- @@ -134027,10 +134027,10 @@ index 515f335d2a638de60d07a45df19ce52a7579f9ca..bfda35e4c4bce99b5125eab80f97c73a CONFIG_BCM2835_THERMAL=y CONFIG_WATCHDOG=y -From e70fd08d60935d04026931c60a6ebc7115e1fe2c Mon Sep 17 00:00:00 2001 +From c26f16dc876ad99e7844cd4bf82d4d0f5bbf4f4c Mon Sep 17 00:00:00 2001 From: Scott Ellis Date: Tue, 25 Apr 2017 13:05:42 -0400 -Subject: [PATCH 147/173] BCM270X_DT: Add tmp102 to i2c sensor overlay +Subject: [PATCH 147/199] BCM270X_DT: Add tmp102 to i2c sensor overlay Signed-off-by: Scott Ellis --- @@ -134110,10 +134110,10 @@ index e23e34b32a0a8927c14203d7384e800878627347..e86a13f92c3f75c14fa4425cdfb081d6 }; }; -From 80ff6ff1ba623da4a2e680a4ea641d47ad00c93d Mon Sep 17 00:00:00 2001 +From e1367891bcf2949e985ce41739c6809a3764ee36 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 8 May 2017 16:43:40 +0100 -Subject: [PATCH 148/173] irq_bcm2836: Send event when onlining sleeping cores +Subject: [PATCH 148/199] irq_bcm2836: Send event when onlining sleeping cores In order to reduce power consumption and bus traffic, it is sensible for secondary cores to enter a low-power idle state when waiting to @@ -134149,10 +134149,10 @@ index 9a7ee04ee0d9b7aa734cf3159ed59c19a338de0d..014f13f89eb896f5cfc75ed9891787d0 } -From ae1b61f594b8a110ee91f13b30bedf6eea13ff4e Mon Sep 17 00:00:00 2001 +From c1096ba9690c05fe9a6cbea5eb3d9c72e6ee26b9 Mon Sep 17 00:00:00 2001 From: Ahmet Inan Date: Mon, 15 May 2017 17:10:53 +0200 -Subject: [PATCH 149/173] overlays: Add Goodix overlay +Subject: [PATCH 149/199] overlays: Add Goodix overlay Add support for I2C connected Goodix gt9271 multiple touch controller using GPIOs 4 and 17 (pins 7 and 11 on GPIO header) for interrupt and reset. @@ -134249,10 +134249,10 @@ index 0000000000000000000000000000000000000000..084f74042ed6379ebd9281374d5391a7 + }; +}; -From c183f774a63c80cae7889f78d070eb5ce325cf9b Mon Sep 17 00:00:00 2001 +From e1c8d419eaa87b324f8faa4303b0a075054ce320 Mon Sep 17 00:00:00 2001 From: chenzhiwo Date: Wed, 17 May 2017 16:34:57 +0800 -Subject: [PATCH 150/173] Add device tree overlay for GPIO connected rotary +Subject: [PATCH 150/199] Add device tree overlay for GPIO connected rotary encoder. See Documentation/input/rotary-encoder.txt for more information. --- @@ -134344,10 +134344,10 @@ index 0000000000000000000000000000000000000000..c0c6bccff60cc15d9a9bf59d2c7cba41 + }; +}; -From 9c1c2351c13ce7b2d20de04a438125bb0d75734d Mon Sep 17 00:00:00 2001 +From 1c93193e5e386627af60793a8d07fe1ace5dac69 Mon Sep 17 00:00:00 2001 From: Anton Onishchenko Date: Tue, 23 May 2017 18:55:46 +0300 -Subject: [PATCH 151/173] mpu6050 device tree overlay (#2031) +Subject: [PATCH 151/199] mpu6050 device tree overlay (#2031) Add overlay and config options for InvenSense MPU6050 6-axis motion detector. @@ -134462,10 +134462,10 @@ index bfda35e4c4bce99b5125eab80f97c73a159de969..a9841b71a4b633a81392c533578845d6 CONFIG_PWM_BCM2835=m CONFIG_PWM_PCA9685=m -From 3bcb0faa9c3c8d30eb78355ee4897c551a2b5ab4 Mon Sep 17 00:00:00 2001 +From e8fad7705817fb3df7cfea84330f44ec33a81e1f Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 31 May 2017 09:33:55 +0100 -Subject: [PATCH 152/173] config: Adding SENSOR_JC42 +Subject: [PATCH 152/199] config: Adding SENSOR_JC42 The jc42 module supports a number of I2C-based temperature sensor modules. @@ -134505,10 +134505,10 @@ index a9841b71a4b633a81392c533578845d62f6aa78f..2ba46a28c2e7b21a401cc3544353937e CONFIG_SENSORS_SHT21=m CONFIG_SENSORS_SHTC1=m -From 0b1e677ecc506655be6c22dd09851ad6ddd69982 Mon Sep 17 00:00:00 2001 +From 26d098a745698f39dbb3d6b5c047f8ffd6850571 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 31 May 2017 15:27:39 +0100 -Subject: [PATCH 153/173] BCM270X_DT: Improve i2c-sensor and i2c-rtc overlay +Subject: [PATCH 153/199] BCM270X_DT: Improve i2c-sensor and i2c-rtc overlay Use the "__dormant__" feature to permit multiple instances of each overlay, which is more useful now that changing the "reg" property @@ -134873,10 +134873,10 @@ index e86a13f92c3f75c14fa4425cdfb081d6795ff76a..d2f0008addfadac8f6ed774a6e4f3f97 }; }; -From 52595ff8c04eae49d88eaf32b9d74cab4b898773 Mon Sep 17 00:00:00 2001 +From 37967c394186b977fd8ded2df143c105346fbd29 Mon Sep 17 00:00:00 2001 From: Stefan Tatschner Date: Mon, 29 May 2017 21:46:16 +0200 -Subject: [PATCH 154/173] Add device tree config for htu21 +Subject: [PATCH 154/199] Add device tree config for htu21 See: https://github.com/raspberrypi/linux/pull/2041 @@ -134958,10 +134958,10 @@ index d2f0008addfadac8f6ed774a6e4f3f97871c0d61..17c27e3b666a7a83619471b50c63bb93 }; }; -From f216bda69d0eda5a267c97047826989a4512e711 Mon Sep 17 00:00:00 2001 +From 081570902a67ff8f1d521a669a31cf18a7de5ee3 Mon Sep 17 00:00:00 2001 From: sandeepal Date: Fri, 2 Jun 2017 18:59:46 +0530 -Subject: [PATCH 155/173] Allo Digione Driver (#2048) +Subject: [PATCH 155/199] Allo Digione Driver (#2048) Driver for the Allo Digione soundcard --- @@ -135392,10 +135392,10 @@ index 0000000000000000000000000000000000000000..e3664e44c699d0102120ecf99e8b780a +MODULE_DESCRIPTION("ASoC Driver for Allo DigiOne"); +MODULE_LICENSE("GPL v2"); -From f8b82a9b4a3c6441b44117532d48a136e80ad45e Mon Sep 17 00:00:00 2001 +From 9e07aa4160a12bbe686fa3d8363c90b2d9a0201c Mon Sep 17 00:00:00 2001 From: Andrei Gherzan Date: Mon, 5 Jun 2017 16:40:38 +0100 -Subject: [PATCH 156/173] dma-bcm2708: Fix module compilation of +Subject: [PATCH 156/199] dma-bcm2708: Fix module compilation of CONFIG_DMA_BCM2708 bcm2708-dmaengine.c defines functions like bcm_dma_start which are @@ -135438,10 +135438,10 @@ index c5bfff2765be4606077e6c8af73040ec13ee8974..6ca874d332a8bc666b1c9576ac51f479 #endif /* _PLAT_BCM2708_DMA_H */ -From 80c2c56f8363ee02686636240a31a304da2a15e9 Mon Sep 17 00:00:00 2001 +From 3fc44a2838a8ec6407db3952ba1abeab96cdc280 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 20 Jun 2017 17:51:47 +0100 -Subject: [PATCH 157/173] bcm2835-cpufreq: Change licence to GPLv2 +Subject: [PATCH 157/199] bcm2835-cpufreq: Change licence to GPLv2 Signed-off-by: Eben Upton Signed-off-by: Dom Cobley @@ -135494,10 +135494,10 @@ index 414fbdc10dfbfc6e4bb47870a7af3fd5780f9c9a..99345969b0e4d651fd9033d67de2febb /* ---------- INCLUDES ---------- */ #include -From e94077bd011f60fc34f14a722f088d9842102162 Mon Sep 17 00:00:00 2001 +From 195119d1056c9ade9c1e515ec76a841246950439 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 21 Jun 2017 09:03:51 -0700 -Subject: [PATCH 158/173] bcm2708: Drop CMA alignment from FKMS mode as well. +Subject: [PATCH 158/199] bcm2708: Drop CMA alignment from FKMS mode as well. I dropped it from KMS mode in d88274d88ed81de1ade8e18e4c0ed91792ec82ea and should have done both of them at that time. @@ -135553,10 +135553,10 @@ index 95a595a35cb4fbb707bf4b18161f6a46860aa4ae..36fbf6c8c2e612a6dc5aa02d77cc8173 }; -From fc3cb5a0158c0a950571fe0d7612558f5385ce2f Mon Sep 17 00:00:00 2001 +From b237eda1698d0f8b3d7f301a19bcd22c5a022e02 Mon Sep 17 00:00:00 2001 From: Steve Conner Date: Thu, 29 Jun 2017 15:56:19 +0100 -Subject: [PATCH 159/173] New i2c-rtc-gpio device overlay (#2092) +Subject: [PATCH 159/199] New i2c-rtc-gpio device overlay (#2092) Created new i2c-rtc-gpio device overlay by combining i2c-rtc and i2c-gpio. Tested with PCF2127 on CM3. --- @@ -135820,10 +135820,10 @@ index 0000000000000000000000000000000000000000..8415e6081428fba9a47682964174fc02 + }; +}; -From 8764e8f87f6ee8a31c0ee25485b48e61797c6b8a Mon Sep 17 00:00:00 2001 +From 1c2f537195ee1225872b67f9e590f018a31458cc Mon Sep 17 00:00:00 2001 From: Allo Date: Mon, 3 Jul 2017 15:45:20 +0530 -Subject: [PATCH 160/173] PianoPlus: Dual Mono & Dual Stereo features added +Subject: [PATCH 160/199] PianoPlus: Dual Mono & Dual Stereo features added (#2069) --- @@ -136112,10 +136112,10 @@ index 56e43f98846b41e487b3089813f7edc3c08517eb..d4e99e3c6a383d92fb0cf9e8c1cd1e76 } -From d5506bfa946eb2799dd9ffb8b904ff801651ffb7 Mon Sep 17 00:00:00 2001 +From d53373d18c9457b4b568a5c677f99948bf168c9b Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Sun, 9 Jul 2017 15:15:22 +0200 -Subject: [PATCH 161/173] overlays: Add gpio-shutdown overlay (#2103) +Subject: [PATCH 161/199] overlays: Add gpio-shutdown overlay (#2103) This overlay facilitates the addition of a powerbutton by converting GPIO edges into KEY_POWER keypresses, which can be handled by @@ -136271,10 +136271,10 @@ index 0000000000000000000000000000000000000000..863fb395c8539734b658682b900e1fbd + +}; -From a1cc7e0ae96efd623d7d54ba1d55fa213fb9c8c2 Mon Sep 17 00:00:00 2001 +From b3e2ae06f89faa852481a752f72ad723b9c2872d Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Mon, 10 Jul 2017 11:05:17 +0200 -Subject: [PATCH 162/173] config: enable generic S/PDIF codec drivers (#2104) +Subject: [PATCH 162/199] config: enable generic S/PDIF codec drivers (#2104) These drivers can be used as dummy ADC/DAC drivers for attaching general codecs that don't need to be configured. @@ -136331,10 +136331,10 @@ index efdb0fbc1b07c7b679cb20d8c1270c77d5d3c684..472a330439a19ac5d4f70c22059f0158 CONFIG_SND_SIMPLE_CARD=m CONFIG_HIDRAW=y -From bba1b7cbb27a7284d6733d26a4d2e704d7f5f5d6 Mon Sep 17 00:00:00 2001 +From a3c828c08394e2b4c2dbd383f14a02a5c4a6fd36 Mon Sep 17 00:00:00 2001 From: Bilal Amarni Date: Wed, 24 May 2017 10:52:50 +0200 -Subject: [PATCH 163/173] [ARM64] enable drivers for GPIO expander and vcio +Subject: [PATCH 163/199] [ARM64] enable drivers for GPIO expander and vcio --- arch/arm64/configs/bcmrpi3_defconfig | 3 +++ @@ -136362,10 +136362,10 @@ index 4d85c231c5ea0244e1b05fb4a5e3c8fd3e651ddf..9dcb58a519d041fadae99c81a7bda621 CONFIG_GPIO_ARIZONA=m CONFIG_GPIO_STMPE=y -From 0497442c11084d7658140f1d0c12e1366a08bf10 Mon Sep 17 00:00:00 2001 +From 2e172ac9071f7f9bada854ebdf5c0d2b4d83058d Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 14 Jul 2017 12:59:55 +0100 -Subject: [PATCH 164/173] bcm2835-mmc: Fix DMA usage +Subject: [PATCH 164/199] bcm2835-mmc: Fix DMA usage The previous change ("bcm2835-mmc: Only claim one DMA channel") used an incorrect variable, the effect of which was to prevent @@ -136400,10 +136400,10 @@ index 4fe8d1fe44578fbefcd48f8c327ba3d03f3d0a2a..981db05de1ff52a83550e41ab362eecf } #endif -From d44a3ce8b3a6a47686f34b6dcc20fc990c5411bc Mon Sep 17 00:00:00 2001 +From 3306429bf95ee0c901200f0b2d9d48ab0da71670 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 16 Jul 2017 21:39:16 +0100 -Subject: [PATCH 165/173] BCM270X_DT: Use the upstream thermal-zones DT node +Subject: [PATCH 165/199] BCM270X_DT: Use the upstream thermal-zones DT node Signed-off-by: Phil Elwell --- @@ -136456,10 +136456,10 @@ index 29dde110e769082a24640d3c7284afb8e99b226c..8cc83a350d02bb485f7a4fcb129df9e0 + /delete-node/ trips; +}; -From 755af56f608bde7a8c4bb223f72a2945503c753b Mon Sep 17 00:00:00 2001 +From 1387c9b1eaa70ec95ee23541a00558c35290c418 Mon Sep 17 00:00:00 2001 From: Conn Date: Mon, 17 Jul 2017 03:25:43 +0100 -Subject: [PATCH 166/173] config: enhance DualShock3 controller support +Subject: [PATCH 166/199] config: enhance DualShock3 controller support Enable rumble support in Sony HID & HID battery strength. --- @@ -136508,10 +136508,10 @@ index 472a330439a19ac5d4f70c22059f015816823694..e0dd8723047ff488e81a03ef42fdbc68 CONFIG_HID_SUNPLUS=m CONFIG_HID_GREENASIA=m -From 000bbf308083a5facd5fa5022a941683550d561d Mon Sep 17 00:00:00 2001 +From bc31dbda132e79151d52eb4bf1cc394579e01636 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 19 Jul 2017 15:20:50 +0100 -Subject: [PATCH 167/173] overlays: i2c1-bcm2708: Don't overwrite i2c1 pins +Subject: [PATCH 167/199] overlays: i2c1-bcm2708: Don't overwrite i2c1 pins node It is bad practise to overwrite an entire node in an overlay. Instead, @@ -136556,10 +136556,10 @@ index e303b9c61c82a28eab7b48f6b085661574d5a849..7c69047bcd88a5c900dddd08e60ad075 }; }; -From ea1f4704015786c01fbfd270f3a11bf5f550cc13 Mon Sep 17 00:00:00 2001 +From ce85845a5685a4434480ad5dfd40db9874f6420e Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 18 Jul 2017 15:30:48 +0100 -Subject: [PATCH 168/173] bcm2835-mmc: Prevent DMA race condition +Subject: [PATCH 168/199] bcm2835-mmc: Prevent DMA race condition The end of a read operation is triggered by the completion of the DMA transfer, but writes are complete when the data IRQ is raised. The @@ -136626,10 +136626,10 @@ index 981db05de1ff52a83550e41ab362eecf99cafa29..c4a5e992c6fb4a40b933239350ed4bfc static void bcm2835_mmc_finish_command(struct bcm2835_host *host) -From 680b71b741156963a7bafea1f8a8e1a35d2c1219 Mon Sep 17 00:00:00 2001 +From 15a60a588cd4c94bdc2a64b299022a87b026492a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sven=20K=C3=B6hler?= Date: Mon, 7 Aug 2017 18:49:20 +0200 -Subject: [PATCH 169/173] Fix dependencies broken since driver was renamed +Subject: [PATCH 169/199] Fix dependencies broken since driver was renamed --- drivers/mmc/host/Kconfig | 2 +- @@ -136649,10 +136649,10 @@ index d47cce77c0551d78fa51f50e2c8086f26c7b9e56..dc41121c101e2ac6fe000fe2ab556561 default 2 help -From 0e7c5fbfb2d9173f593a8fefe4bbd727b8de361f Mon Sep 17 00:00:00 2001 +From 654e2f24028ac2d6e77a73a721abef0370d97e0e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 18 Dec 2014 16:07:15 -0800 -Subject: [PATCH 170/173] mm: Remove the PFN busy warning +Subject: [PATCH 170/199] mm: Remove the PFN busy warning See commit dae803e165a11bc88ca8dbc07a11077caf97bbcb -- the warning is expected sometimes when using CMA. However, that commit still spams @@ -136677,10 +136677,10 @@ index 1423da8dd16f5bdc83e20ddf6665b2022a9a6492..6ce930c02160d55dc4eee1e7197a5efa goto done; } -From 3349f1df8142f5463d3a856483691b10eb44e016 Mon Sep 17 00:00:00 2001 +From 8b77f5ca66868bf1818caa3fe5e82da9ed865ab4 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 25 Aug 2017 19:18:13 +0100 -Subject: [PATCH 171/173] cache: export clean and invalidate +Subject: [PATCH 171/199] cache: export clean and invalidate --- arch/arm/mm/cache-v6.S | 4 ++-- @@ -136732,10 +136732,10 @@ index de78109d002db1a5e7c94a6c1bc8bb94161d07b8..4c850aa3af2b2439fced4e130441329a sub r3, r2, #1 bic r0, r0, r3 -From d0795818dbfcdb270b5c3b9d3bdccd29b1208d5d Mon Sep 17 00:00:00 2001 +From f323840a871fd84eef5874ed9c5022f7a56e9d63 Mon Sep 17 00:00:00 2001 From: Olivier Schonken Date: Mon, 28 Aug 2017 10:52:32 +0200 -Subject: [PATCH 172/173] Fix DTB overlay compilation for arm64 broadcom +Subject: [PATCH 172/199] Fix DTB overlay compilation for arm64 broadcom The dts-dirs variable was overwritten by the assignment of the stingray directory after the overlays directory, thus no overlays @@ -136760,10 +136760,10 @@ index 97af2ececc52ca3aad7b84dc2fdb5c269a45bde0..3b76320112196a1fce7a0941c696fd1e subdir-y := $(dts-dirs) clean-files := *.dtb -From 80d497d63c3cb89e861723360e653fb2d7750940 Mon Sep 17 00:00:00 2001 +From bc2614057d17b6376b461795493a9bc4f504c0f6 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 25 Aug 2017 19:18:26 +0100 -Subject: [PATCH 173/173] vcsm: Provide new ioctl to clean/invalidate a 2D +Subject: [PATCH 173/199] vcsm: Provide new ioctl to clean/invalidate a 2D block --- @@ -136945,3 +136945,5049 @@ index 334f36d0d697b047df2922b5f2db67f38cf76564..2de7f1f41070689c99cad3bd43d11745 #define VMCS_SM_IOCTL_SIZE_USR_HDL\ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_SIZE_USR_HANDLE,\ + +From d174670aa6c4cd1b1d2aba4562c1d8af40858cc5 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Wed, 15 Feb 2017 11:16:05 +0000 +Subject: [PATCH 174/199] VCSM: Specify pointers in IPC msgs as uint32_t + +Pointers were specified as void* which will fail +rather badly if the kernel is switched to 64 bit. +GPU wants 32 bit addresses, so use uint32_t and +cast whereever necessary. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vc_sm_defs.h | 12 ++++---- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 52 +++++++++++++++++--------------- + 2 files changed, 33 insertions(+), 31 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_defs.h b/drivers/char/broadcom/vc_sm/vc_sm_defs.h +index c4d5ff718a5ba9071ef87fa4c6cf632486c4d36f..6c19aac6dc9df90edb9432bc32e7477d532d3278 100644 +--- a/drivers/char/broadcom/vc_sm/vc_sm_defs.h ++++ b/drivers/char/broadcom/vc_sm/vc_sm_defs.h +@@ -88,7 +88,7 @@ typedef struct { + /* Resource handle */ + uint32_t res_handle; + /* Pointer to resource buffer */ +- void *res_mem; ++ uint32_t res_mem; + /* Resource base size (bytes) */ + uint32_t res_base_size; + /* Resource number */ +@@ -101,7 +101,7 @@ typedef struct { + /* Resource handle (returned from alloc) */ + uint32_t res_handle; + /* Resource buffer (returned from alloc) */ +- void *res_mem; ++ uint32_t res_mem; + + } VC_SM_FREE_T; + +@@ -110,7 +110,7 @@ typedef struct { + /* Resource handle (returned from alloc) */ + uint32_t res_handle; + /* Resource buffer (returned from alloc) */ +- void *res_mem; ++ uint32_t res_mem; + + } VC_SM_LOCK_UNLOCK_T; + +@@ -119,7 +119,7 @@ typedef struct { + /* Resource handle (returned from alloc) */ + uint32_t res_handle; + /* Resource buffer (returned from alloc) */ +- void *res_mem; ++ uint32_t res_mem; + /* Resource *new* size requested (bytes) */ + uint32_t res_new_size; + +@@ -133,10 +133,10 @@ typedef struct { + /* Resource handle */ + uint32_t res_handle; + /* Pointer to resource buffer */ +- void *res_mem; ++ uint32_t res_mem; + /* Pointer to former resource buffer if the memory + * was reallocated */ +- void *res_old_mem; ++ uint32_t res_old_mem; + + } VC_SM_LOCK_RESULT_T; + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index d49e39566d521c95a96375c556516e444d52b6a0..1afea701625157e9d9bc9570240c0b1afb186f56 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -877,7 +877,7 @@ static void vmcs_sm_release_resource(struct SM_RESOURCE_T *resource, int force) + */ + if (resource->res_handle) { + VC_SM_FREE_T free = { +- resource->res_handle, resource->res_base_mem ++ resource->res_handle, (uint32_t)resource->res_base_mem + }; + int status = vc_vchi_sm_free(sm_state->sm_handle, &free, + &private->int_trans_id); +@@ -1136,17 +1136,17 @@ static int vcsm_vma_fault(struct vm_fault *vmf) + int status; + + lock_unlock.res_handle = resource->res_handle; +- lock_unlock.res_mem = resource->res_base_mem; ++ lock_unlock.res_mem = (uint32_t)resource->res_base_mem; + + pr_debug("[%s]: attempt to lock data - hdl %x, base address %p\n", +- __func__, lock_unlock.res_handle, lock_unlock.res_mem); ++ __func__, lock_unlock.res_handle, ++ (void *)lock_unlock.res_mem); + + /* Lock the videocore allocated resource. + */ + status = vc_vchi_sm_lock(sm_state->sm_handle, + &lock_unlock, &lock_result, 0); +- if ((status != 0) || +- ((status == 0) && (lock_result.res_mem == NULL))) { ++ if (status || !lock_result.res_mem) { + pr_err("[%s]: failed to lock memory on videocore (status: %u)\n", + __func__, status); + resource->res_stats[LOCK_FAIL]++; +@@ -1162,10 +1162,10 @@ static int vcsm_vma_fault(struct vm_fault *vmf) + + /* Keep track of the new base memory. + */ +- if ((lock_result.res_mem != NULL) && +- (lock_result.res_old_mem != NULL) && ++ if (lock_result.res_mem && ++ lock_result.res_old_mem && + (lock_result.res_mem != lock_result.res_old_mem)) { +- resource->res_base_mem = lock_result.res_mem; ++ resource->res_base_mem = (void *)lock_result.res_mem; + } + } + +@@ -1464,7 +1464,7 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + private->restart_sys = -EINTR; + private->int_action = VC_SM_MSG_TYPE_ALLOC; + goto error; +- } else if (status != 0 || (status == 0 && result.res_mem == NULL)) { ++ } else if (status != 0 || !result.res_mem) { + pr_err("[%s]: failed to allocate memory on videocore (status: %u, trans_id: %u)\n", + __func__, status, private->int_trans_id); + ret = -ENOMEM; +@@ -1476,7 +1476,7 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + */ + resource->private = private; + resource->res_handle = result.res_handle; +- resource->res_base_mem = result.res_mem; ++ resource->res_base_mem = (void *)result.res_mem; + resource->res_size = alloc.base_unit * alloc.num_unit; + resource->res_cached = cached; + resource->map = map; +@@ -1654,11 +1654,12 @@ static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + } + + resize.res_handle = resource->res_handle; +- resize.res_mem = resource->res_base_mem; ++ resize.res_mem = (uint32_t)resource->res_base_mem; + resize.res_new_size = ioparam->new_size; + + pr_debug("[%s]: attempt to resize data - guid %x, hdl %x, base address %p\n", +- __func__, ioparam->handle, resize.res_handle, resize.res_mem); ++ __func__, ioparam->handle, resize.res_handle, ++ (void *)resize.res_mem); + + /* Resize the videocore allocated resource. + */ +@@ -1671,7 +1672,7 @@ static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + private->restart_sys = -EINTR; + private->int_action = VC_SM_MSG_TYPE_RESIZE; + goto error; +- } else if (status != 0) { ++ } else if (status) { + pr_err("[%s]: failed to resize memory on videocore (status: %u, trans_id: %u)\n", + __func__, status, private->int_trans_id); + ret = -EPERM; +@@ -1729,14 +1730,14 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + } + + lock.res_handle = resource->res_handle; +- lock.res_mem = resource->res_base_mem; ++ lock.res_mem = (uint32_t)resource->res_base_mem; + + /* Take the lock and get the address to be mapped. + */ + if (vc_addr == 0) { + pr_debug("[%s]: attempt to lock data - guid %x, hdl %x, base address %p\n", + __func__, ioparam->handle, lock.res_handle, +- lock.res_mem); ++ (void *)lock.res_mem); + + /* Lock the videocore allocated resource. + */ +@@ -1749,8 +1750,8 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + private->restart_sys = -EINTR; + private->int_action = VC_SM_MSG_TYPE_LOCK; + goto error; +- } else if (status != 0 || +- (status == 0 && result.res_mem == NULL)) { ++ } else if (status || ++ (!status && !(void *)result.res_mem)) { + pr_err("[%s]: failed to lock memory on videocore (status: %u, trans_id: %u)\n", + __func__, status, private->int_trans_id); + ret = -EPERM; +@@ -1759,8 +1760,8 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + } + + pr_debug("[%s]: succeed to lock data - hdl %x, base address %p (%p), ref-cnt %d\n", +- __func__, lock.res_handle, result.res_mem, +- lock.res_mem, resource->lock_count); ++ __func__, lock.res_handle, (void *)result.res_mem, ++ (void *)lock.res_mem, resource->lock_count); + } + /* Lock assumed taken already, address to be mapped is known. + */ +@@ -1773,10 +1774,10 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + /* Keep track of the new base memory allocation if it has changed. + */ + if ((vc_addr == 0) && +- (result.res_mem != NULL) && +- (result.res_old_mem != NULL) && ++ ((void *)result.res_mem) && ++ ((void *)result.res_old_mem) && + (result.res_mem != result.res_old_mem)) { +- resource->res_base_mem = result.res_mem; ++ resource->res_base_mem = (void *)result.res_mem; + + /* Kernel allocated resources. + */ +@@ -1901,10 +1902,11 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + } + + unlock.res_handle = resource->res_handle; +- unlock.res_mem = resource->res_base_mem; ++ unlock.res_mem = (uint32_t)resource->res_base_mem; + + pr_debug("[%s]: attempt to unlock data - guid %x, hdl %x, base address %p\n", +- __func__, ioparam->handle, unlock.res_handle, unlock.res_mem); ++ __func__, ioparam->handle, unlock.res_handle, ++ (void *)unlock.res_mem); + + /* User space allocated resources. + */ +@@ -2039,7 +2041,7 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + } + + pr_debug("[%s]: success to unlock data - hdl %x, base address %p, ref-cnt %d\n", +- __func__, unlock.res_handle, unlock.res_mem, ++ __func__, unlock.res_handle, (void *)unlock.res_mem, + resource->lock_count); + + error: + +From 3236e9ea6a3af523b256026f0c78e9a5e9d1e986 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 19 May 2017 14:29:12 +0100 +Subject: [PATCH 175/199] vcsm: code-style: Fix comment indentation + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vc_vchi_sm.h | 58 +++++++++++++++++++------------- + 1 file changed, 34 insertions(+), 24 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +index 5e279f5a95fac7227cea15941bf0570ddc2b0886..f8e555dc30074e7ff226cf34a96aa30a34176775 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +@@ -19,63 +19,73 @@ + + #include "vc_sm_defs.h" + +-/* Forward declare. ++/* ++ * Forward declare. + */ + typedef struct sm_instance *VC_VCHI_SM_HANDLE_T; + +-/* Initialize the shared memory service, opens up vchi connection to talk to it. +-*/ ++/* ++ * Initialize the shared memory service, opens up vchi connection to talk to it. ++ */ + VC_VCHI_SM_HANDLE_T vc_vchi_sm_init(VCHI_INSTANCE_T vchi_instance, + VCHI_CONNECTION_T **vchi_connections, + uint32_t num_connections); + +-/* Terminates the shared memory service. +-*/ ++/* ++ * Terminates the shared memory service. ++ */ + int vc_vchi_sm_stop(VC_VCHI_SM_HANDLE_T *handle); + +-/* Ask the shared memory service to allocate some memory on videocre and +-** return the result of this allocation (which upon success will be a pointer +-** to some memory in videocore space). +-*/ ++/* ++ * Ask the shared memory service to allocate some memory on videocre and ++ * return the result of this allocation (which upon success will be a pointer ++ * to some memory in videocore space). ++ */ + int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, + VC_SM_ALLOC_T *alloc, + VC_SM_ALLOC_RESULT_T *alloc_result, uint32_t *trans_id); + +-/* Ask the shared memory service to free up some memory that was previously +-** allocated by the vc_vchi_sm_alloc function call. +-*/ ++/* ++ * Ask the shared memory service to free up some memory that was previously ++ * allocated by the vc_vchi_sm_alloc function call. ++ */ + int vc_vchi_sm_free(VC_VCHI_SM_HANDLE_T handle, + VC_SM_FREE_T *free, uint32_t *trans_id); + +-/* Ask the shared memory service to lock up some memory that was previously +-** allocated by the vc_vchi_sm_alloc function call. ++/* ++ * Ask the shared memory service to lock up some memory that was previously ++ * allocated by the vc_vchi_sm_alloc function call. + */ + int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, + VC_SM_LOCK_UNLOCK_T *lock_unlock, + VC_SM_LOCK_RESULT_T *lock_result, uint32_t *trans_id); + +-/* Ask the shared memory service to unlock some memory that was previously +-** allocated by the vc_vchi_sm_alloc function call. ++/* ++ * Ask the shared memory service to unlock some memory that was previously ++ * allocated by the vc_vchi_sm_alloc function call. + */ + int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, + VC_SM_LOCK_UNLOCK_T *lock_unlock, + uint32_t *trans_id, uint8_t wait_reply); + +-/* Ask the shared memory service to resize some memory that was previously +-** allocated by the vc_vchi_sm_alloc function call. ++/* ++ * Ask the shared memory service to resize some memory that was previously ++ * allocated by the vc_vchi_sm_alloc function call. + */ + int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, + VC_SM_RESIZE_T *resize, uint32_t *trans_id); + +-/* Walk the allocated resources on the videocore side, the allocation will +-** show up in the log. This is purely for debug/information and takes no +-** specific actions. ++/* ++ * Walk the allocated resources on the videocore side, the allocation will ++ * show up in the log. This is purely for debug/information and takes no ++ * specific actions. + */ + int vc_vchi_sm_walk_alloc(VC_VCHI_SM_HANDLE_T handle); + +-/* Clean up following a previously interrupted action which left the system +-** in a bad state of some sort. +-*/ ++/* ++ * Clean up following a previously interrupted action which left the system ++ * in a bad state of some sort. ++ */ + int vc_vchi_sm_clean_up(VC_VCHI_SM_HANDLE_T handle, + VC_SM_ACTION_CLEAN_T *action_clean); + + +From 68bbef13e2711d22165067282f7443c73f968114 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 25 Aug 2017 15:58:57 +0100 +Subject: [PATCH 176/199] vcsm: Convert to loading via device tree. + +Signed-off-by: Dave Stevenson +--- + arch/arm/boot/dts/bcm2708-rpi.dtsi | 6 ++++ + drivers/char/broadcom/vc_sm/vmcs_sm.c | 53 ++++++++++++++++++++++++----------- + 2 files changed, 43 insertions(+), 16 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708-rpi.dtsi b/arch/arm/boot/dts/bcm2708-rpi.dtsi +index 8cc83a350d02bb485f7a4fcb129df9e00fb3f958..f88b844f0aff82742966fd820f6f69cf25c2dfab 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi.dtsi ++++ b/arch/arm/boot/dts/bcm2708-rpi.dtsi +@@ -74,6 +74,12 @@ + firmware = <&firmware>; + }; + ++ vcsm: vcsm { ++ compatible = "raspberrypi,bcm2835-vcsm"; ++ firmware = <&firmware>; ++ status = "okay"; ++ }; ++ + thermal: thermal@7e212000 { + #thermal-sensor-cells = <0>; + status = "okay"; +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 1afea701625157e9d9bc9570240c0b1afb186f56..eb0d3f8a8c27863a5469d0ac224aab65145e7560 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -27,6 +27,8 @@ + #include + #include + #include ++#include ++#include + #include + #include + #include +@@ -45,6 +47,7 @@ + /* ---- Private Constants and Types --------------------------------------- */ + + #define DEVICE_NAME "vcsm" ++#define DRIVER_NAME "bcm2835-vcsm" + #define DEVICE_MINOR 0 + + #define VC_SM_DIR_ROOT_NAME "vc-smem" +@@ -165,6 +168,7 @@ struct SM_PRIV_DATA_T { + /* Global state information. + */ + struct SM_STATE_T { ++ struct platform_device *pdev; + VC_VCHI_SM_HANDLE_T sm_handle; /* Handle for videocore service. */ + struct dentry *dir_root; /* Debug fs entries root. */ + struct dentry *dir_alloc; /* Debug fs entries allocations. */ +@@ -3000,18 +3004,6 @@ static void vc_sm_connected_init(void) + + pr_info("[%s]: start\n", __func__); + +- /* Allocate memory for the state structure. +- */ +- sm_state = kzalloc(sizeof(struct SM_STATE_T), GFP_KERNEL); +- if (sm_state == NULL) { +- pr_err("[%s]: failed to allocate memory\n", __func__); +- ret = -ENOMEM; +- goto out; +- } +- +- mutex_init(&sm_state->lock); +- mutex_init(&sm_state->map_lock); +- + /* Initialize and create a VCHI connection for the shared memory service + ** running on videocore. + */ +@@ -3104,15 +3096,23 @@ static void vc_sm_connected_init(void) + } + + /* Driver loading. */ +-static int __init vc_sm_init(void) ++static int bcm2835_vcsm_probe(struct platform_device *pdev) + { + pr_info("vc-sm: Videocore shared memory driver\n"); ++ ++ sm_state = kzalloc(sizeof(*sm_state), GFP_KERNEL); ++ if (!sm_state) ++ return -ENOMEM; ++ sm_state->pdev = pdev; ++ mutex_init(&sm_state->lock); ++ mutex_init(&sm_state->map_lock); ++ + vchiq_add_connected_callback(vc_sm_connected_init); + return 0; + } + + /* Driver unloading. */ +-static void __exit vc_sm_exit(void) ++static int bcm2835_vcsm_remove(struct platform_device *pdev) + { + pr_debug("[%s]: start\n", __func__); + if (sm_inited) { +@@ -3135,6 +3135,7 @@ static void __exit vc_sm_exit(void) + } + + pr_debug("[%s]: end\n", __func__); ++ return 0; + } + + #if defined(__KERNEL__) +@@ -3302,8 +3303,28 @@ int vc_sm_map(int handle, unsigned int sm_addr, VC_SM_LOCK_CACHE_MODE_T mode, + EXPORT_SYMBOL_GPL(vc_sm_map); + #endif + +-late_initcall(vc_sm_init); +-module_exit(vc_sm_exit); ++/* ++ * Register the driver with device tree ++ */ ++ ++static const struct of_device_id bcm2835_vcsm_of_match[] = { ++ {.compatible = "raspberrypi,bcm2835-vcsm",}, ++ { /* sentinel */ }, ++}; ++ ++MODULE_DEVICE_TABLE(of, bcm2835_vcsm_of_match); ++ ++static struct platform_driver bcm2835_vcsm_driver = { ++ .probe = bcm2835_vcsm_probe, ++ .remove = bcm2835_vcsm_remove, ++ .driver = { ++ .name = DRIVER_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = bcm2835_vcsm_of_match, ++ }, ++}; ++ ++module_platform_driver(bcm2835_vcsm_driver); + + MODULE_AUTHOR("Broadcom"); + MODULE_DESCRIPTION("VideoCore SharedMemory Driver"); + +From 21fe405f7bab7c5c07c80ffa82458562dc10a1ce Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Wed, 15 Feb 2017 11:17:44 +0000 +Subject: [PATCH 177/199] VCSM: New option to import a DMABUF for VPU use + +Takes a dmabuf, and then calls over to the VPU to wrap +it into a suitable handle. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vc_sm_defs.h | 57 ++++++- + drivers/char/broadcom/vc_sm/vc_sm_knl.h | 21 ++- + drivers/char/broadcom/vc_sm/vc_vchi_sm.c | 9 ++ + drivers/char/broadcom/vc_sm/vc_vchi_sm.h | 7 + + drivers/char/broadcom/vc_sm/vmcs_sm.c | 269 ++++++++++++++++++++++++++++++- + include/linux/broadcom/vmcs_sm_ioctl.h | 18 ++- + 6 files changed, 359 insertions(+), 22 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_defs.h b/drivers/char/broadcom/vc_sm/vc_sm_defs.h +index 6c19aac6dc9df90edb9432bc32e7477d532d3278..bf057969644546d8f036044aa14d6606173b6a35 100644 +--- a/drivers/char/broadcom/vc_sm/vc_sm_defs.h ++++ b/drivers/char/broadcom/vc_sm/vc_sm_defs.h +@@ -26,8 +26,9 @@ + /* Resource name maximum size */ + #define VC_SM_RESOURCE_NAME 32 + +-/* All message types supported for HOST->VC direction */ + typedef enum { ++ /* Message types supported for HOST->VC direction */ ++ + /* Allocate shared memory block */ + VC_SM_MSG_TYPE_ALLOC, + /* Lock allocated shared memory block */ +@@ -45,6 +46,21 @@ typedef enum { + + /* A previously applied action will need to be reverted */ + VC_SM_MSG_TYPE_ACTION_CLEAN, ++ ++ /* ++ * Import a physical address and wrap into a MEM_HANDLE_T. ++ * Release with VC_SM_MSG_TYPE_FREE. ++ */ ++ VC_SM_MSG_TYPE_IMPORT, ++ ++ /* Message types supported for VC->HOST direction */ ++ ++ /* ++ * VC has finished with an imported memory allocation. ++ * Release any Linux reference counts on the underlying block. ++ */ ++ VC_SM_MSG_TYPE_RELEASED, ++ + VC_SM_MSG_TYPE_MAX + } VC_SM_MSG_TYPE; + +@@ -165,6 +181,41 @@ typedef struct { + + } VC_SM_FREE_ALL_T; + ++/* Request to import memory (HOST->VC) */ ++struct vc_sm_import { ++ /* type of memory to allocate */ ++ VC_SM_ALLOC_TYPE_T type; ++ /* pointer to the VC (ie physical) address of the allocated memory */ ++ uint32_t addr; ++ /* size of buffer */ ++ uint32_t size; ++ /* opaque handle returned in RELEASED messages */ ++ int32_t kernel_id; ++ /* Allocator identifier */ ++ uint32_t allocator; ++ /* resource name (for easier tracking on vc side) */ ++ char name[VC_SM_RESOURCE_NAME]; ++}; ++ ++/* Result of a requested memory import (VC->HOST) */ ++struct vc_sm_import_result { ++ /* Transaction identifier */ ++ uint32_t trans_id; ++ ++ /* Resource handle */ ++ uint32_t res_handle; ++}; ++ ++/* Notification that VC has finished with an allocation (VC->HOST) */ ++struct vc_sm_released { ++ /* pointer to the VC (ie physical) address of the allocated memory */ ++ uint32_t addr; ++ /* size of buffer */ ++ uint32_t size; ++ /* opaque handle returned in RELEASED messages */ ++ int32_t kernel_id; ++}; ++ + /* Union of ALL messages */ + typedef union { + VC_SM_ALLOC_T alloc; +@@ -175,7 +226,9 @@ typedef union { + VC_SM_LOCK_RESULT_T lock_result; + VC_SM_RESULT_T result; + VC_SM_FREE_ALL_T free_all; +- ++ struct vc_sm_import import; ++ struct vc_sm_import_result import_result; ++ struct vc_sm_released released; + } VC_SM_MSG_UNION_T; + + #endif /* __VC_SM_DEFS_H__INCLUDED__ */ +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_knl.h b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +index 965f9a209a025202fea8065d3947c36f4fa43d0a..31050d3eb242b744c1ca43d6672d63b8439f7bc5 100644 +--- a/drivers/char/broadcom/vc_sm/vc_sm_knl.h ++++ b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +@@ -26,30 +26,27 @@ typedef enum { + + } VC_SM_LOCK_CACHE_MODE_T; + +-/* Allocate a shared memory handle and block. +-*/ ++/* Allocate a shared memory handle and block. */ + int vc_sm_alloc(VC_SM_ALLOC_T *alloc, int *handle); + +-/* Free a previously allocated shared memory handle and block. +-*/ ++/* Free a previously allocated shared memory handle and block. */ + int vc_sm_free(int handle); + +-/* Lock a memory handle for use by kernel. +-*/ ++/* Lock a memory handle for use by kernel. */ + int vc_sm_lock(int handle, VC_SM_LOCK_CACHE_MODE_T mode, + long unsigned int *data); + +-/* Unlock a memory handle in use by kernel. +-*/ ++/* Unlock a memory handle in use by kernel. */ + int vc_sm_unlock(int handle, int flush, int no_vc_unlock); + +-/* Get an internal resource handle mapped from the external one. +-*/ ++/* Get an internal resource handle mapped from the external one. */ + int vc_sm_int_handle(int handle); + +-/* Map a shared memory region for use by kernel. +-*/ ++/* Map a shared memory region for use by kernel. */ + int vc_sm_map(int handle, unsigned int sm_addr, VC_SM_LOCK_CACHE_MODE_T mode, + long unsigned int *data); + ++/* Import a block of memory into the GPU space. */ ++int vc_sm_import_dmabuf(struct dma_buf *dmabuf, int *handle); ++ + #endif /* __VC_SM_KNL_H__INCLUDED__ */ +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +index 76abd126c4617b6310fcf0ebd7ab1d5f73a18a70..53fc11a9d5d741ec6a7e55b4d1934c9c43a6df8c 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +@@ -497,3 +497,12 @@ int vc_vchi_sm_clean_up(VC_VCHI_SM_HANDLE_T handle, VC_SM_ACTION_CLEAN_T *msg) + return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_ACTION_CLEAN, + msg, sizeof(*msg), 0, 0, 0, 0); + } ++ ++int vc_vchi_sm_import(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_import *msg, ++ struct vc_sm_import_result *result, ++ uint32_t *cur_trans_id) ++{ ++ return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_IMPORT, ++ msg, sizeof(*msg), result, sizeof(*result), ++ cur_trans_id, 1); ++} +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +index f8e555dc30074e7ff226cf34a96aa30a34176775..562217831fa744db99d94295c1c5a46f3a4780fb 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +@@ -89,4 +89,11 @@ int vc_vchi_sm_walk_alloc(VC_VCHI_SM_HANDLE_T handle); + int vc_vchi_sm_clean_up(VC_VCHI_SM_HANDLE_T handle, + VC_SM_ACTION_CLEAN_T *action_clean); + ++/* ++ * Import a contiguous block of memory and wrap it in a GPU MEM_HANDLE_T. ++ */ ++int vc_vchi_sm_import(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_import *msg, ++ struct vc_sm_import_result *result, ++ uint32_t *cur_trans_id); ++ + #endif /* __VC_VCHI_SM_H__INCLUDED__ */ +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index eb0d3f8a8c27863a5469d0ac224aab65145e7560..520f343f3f4b828f3045fc4ff3fb0d8a68bb1f9d 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -69,6 +70,7 @@ enum SM_STATS_T { + MAP, + FLUSH, + INVALID, ++ IMPORT, + + END_ATTEMPT, + +@@ -80,6 +82,7 @@ enum SM_STATS_T { + MAP_FAIL, + FLUSH_FAIL, + INVALID_FAIL, ++ IMPORT_FAIL, + + END_ALL, + +@@ -93,6 +96,7 @@ static const char *const sm_stats_human_read[] = { + "Map", + "Cache Flush", + "Cache Invalidate", ++ "Import", + }; + + typedef int (*VC_SM_SHOW) (struct seq_file *s, void *v); +@@ -144,6 +148,12 @@ struct SM_RESOURCE_T { + uint8_t map_count; /* Counter of mappings for this resource. */ + struct list_head map_list; /* Maps associated with a resource. */ + ++ /* DMABUF related fields */ ++ struct dma_buf *dma_buf; ++ struct dma_buf_attachment *attach; ++ struct sg_table *sgt; ++ dma_addr_t dma_addr; ++ + struct SM_PRIV_DATA_T *private; + bool map; /* whether to map pages up front */ + }; +@@ -500,7 +510,9 @@ static void vmcs_sm_remove_map(struct SM_STATE_T *state, + static int vc_sm_global_state_show(struct seq_file *s, void *v) + { + struct sm_mmap *map = NULL; ++ struct SM_RESOURCE_T *resource = NULL; + int map_count = 0; ++ int resource_count = 0; + + if (sm_state == NULL) + return 0; +@@ -512,7 +524,41 @@ static int vc_sm_global_state_show(struct seq_file *s, void *v) + */ + + mutex_lock(&(sm_state->map_lock)); ++ seq_puts(s, "\nResources\n"); ++ if (!list_empty(&sm_state->resource_list)) { ++ list_for_each_entry(resource, &sm_state->resource_list, ++ global_resource_list) { ++ resource_count++; ++ ++ seq_printf(s, "\nResource %p\n", ++ resource); ++ seq_printf(s, " PID %u\n", ++ resource->pid); ++ seq_printf(s, " RES_GUID 0x%x\n", ++ resource->res_guid); ++ seq_printf(s, " LOCK_COUNT %u\n", ++ resource->lock_count); ++ seq_printf(s, " REF_COUNT %u\n", ++ resource->ref_count); ++ seq_printf(s, " res_handle 0x%X\n", ++ resource->res_handle); ++ seq_printf(s, " res_base_mem %p\n", ++ resource->res_base_mem); ++ seq_printf(s, " SIZE %d\n", ++ resource->res_size); ++ seq_printf(s, " DMABUF %p\n", ++ resource->dma_buf); ++ seq_printf(s, " ATTACH %p\n", ++ resource->attach); ++ seq_printf(s, " SGT %p\n", ++ resource->sgt); ++ seq_printf(s, " DMA_ADDR 0x%08X\n", ++ resource->dma_addr); ++ } ++ } ++ seq_printf(s, "\n\nTotal resource count: %d\n\n", resource_count); + ++ seq_puts(s, "\nMappings\n"); + if (!list_empty(&sm_state->map_list)) { + list_for_each_entry(map, &sm_state->map_list, map_list) { + map_count++; +@@ -527,6 +573,8 @@ static int vc_sm_global_state_show(struct seq_file *s, void *v) + map->res_usr_hdl); + seq_printf(s, " USR-ADDR 0x%lx\n", + map->res_addr); ++ seq_printf(s, " SIZE %d\n", ++ map->resource->res_size); + } + } + +@@ -843,7 +891,8 @@ static void vmcs_sm_release_resource(struct SM_RESOURCE_T *resource, int force) + list_del(&resource->resource_list); + list_del(&resource->global_resource_list); + +- /* Walk the global resource list, find out if the resource is used ++ /* ++ * Walk the global resource list, find out if the resource is used + * somewhere else. In which case we don't want to delete it. + */ + list_for_each_entry(res_tmp, &sm_state->resource_list, +@@ -877,8 +926,7 @@ static void vmcs_sm_release_resource(struct SM_RESOURCE_T *resource, int force) + up_write(¤t->mm->mmap_sem); + } + +- /* Free up the videocore allocated resource. +- */ ++ /* Free up the videocore allocated resource. */ + if (resource->res_handle) { + VC_SM_FREE_T free = { + resource->res_handle, (uint32_t)resource->res_base_mem +@@ -893,13 +941,19 @@ static void vmcs_sm_release_resource(struct SM_RESOURCE_T *resource, int force) + } + } + +- /* Free up the shared resource. +- */ ++ if (resource->sgt) ++ dma_buf_unmap_attachment(resource->attach, resource->sgt, ++ DMA_BIDIRECTIONAL); ++ if (resource->attach) ++ dma_buf_detach(resource->dma_buf, resource->attach); ++ if (resource->dma_buf) ++ dma_buf_put(resource->dma_buf); ++ ++ /* Free up the shared resource. */ + if (resource->res_shared) + vmcs_sm_release_resource(resource->res_shared, 0); + +- /* Free up the local resource tracking this allocation. +- */ ++ /* Free up the local resource tracking this allocation. */ + vc_sm_resource_deceased(resource, force); + kfree(resource); + } +@@ -2055,6 +2109,137 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + return ret; + } + ++/* ++ * Import a contiguous block of memory to be shared with VC. ++ */ ++int vc_sm_ioctl_import_dmabuf(struct SM_PRIV_DATA_T *private, ++ struct vmcs_sm_ioctl_import_dmabuf *ioparam, ++ struct dma_buf *src_dma_buf) ++{ ++ int ret = 0; ++ int status; ++ struct SM_RESOURCE_T *resource = NULL; ++ struct vc_sm_import import = { 0 }; ++ struct vc_sm_import_result result = { 0 }; ++ struct dma_buf *dma_buf; ++ struct dma_buf_attachment *attach = NULL; ++ struct sg_table *sgt = NULL; ++ ++ /* Setup our allocation parameters */ ++ if (src_dma_buf) { ++ get_dma_buf(src_dma_buf); ++ dma_buf = src_dma_buf; ++ } else { ++ dma_buf = dma_buf_get(ioparam->dmabuf_fd); ++ } ++ if (IS_ERR(dma_buf)) ++ return PTR_ERR(dma_buf); ++ ++ attach = dma_buf_attach(dma_buf, &sm_state->pdev->dev); ++ if (IS_ERR(attach)) { ++ ret = PTR_ERR(attach); ++ goto error; ++ } ++ ++ sgt = dma_buf_map_attachment(attach, DMA_BIDIRECTIONAL); ++ if (IS_ERR(sgt)) { ++ ret = PTR_ERR(sgt); ++ goto error; ++ } ++ ++ /* Verify that the address block is contiguous */ ++ if (sgt->nents != 1) { ++ ret = -ENOMEM; ++ goto error; ++ } ++ ++ import.type = ((ioparam->cached == VMCS_SM_CACHE_VC) || ++ (ioparam->cached == VMCS_SM_CACHE_BOTH)) ? ++ VC_SM_ALLOC_CACHED : VC_SM_ALLOC_NON_CACHED; ++ import.addr = (uint32_t)sg_dma_address(sgt->sgl); ++ import.size = sg_dma_len(sgt->sgl); ++ import.allocator = current->tgid; ++ ++ if (*ioparam->name) ++ memcpy(import.name, ioparam->name, sizeof(import.name) - 1); ++ else ++ memcpy(import.name, VMCS_SM_RESOURCE_NAME_DEFAULT, ++ sizeof(VMCS_SM_RESOURCE_NAME_DEFAULT)); ++ ++ pr_debug("[%s]: attempt to import \"%s\" data - type %u, addr %p, size %u\n", ++ __func__, import.name, import.type, ++ (void *)import.addr, import.size); ++ ++ /* Allocate local resource to track this allocation. */ ++ resource = kzalloc(sizeof(*resource), GFP_KERNEL); ++ if (!resource) { ++ ret = -ENOMEM; ++ goto error; ++ } ++ INIT_LIST_HEAD(&resource->map_list); ++ resource->ref_count++; ++ resource->pid = current->tgid; ++ ++ /* Allocate the videocore resource. */ ++ status = vc_vchi_sm_import(sm_state->sm_handle, &import, &result, ++ &private->int_trans_id); ++ if (status == -EINTR) { ++ pr_debug("[%s]: requesting import memory action restart (trans_id: %u)\n", ++ __func__, private->int_trans_id); ++ ret = -ERESTARTSYS; ++ private->restart_sys = -EINTR; ++ private->int_action = VC_SM_MSG_TYPE_IMPORT; ++ goto error; ++ } else if (status || !result.res_handle) { ++ pr_debug("[%s]: failed to import memory on videocore (status: %u, trans_id: %u)\n", ++ __func__, status, private->int_trans_id); ++ ret = -ENOMEM; ++ resource->res_stats[ALLOC_FAIL]++; ++ goto error; ++ } ++ ++ /* Keep track of the resource we created. ++ */ ++ resource->private = private; ++ resource->res_handle = result.res_handle; ++ resource->res_size = import.size; ++ resource->res_cached = ioparam->cached; ++ ++ resource->dma_buf = dma_buf; ++ resource->attach = attach; ++ resource->sgt = sgt; ++ resource->dma_addr = sg_dma_address(sgt->sgl); ++ ++ /* Kernel/user GUID. This global identifier is used for mmap'ing the ++ * allocated region from user space, it is passed as the mmap'ing ++ * offset, we use it to 'hide' the videocore handle/address. ++ */ ++ mutex_lock(&sm_state->lock); ++ resource->res_guid = ++sm_state->guid; ++ mutex_unlock(&sm_state->lock); ++ resource->res_guid <<= PAGE_SHIFT; ++ ++ vmcs_sm_add_resource(private, resource); ++ ++ /* We're done */ ++ resource->res_stats[IMPORT]++; ++ ioparam->handle = resource->res_guid; ++ return 0; ++ ++error: ++ resource->res_stats[IMPORT_FAIL]++; ++ if (resource) { ++ vc_sm_resource_deceased(resource, 1); ++ kfree(resource); ++ } ++ if (sgt) ++ dma_buf_unmap_attachment(attach, sgt, DMA_BIDIRECTIONAL); ++ if (attach) ++ dma_buf_detach(dma_buf, attach); ++ dma_buf_put(dma_buf); ++ return ret; ++} ++ + /* Handle control from host. */ + static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + { +@@ -2166,6 +2351,40 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + } + break; + ++ case VMCS_SM_CMD_IMPORT_DMABUF: ++ { ++ struct vmcs_sm_ioctl_import_dmabuf ioparam; ++ ++ /* Get the parameter data. ++ */ ++ if (copy_from_user ++ (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ ret = vc_sm_ioctl_import_dmabuf(file_data, &ioparam, ++ NULL); ++ if (!ret && ++ (copy_to_user((void *)arg, ++ &ioparam, sizeof(ioparam)) != 0)) { ++ struct vmcs_sm_ioctl_free freeparam = { ++ ioparam.handle ++ }; ++ pr_err("[%s]: failed to copy-to-user for cmd %x\n", ++ __func__, cmdnr); ++ vc_sm_ioctl_free(file_data, &freeparam); ++ ret = -EFAULT; ++ } ++ ++ /* Done. ++ */ ++ goto out; ++ } ++ break; ++ + /* Lock (attempt to) *and* register a cache behavior change. + */ + case VMCS_SM_CMD_LOCK_CACHE: +@@ -3301,6 +3520,42 @@ int vc_sm_map(int handle, unsigned int sm_addr, VC_SM_LOCK_CACHE_MODE_T mode, + return ret; + } + EXPORT_SYMBOL_GPL(vc_sm_map); ++ ++/* Import a dmabuf to be shared with VC. */ ++int vc_sm_import_dmabuf(struct dma_buf *dmabuf, int *handle) ++{ ++ struct vmcs_sm_ioctl_import_dmabuf ioparam = { 0 }; ++ int ret; ++ struct SM_RESOURCE_T *resource; ++ ++ /* Validate we can work with this device. */ ++ if (!sm_state || !dmabuf || !handle) { ++ pr_err("[%s]: invalid input\n", __func__); ++ return -EPERM; ++ } ++ ++ ioparam.cached = 0; ++ strcpy(ioparam.name, "KRNL DMABUF"); ++ ++ ret = vc_sm_ioctl_import_dmabuf(sm_state->data_knl, &ioparam, dmabuf); ++ ++ if (!ret) { ++ resource = vmcs_sm_acquire_resource(sm_state->data_knl, ++ ioparam.handle); ++ if (resource) { ++ resource->pid = 0; ++ vmcs_sm_release_resource(resource, 0); ++ ++ /* Assign valid handle at this time.*/ ++ *handle = ioparam.handle; ++ } else { ++ ret = -ENOMEM; ++ } ++ } ++ ++ return ret; ++} ++EXPORT_SYMBOL_GPL(vc_sm_import_dmabuf); + #endif + + /* +diff --git a/include/linux/broadcom/vmcs_sm_ioctl.h b/include/linux/broadcom/vmcs_sm_ioctl.h +index 2de7f1f41070689c99cad3bd43d117458549cb51..b75729d762f25aace133f7a008633b4094ae2de2 100644 +--- a/include/linux/broadcom/vmcs_sm_ioctl.h ++++ b/include/linux/broadcom/vmcs_sm_ioctl.h +@@ -64,7 +64,9 @@ enum vmcs_sm_cmd_e { + VMCS_SM_CMD_CLEAN_INVALID, + VMCS_SM_CMD_CLEAN_INVALID2, + +- VMCS_SM_CMD_LAST /* Do no delete */ ++ VMCS_SM_CMD_IMPORT_DMABUF, ++ ++ VMCS_SM_CMD_LAST /* Do not delete */ + }; + + /* Cache type supported, conveniently matches the user space definition in +@@ -188,6 +190,16 @@ struct vmcs_sm_ioctl_clean_invalid2 { + } s[0]; + }; + ++struct vmcs_sm_ioctl_import_dmabuf { ++ /* user -> kernel */ ++ int dmabuf_fd; ++ enum vmcs_sm_cache_e cached; ++ char name[VMCS_SM_RESOURCE_NAME]; ++ ++ /* kernel -> user */ ++ unsigned int handle; ++}; ++ + /* IOCTL numbers */ + #define VMCS_SM_IOCTL_MEM_ALLOC\ + _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_ALLOC,\ +@@ -257,6 +269,10 @@ struct vmcs_sm_ioctl_clean_invalid2 { + _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_HOST_WALK_PID_MAP,\ + struct vmcs_sm_ioctl_walk) + ++#define VMCS_SM_IOCTL_MEM_IMPORT_DMABUF\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_IMPORT_DMABUF,\ ++ struct vmcs_sm_ioctl_import_dmabuf) ++ + /* ---- Variable Externs ------------------------------------------------- */ + + /* ---- Function Prototypes ---------------------------------------------- */ + +From f74c08227346d8a282e2fdc804310b24317c1ca6 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 16:26:12 +0100 +Subject: [PATCH 178/199] vcsm: Remove all typedefs from vc_sm_defs.h and + calling code + +Remove typedefs on the structures that make up the IPC +to the firmware for VCSM. Update all calling code appropriately. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vc_sm_defs.h | 83 ++++++++++++++++---------------- + drivers/char/broadcom/vc_sm/vc_sm_knl.h | 2 +- + drivers/char/broadcom/vc_sm/vc_vchi_sm.c | 34 +++++++------ + drivers/char/broadcom/vc_sm/vc_vchi_sm.h | 19 ++++---- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 26 +++++----- + 5 files changed, 84 insertions(+), 80 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_defs.h b/drivers/char/broadcom/vc_sm/vc_sm_defs.h +index bf057969644546d8f036044aa14d6606173b6a35..29057db43404716406b06e3c3745e3d82219be16 100644 +--- a/drivers/char/broadcom/vc_sm/vc_sm_defs.h ++++ b/drivers/char/broadcom/vc_sm/vc_sm_defs.h +@@ -19,14 +19,14 @@ + #define VC_SM_SERVER_NAME MAKE_FOURCC("SMEM") + + /* Maximum message length */ +-#define VC_SM_MAX_MSG_LEN (sizeof(VC_SM_MSG_UNION_T) + \ +- sizeof(VC_SM_MSG_HDR_T)) +-#define VC_SM_MAX_RSP_LEN (sizeof(VC_SM_MSG_UNION_T)) ++#define VC_SM_MAX_MSG_LEN (sizeof(union vc_sm_msg_union_t) + \ ++ sizeof(struct vc_sm_msg_hdr_t)) ++#define VC_SM_MAX_RSP_LEN (sizeof(union vc_sm_msg_union_t)) + + /* Resource name maximum size */ + #define VC_SM_RESOURCE_NAME 32 + +-typedef enum { ++enum vc_sm_msg_type { + /* Message types supported for HOST->VC direction */ + + /* Allocate shared memory block */ +@@ -62,27 +62,26 @@ typedef enum { + VC_SM_MSG_TYPE_RELEASED, + + VC_SM_MSG_TYPE_MAX +-} VC_SM_MSG_TYPE; ++}; + + /* Type of memory to be allocated */ +-typedef enum { ++enum vc_sm_alloc_type_t { + VC_SM_ALLOC_CACHED, + VC_SM_ALLOC_NON_CACHED, +- +-} VC_SM_ALLOC_TYPE_T; ++}; + + /* Message header for all messages in HOST->VC direction */ +-typedef struct { ++struct vc_sm_msg_hdr_t { + int32_t type; + uint32_t trans_id; + uint8_t body[0]; + +-} VC_SM_MSG_HDR_T; ++}; + + /* Request to allocate memory (HOST->VC) */ +-typedef struct { ++struct vc_sm_alloc_t { + /* type of memory to allocate */ +- VC_SM_ALLOC_TYPE_T type; ++ enum vc_sm_alloc_type_t type; + /* byte amount of data to allocate per unit */ + uint32_t base_unit; + /* number of unit to allocate */ +@@ -94,10 +93,10 @@ typedef struct { + /* resource name (for easier tracking on vc side) */ + char name[VC_SM_RESOURCE_NAME]; + +-} VC_SM_ALLOC_T; ++}; + + /* Result of a requested memory allocation (VC->HOST) */ +-typedef struct { ++struct vc_sm_alloc_result_t { + /* Transaction identifier */ + uint32_t trans_id; + +@@ -110,28 +109,28 @@ typedef struct { + /* Resource number */ + uint32_t res_num; + +-} VC_SM_ALLOC_RESULT_T; ++}; + + /* Request to free a previously allocated memory (HOST->VC) */ +-typedef struct { ++struct vc_sm_free_t { + /* Resource handle (returned from alloc) */ + uint32_t res_handle; + /* Resource buffer (returned from alloc) */ + uint32_t res_mem; + +-} VC_SM_FREE_T; ++}; + + /* Request to lock a previously allocated memory (HOST->VC) */ +-typedef struct { ++struct vc_sm_lock_unlock_t { + /* Resource handle (returned from alloc) */ + uint32_t res_handle; + /* Resource buffer (returned from alloc) */ + uint32_t res_mem; + +-} VC_SM_LOCK_UNLOCK_T; ++}; + + /* Request to resize a previously allocated memory (HOST->VC) */ +-typedef struct { ++struct vc_sm_resize_t { + /* Resource handle (returned from alloc) */ + uint32_t res_handle; + /* Resource buffer (returned from alloc) */ +@@ -139,10 +138,10 @@ typedef struct { + /* Resource *new* size requested (bytes) */ + uint32_t res_new_size; + +-} VC_SM_RESIZE_T; ++}; + + /* Result of a requested memory lock (VC->HOST) */ +-typedef struct { ++struct vc_sm_lock_result_t { + /* Transaction identifier */ + uint32_t trans_id; + +@@ -154,37 +153,36 @@ typedef struct { + * was reallocated */ + uint32_t res_old_mem; + +-} VC_SM_LOCK_RESULT_T; ++}; + + /* Generic result for a request (VC->HOST) */ +-typedef struct { ++struct vc_sm_result_t { + /* Transaction identifier */ + uint32_t trans_id; + + int32_t success; + +-} VC_SM_RESULT_T; ++}; + + /* Request to revert a previously applied action (HOST->VC) */ +-typedef struct { ++struct vc_sm_action_clean_t { + /* Action of interest */ +- VC_SM_MSG_TYPE res_action; ++ enum vc_sm_msg_type res_action; + /* Transaction identifier for the action of interest */ + uint32_t action_trans_id; + +-} VC_SM_ACTION_CLEAN_T; ++}; + + /* Request to remove all data associated with a given allocator (HOST->VC) */ +-typedef struct { ++struct vc_sm_free_all_t { + /* Allocator identifier */ + uint32_t allocator; +- +-} VC_SM_FREE_ALL_T; ++}; + + /* Request to import memory (HOST->VC) */ + struct vc_sm_import { + /* type of memory to allocate */ +- VC_SM_ALLOC_TYPE_T type; ++ enum vc_sm_alloc_type_t type; + /* pointer to the VC (ie physical) address of the allocated memory */ + uint32_t addr; + /* size of buffer */ +@@ -217,18 +215,19 @@ struct vc_sm_released { + }; + + /* Union of ALL messages */ +-typedef union { +- VC_SM_ALLOC_T alloc; +- VC_SM_ALLOC_RESULT_T alloc_result; +- VC_SM_FREE_T free; +- VC_SM_ACTION_CLEAN_T action_clean; +- VC_SM_RESIZE_T resize; +- VC_SM_LOCK_RESULT_T lock_result; +- VC_SM_RESULT_T result; +- VC_SM_FREE_ALL_T free_all; ++union vc_sm_msg_union_t { ++ struct vc_sm_alloc_t alloc; ++ struct vc_sm_alloc_result_t alloc_result; ++ struct vc_sm_free_t free; ++ struct vc_sm_lock_unlock_t lock_unlock; ++ struct vc_sm_action_clean_t action_clean; ++ struct vc_sm_resize_t resize; ++ struct vc_sm_lock_result_t lock_result; ++ struct vc_sm_result_t result; ++ struct vc_sm_free_all_t free_all; + struct vc_sm_import import; + struct vc_sm_import_result import_result; + struct vc_sm_released released; +-} VC_SM_MSG_UNION_T; ++}; + + #endif /* __VC_SM_DEFS_H__INCLUDED__ */ +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_knl.h b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +index 31050d3eb242b744c1ca43d6672d63b8439f7bc5..3c684ddde5c1fac5c726a71deec305f7588f0200 100644 +--- a/drivers/char/broadcom/vc_sm/vc_sm_knl.h ++++ b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +@@ -27,7 +27,7 @@ typedef enum { + } VC_SM_LOCK_CACHE_MODE_T; + + /* Allocate a shared memory handle and block. */ +-int vc_sm_alloc(VC_SM_ALLOC_T *alloc, int *handle); ++int vc_sm_alloc(struct vc_sm_alloc_t *alloc, int *handle); + + /* Free a previously allocated shared memory handle and block. */ + int vc_sm_free(int handle); +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +index 53fc11a9d5d741ec6a7e55b4d1934c9c43a6df8c..a702b0c16478c87e28be3905a14dcd992e6c05cb 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +@@ -83,11 +83,11 @@ bcm2835_vchi_msg_queue(VCHI_SERVICE_HANDLE_T handle, + + static struct + sm_cmd_rsp_blk *vc_vchi_cmd_create(struct sm_instance *instance, +- VC_SM_MSG_TYPE id, void *msg, ++ enum vc_sm_msg_type id, void *msg, + uint32_t size, int wait) + { + struct sm_cmd_rsp_blk *blk; +- VC_SM_MSG_HDR_T *hdr; ++ struct vc_sm_msg_hdr_t *hdr; + + if (down_interruptible(&instance->free_sema)) { + blk = kmalloc(sizeof(*blk), GFP_KERNEL); +@@ -109,7 +109,7 @@ sm_cmd_rsp_blk *vc_vchi_cmd_create(struct sm_instance *instance, + blk->wait = wait; + blk->length = sizeof(*hdr) + size; + +- hdr = (VC_SM_MSG_HDR_T *) blk->msg; ++ hdr = (struct vc_sm_msg_hdr_t *) blk->msg; + hdr->type = id; + mutex_lock(&instance->lock); + hdr->trans_id = blk->id = ++instance->trans_id; +@@ -139,7 +139,7 @@ static int vc_vchi_sm_videocore_io(void *arg) + { + struct sm_instance *instance = arg; + struct sm_cmd_rsp_blk *cmd = NULL, *cmd_tmp; +- VC_SM_RESULT_T *reply; ++ struct vc_sm_result_t *reply; + uint32_t reply_len; + int32_t status; + int svc_use = 1; +@@ -374,7 +374,7 @@ int vc_vchi_sm_stop(VC_VCHI_SM_HANDLE_T *handle) + } + + int vc_vchi_sm_send_msg(VC_VCHI_SM_HANDLE_T handle, +- VC_SM_MSG_TYPE msg_id, ++ enum vc_sm_msg_type msg_id, + void *msg, uint32_t msg_size, + void *result, uint32_t result_size, + uint32_t *cur_trans_id, uint8_t wait_reply) +@@ -433,7 +433,8 @@ int vc_vchi_sm_send_msg(VC_VCHI_SM_HANDLE_T handle, + if (result && result_size) { + memcpy(result, cmd_blk->msg, result_size); + } else { +- VC_SM_RESULT_T *res = (VC_SM_RESULT_T *) cmd_blk->msg; ++ struct vc_sm_result_t *res = ++ (struct vc_sm_result_t *) cmd_blk->msg; + status = (res->success == 0) ? 0 : -ENXIO; + } + +@@ -444,8 +445,9 @@ int vc_vchi_sm_send_msg(VC_VCHI_SM_HANDLE_T handle, + return status; + } + +-int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, VC_SM_ALLOC_T *msg, +- VC_SM_ALLOC_RESULT_T *result, uint32_t *cur_trans_id) ++int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_alloc_t *msg, ++ struct vc_sm_alloc_result_t *result, ++ uint32_t *cur_trans_id) + { + return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_ALLOC, + msg, sizeof(*msg), result, sizeof(*result), +@@ -453,15 +455,16 @@ int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, VC_SM_ALLOC_T *msg, + } + + int vc_vchi_sm_free(VC_VCHI_SM_HANDLE_T handle, +- VC_SM_FREE_T *msg, uint32_t *cur_trans_id) ++ struct vc_sm_free_t *msg, uint32_t *cur_trans_id) + { + return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_FREE, + msg, sizeof(*msg), 0, 0, cur_trans_id, 0); + } + + int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, +- VC_SM_LOCK_UNLOCK_T *msg, +- VC_SM_LOCK_RESULT_T *result, uint32_t *cur_trans_id) ++ struct vc_sm_lock_unlock_t *msg, ++ struct vc_sm_lock_result_t *result, ++ uint32_t *cur_trans_id) + { + return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_LOCK, + msg, sizeof(*msg), result, sizeof(*result), +@@ -469,7 +472,7 @@ int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, + } + + int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, +- VC_SM_LOCK_UNLOCK_T *msg, ++ struct vc_sm_lock_unlock_t *msg, + uint32_t *cur_trans_id, uint8_t wait_reply) + { + return vc_vchi_sm_send_msg(handle, wait_reply ? +@@ -479,8 +482,8 @@ int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, + wait_reply); + } + +-int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, VC_SM_RESIZE_T *msg, +- uint32_t *cur_trans_id) ++int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_resize_t *msg, ++ uint32_t *cur_trans_id) + { + return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_RESIZE, + msg, sizeof(*msg), 0, 0, cur_trans_id, 1); +@@ -492,7 +495,8 @@ int vc_vchi_sm_walk_alloc(VC_VCHI_SM_HANDLE_T handle) + 0, 0, 0, 0, 0, 0); + } + +-int vc_vchi_sm_clean_up(VC_VCHI_SM_HANDLE_T handle, VC_SM_ACTION_CLEAN_T *msg) ++int vc_vchi_sm_clean_up(VC_VCHI_SM_HANDLE_T handle, ++ struct vc_sm_action_clean_t *msg) + { + return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_ACTION_CLEAN, + msg, sizeof(*msg), 0, 0, 0, 0); +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +index 562217831fa744db99d94295c1c5a46f3a4780fb..f97cddf14881535c7f62a2ce0166a5eb7e3fad6d 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +@@ -41,31 +41,32 @@ int vc_vchi_sm_stop(VC_VCHI_SM_HANDLE_T *handle); + * return the result of this allocation (which upon success will be a pointer + * to some memory in videocore space). + */ +-int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, +- VC_SM_ALLOC_T *alloc, +- VC_SM_ALLOC_RESULT_T *alloc_result, uint32_t *trans_id); ++int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_alloc_t *alloc, ++ struct vc_sm_alloc_result_t *alloc_result, ++ uint32_t *trans_id); + + /* + * Ask the shared memory service to free up some memory that was previously + * allocated by the vc_vchi_sm_alloc function call. + */ + int vc_vchi_sm_free(VC_VCHI_SM_HANDLE_T handle, +- VC_SM_FREE_T *free, uint32_t *trans_id); ++ struct vc_sm_free_t *free, uint32_t *trans_id); + + /* + * Ask the shared memory service to lock up some memory that was previously + * allocated by the vc_vchi_sm_alloc function call. + */ + int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, +- VC_SM_LOCK_UNLOCK_T *lock_unlock, +- VC_SM_LOCK_RESULT_T *lock_result, uint32_t *trans_id); ++ struct vc_sm_lock_unlock_t *lock_unlock, ++ struct vc_sm_lock_result_t *lock_result, ++ uint32_t *trans_id); + + /* + * Ask the shared memory service to unlock some memory that was previously + * allocated by the vc_vchi_sm_alloc function call. + */ + int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, +- VC_SM_LOCK_UNLOCK_T *lock_unlock, ++ struct vc_sm_lock_unlock_t *lock_unlock, + uint32_t *trans_id, uint8_t wait_reply); + + /* +@@ -73,7 +74,7 @@ int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, + * allocated by the vc_vchi_sm_alloc function call. + */ + int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, +- VC_SM_RESIZE_T *resize, uint32_t *trans_id); ++ struct vc_sm_resize_t *resize, uint32_t *trans_id); + + /* + * Walk the allocated resources on the videocore side, the allocation will +@@ -87,7 +88,7 @@ int vc_vchi_sm_walk_alloc(VC_VCHI_SM_HANDLE_T handle); + * in a bad state of some sort. + */ + int vc_vchi_sm_clean_up(VC_VCHI_SM_HANDLE_T handle, +- VC_SM_ACTION_CLEAN_T *action_clean); ++ struct vc_sm_action_clean_t *action_clean); + + /* + * Import a contiguous block of memory and wrap it in a GPU MEM_HANDLE_T. +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 520f343f3f4b828f3045fc4ff3fb0d8a68bb1f9d..e67d96d54ad82bd51393268c830a51169f62b097 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -170,7 +170,7 @@ struct SM_PRIV_DATA_T { + struct SM_PDE_T dir_res; /* Debug fs resource sub-tree. */ + + int restart_sys; /* Tracks restart on interrupt. */ +- VC_SM_MSG_TYPE int_action; /* Interrupted action. */ ++ enum vc_sm_msg_type int_action; /* Interrupted action. */ + uint32_t int_trans_id; /* Interrupted transaction. */ + + }; +@@ -928,7 +928,7 @@ static void vmcs_sm_release_resource(struct SM_RESOURCE_T *resource, int force) + + /* Free up the videocore allocated resource. */ + if (resource->res_handle) { +- VC_SM_FREE_T free = { ++ struct vc_sm_free_t free = { + resource->res_handle, (uint32_t)resource->res_base_mem + }; + int status = vc_vchi_sm_free(sm_state->sm_handle, &free, +@@ -1123,7 +1123,7 @@ static int vc_sm_release(struct inode *inode, struct file *file) + pr_debug("[%s]: using private data %p\n", __func__, file_data); + + if (file_data->restart_sys == -EINTR) { +- VC_SM_ACTION_CLEAN_T action_clean; ++ struct vc_sm_action_clean_t action_clean; + + pr_debug("[%s]: releasing following EINTR on %u (trans_id: %u) (likely due to signal)...\n", + __func__, file_data->int_action, +@@ -1189,8 +1189,8 @@ static int vcsm_vma_fault(struct vm_fault *vmf) + /* Lock the resource if necessary. + */ + if (!resource->lock_count) { +- VC_SM_LOCK_UNLOCK_T lock_unlock; +- VC_SM_LOCK_RESULT_T lock_result; ++ struct vc_sm_lock_unlock_t lock_unlock; ++ struct vc_sm_lock_result_t lock_result; + int status; + + lock_unlock.res_handle = resource->res_handle; +@@ -1465,8 +1465,8 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + int ret = 0; + int status; + struct SM_RESOURCE_T *resource; +- VC_SM_ALLOC_T alloc = { 0 }; +- VC_SM_ALLOC_RESULT_T result = { 0 }; ++ struct vc_sm_alloc_t alloc = { 0 }; ++ struct vc_sm_alloc_result_t result = { 0 }; + enum vmcs_sm_cache_e cached = ioparam->cached; + bool map = false; + +@@ -1671,7 +1671,7 @@ static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + { + int ret = 0; + int status; +- VC_SM_RESIZE_T resize; ++ struct vc_sm_resize_t resize; + struct SM_RESOURCE_T *resource; + + /* Locate resource from GUID. +@@ -1761,8 +1761,8 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + unsigned int vc_addr) + { + int status; +- VC_SM_LOCK_UNLOCK_T lock; +- VC_SM_LOCK_RESULT_T result; ++ struct vc_sm_lock_unlock_t lock; ++ struct vc_sm_lock_result_t result; + struct SM_RESOURCE_T *resource; + int ret = 0; + struct sm_mmap *map, *map_tmp; +@@ -1935,7 +1935,7 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + int flush, int wait_reply, int no_vc_unlock) + { + int status; +- VC_SM_LOCK_UNLOCK_T unlock; ++ struct vc_sm_lock_unlock_t unlock; + struct sm_mmap *map, *map_tmp; + struct SM_RESOURCE_T *resource; + int ret = 0; +@@ -2261,7 +2261,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + + /* Action is a re-post of a previously interrupted action? */ + if (file_data->restart_sys == -EINTR) { +- VC_SM_ACTION_CLEAN_T action_clean; ++ struct vc_sm_action_clean_t action_clean; + + pr_debug("[%s]: clean up of action %u (trans_id: %u) following EINTR\n", + __func__, file_data->int_action, +@@ -3359,7 +3359,7 @@ static int bcm2835_vcsm_remove(struct platform_device *pdev) + + #if defined(__KERNEL__) + /* Allocate a shared memory handle and block. */ +-int vc_sm_alloc(VC_SM_ALLOC_T *alloc, int *handle) ++int vc_sm_alloc(struct vc_sm_alloc_t *alloc, int *handle) + { + struct vmcs_sm_ioctl_alloc ioparam = { 0 }; + int ret; + +From f9e9c821229711f4590f93592825948f39b24045 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 16:29:53 +0100 +Subject: [PATCH 179/199] vcsm: Correct block comment style on licence headers. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vc_sm_defs.h | 28 +++++++++++++++------------- + drivers/char/broadcom/vc_sm/vc_sm_knl.h | 28 +++++++++++++++------------- + drivers/char/broadcom/vc_sm/vc_vchi_sm.c | 28 +++++++++++++++------------- + drivers/char/broadcom/vc_sm/vc_vchi_sm.h | 28 +++++++++++++++------------- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 28 +++++++++++++++------------- + 5 files changed, 75 insertions(+), 65 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_defs.h b/drivers/char/broadcom/vc_sm/vc_sm_defs.h +index 29057db43404716406b06e3c3745e3d82219be16..8242e8ef28e445ae132187d02c74448b0226c1a4 100644 +--- a/drivers/char/broadcom/vc_sm/vc_sm_defs.h ++++ b/drivers/char/broadcom/vc_sm/vc_sm_defs.h +@@ -1,16 +1,18 @@ +-/***************************************************************************** +-* Copyright 2011 Broadcom Corporation. All rights reserved. +-* +-* Unless you and Broadcom execute a separate written software license +-* agreement governing use of this software, this software is licensed to you +-* under the terms of the GNU General Public License version 2, available at +-* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). +-* +-* Notwithstanding the above, under no circumstances may you combine this +-* software in any way with any other Broadcom software provided under a +-* license other than the GPL, without Broadcom's express prior written +-* consent. +-*****************************************************************************/ ++/* ++ **************************************************************************** ++ * Copyright 2011 Broadcom Corporation. All rights reserved. ++ * ++ * Unless you and Broadcom execute a separate written software license ++ * agreement governing use of this software, this software is licensed to you ++ * under the terms of the GNU General Public License version 2, available at ++ * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++ * ++ * Notwithstanding the above, under no circumstances may you combine this ++ * software in any way with any other Broadcom software provided under a ++ * license other than the GPL, without Broadcom's express prior written ++ * consent. ++ **************************************************************************** ++ */ + + #ifndef __VC_SM_DEFS_H__INCLUDED__ + #define __VC_SM_DEFS_H__INCLUDED__ +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_knl.h b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +index 3c684ddde5c1fac5c726a71deec305f7588f0200..8252d13999a78609fcc7e1bbe83307e2b1c1f8f1 100644 +--- a/drivers/char/broadcom/vc_sm/vc_sm_knl.h ++++ b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +@@ -1,16 +1,18 @@ +-/***************************************************************************** +-* Copyright 2011 Broadcom Corporation. All rights reserved. +-* +-* Unless you and Broadcom execute a separate written software license +-* agreement governing use of this software, this software is licensed to you +-* under the terms of the GNU General Public License version 2, available at +-* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). +-* +-* Notwithstanding the above, under no circumstances may you combine this +-* software in any way with any other Broadcom software provided under a +-* license other than the GPL, without Broadcom's express prior written +-* consent. +-*****************************************************************************/ ++/* ++ **************************************************************************** ++ * Copyright 2011 Broadcom Corporation. All rights reserved. ++ * ++ * Unless you and Broadcom execute a separate written software license ++ * agreement governing use of this software, this software is licensed to you ++ * under the terms of the GNU General Public License version 2, available at ++ * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++ * ++ * Notwithstanding the above, under no circumstances may you combine this ++ * software in any way with any other Broadcom software provided under a ++ * license other than the GPL, without Broadcom's express prior written ++ * consent. ++ **************************************************************************** ++ */ + + #ifndef __VC_SM_KNL_H__INCLUDED__ + #define __VC_SM_KNL_H__INCLUDED__ +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +index a702b0c16478c87e28be3905a14dcd992e6c05cb..76678b2f84eb541aa816531f222b5b10f4e25382 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +@@ -1,16 +1,18 @@ +-/***************************************************************************** +-* Copyright 2011-2012 Broadcom Corporation. All rights reserved. +-* +-* Unless you and Broadcom execute a separate written software license +-* agreement governing use of this software, this software is licensed to you +-* under the terms of the GNU General Public License version 2, available at +-* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). +-* +-* Notwithstanding the above, under no circumstances may you combine this +-* software in any way with any other Broadcom software provided under a +-* license other than the GPL, without Broadcom's express prior written +-* consent. +-*****************************************************************************/ ++/* ++ **************************************************************************** ++ * Copyright 2011-2012 Broadcom Corporation. All rights reserved. ++ * ++ * Unless you and Broadcom execute a separate written software license ++ * agreement governing use of this software, this software is licensed to you ++ * under the terms of the GNU General Public License version 2, available at ++ * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++ * ++ * Notwithstanding the above, under no circumstances may you combine this ++ * software in any way with any other Broadcom software provided under a ++ * license other than the GPL, without Broadcom's express prior written ++ * consent. ++ **************************************************************************** ++ */ + + /* ---- Include Files ----------------------------------------------------- */ + #include +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +index f97cddf14881535c7f62a2ce0166a5eb7e3fad6d..110db20ef517af9589616e5892c5b48681e62966 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +@@ -1,16 +1,18 @@ +-/***************************************************************************** +-* Copyright 2011 Broadcom Corporation. All rights reserved. +-* +-* Unless you and Broadcom execute a separate written software license +-* agreement governing use of this software, this software is licensed to you +-* under the terms of the GNU General Public License version 2, available at +-* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). +-* +-* Notwithstanding the above, under no circumstances may you combine this +-* software in any way with any other Broadcom software provided under a +-* license other than the GPL, without Broadcom's express prior written +-* consent. +-*****************************************************************************/ ++/* ++ **************************************************************************** ++ * Copyright 2011 Broadcom Corporation. All rights reserved. ++ * ++ * Unless you and Broadcom execute a separate written software license ++ * agreement governing use of this software, this software is licensed to you ++ * under the terms of the GNU General Public License version 2, available at ++ * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++ * ++ * Notwithstanding the above, under no circumstances may you combine this ++ * software in any way with any other Broadcom software provided under a ++ * license other than the GPL, without Broadcom's express prior written ++ * consent. ++ **************************************************************************** ++ */ + + #ifndef __VC_VCHI_SM_H__INCLUDED__ + #define __VC_VCHI_SM_H__INCLUDED__ +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index e67d96d54ad82bd51393268c830a51169f62b097..b121de3c2502e3d7fb6ef1c1b5e4d797d1f5d233 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -1,16 +1,18 @@ +-/***************************************************************************** +-* Copyright 2011-2012 Broadcom Corporation. All rights reserved. +-* +-* Unless you and Broadcom execute a separate written software license +-* agreement governing use of this software, this software is licensed to you +-* under the terms of the GNU General Public License version 2, available at +-* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). +-* +-* Notwithstanding the above, under no circumstances may you combine this +-* software in any way with any other Broadcom software provided under a +-* license other than the GPL, without Broadcom's express prior written +-* consent. +-*****************************************************************************/ ++/* ++ **************************************************************************** ++ * Copyright 2011-2012 Broadcom Corporation. All rights reserved. ++ * ++ * Unless you and Broadcom execute a separate written software license ++ * agreement governing use of this software, this software is licensed to you ++ * under the terms of the GNU General Public License version 2, available at ++ * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++ * ++ * Notwithstanding the above, under no circumstances may you combine this ++ * software in any way with any other Broadcom software provided under a ++ * license other than the GPL, without Broadcom's express prior written ++ * consent. ++ **************************************************************************** ++ */ + + /* ---- Include Files ----------------------------------------------------- */ + + +From b891a362c3e1ea487b0561b4bfe0c21d44343337 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 16:34:13 +0100 +Subject: [PATCH 180/199] vcsm: Fix block comment formatting + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vc_sm_defs.h | 6 ++++-- + drivers/char/broadcom/vc_sm/vc_vchi_sm.h | 10 +++++----- + 2 files changed, 9 insertions(+), 7 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_defs.h b/drivers/char/broadcom/vc_sm/vc_sm_defs.h +index 8242e8ef28e445ae132187d02c74448b0226c1a4..de6afe9f65af45582c79a62abd41c688274ad8f2 100644 +--- a/drivers/char/broadcom/vc_sm/vc_sm_defs.h ++++ b/drivers/char/broadcom/vc_sm/vc_sm_defs.h +@@ -151,8 +151,10 @@ struct vc_sm_lock_result_t { + uint32_t res_handle; + /* Pointer to resource buffer */ + uint32_t res_mem; +- /* Pointer to former resource buffer if the memory +- * was reallocated */ ++ /* ++ * Pointer to former resource buffer if the memory ++ * was reallocated ++ */ + uint32_t res_old_mem; + + }; +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +index 110db20ef517af9589616e5892c5b48681e62966..48e721c7f2e4ac5abe376a8481e01b0bbcc6d3ad 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +@@ -23,7 +23,7 @@ + + /* + * Forward declare. +-*/ ++ */ + typedef struct sm_instance *VC_VCHI_SM_HANDLE_T; + + /* +@@ -57,7 +57,7 @@ int vc_vchi_sm_free(VC_VCHI_SM_HANDLE_T handle, + /* + * Ask the shared memory service to lock up some memory that was previously + * allocated by the vc_vchi_sm_alloc function call. +-*/ ++ */ + int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, + struct vc_sm_lock_unlock_t *lock_unlock, + struct vc_sm_lock_result_t *lock_result, +@@ -66,7 +66,7 @@ int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, + /* + * Ask the shared memory service to unlock some memory that was previously + * allocated by the vc_vchi_sm_alloc function call. +-*/ ++ */ + int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, + struct vc_sm_lock_unlock_t *lock_unlock, + uint32_t *trans_id, uint8_t wait_reply); +@@ -74,7 +74,7 @@ int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, + /* + * Ask the shared memory service to resize some memory that was previously + * allocated by the vc_vchi_sm_alloc function call. +-*/ ++ */ + int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, + struct vc_sm_resize_t *resize, uint32_t *trans_id); + +@@ -82,7 +82,7 @@ int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, + * Walk the allocated resources on the videocore side, the allocation will + * show up in the log. This is purely for debug/information and takes no + * specific actions. +-*/ ++ */ + int vc_vchi_sm_walk_alloc(VC_VCHI_SM_HANDLE_T handle); + + /* + +From 9cfc23038c5df5316a860ff911caafa0f9d407f7 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 16:50:29 +0100 +Subject: [PATCH 181/199] vcsm: Remove typedef of VC_VCHI_SM_HANDLE_T + +Replaced with struct sm_instance *. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vc_vchi_sm.c | 22 +++++++++++----------- + drivers/char/broadcom/vc_sm/vc_vchi_sm.h | 22 +++++++++++----------- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 2 +- + 3 files changed, 23 insertions(+), 23 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +index 76678b2f84eb541aa816531f222b5b10f4e25382..cc1752e9d42ebd1785cbe7dc0607b7e9c03f49de 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +@@ -257,7 +257,7 @@ static void vc_sm_vchi_callback(void *param, + } + } + +-VC_VCHI_SM_HANDLE_T vc_vchi_sm_init(VCHI_INSTANCE_T vchi_instance, ++struct sm_instance *vc_vchi_sm_init(VCHI_INSTANCE_T vchi_instance, + VCHI_CONNECTION_T **vchi_connections, + uint32_t num_connections) + { +@@ -341,7 +341,7 @@ VC_VCHI_SM_HANDLE_T vc_vchi_sm_init(VCHI_INSTANCE_T vchi_instance, + return NULL; + } + +-int vc_vchi_sm_stop(VC_VCHI_SM_HANDLE_T *handle) ++int vc_vchi_sm_stop(struct sm_instance **handle) + { + struct sm_instance *instance; + uint32_t i; +@@ -375,7 +375,7 @@ int vc_vchi_sm_stop(VC_VCHI_SM_HANDLE_T *handle) + return -EINVAL; + } + +-int vc_vchi_sm_send_msg(VC_VCHI_SM_HANDLE_T handle, ++int vc_vchi_sm_send_msg(struct sm_instance *handle, + enum vc_sm_msg_type msg_id, + void *msg, uint32_t msg_size, + void *result, uint32_t result_size, +@@ -447,7 +447,7 @@ int vc_vchi_sm_send_msg(VC_VCHI_SM_HANDLE_T handle, + return status; + } + +-int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_alloc_t *msg, ++int vc_vchi_sm_alloc(struct sm_instance *handle, struct vc_sm_alloc_t *msg, + struct vc_sm_alloc_result_t *result, + uint32_t *cur_trans_id) + { +@@ -456,14 +456,14 @@ int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_alloc_t *msg, + cur_trans_id, 1); + } + +-int vc_vchi_sm_free(VC_VCHI_SM_HANDLE_T handle, ++int vc_vchi_sm_free(struct sm_instance *handle, + struct vc_sm_free_t *msg, uint32_t *cur_trans_id) + { + return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_FREE, + msg, sizeof(*msg), 0, 0, cur_trans_id, 0); + } + +-int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, ++int vc_vchi_sm_lock(struct sm_instance *handle, + struct vc_sm_lock_unlock_t *msg, + struct vc_sm_lock_result_t *result, + uint32_t *cur_trans_id) +@@ -473,7 +473,7 @@ int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, + cur_trans_id, 1); + } + +-int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, ++int vc_vchi_sm_unlock(struct sm_instance *handle, + struct vc_sm_lock_unlock_t *msg, + uint32_t *cur_trans_id, uint8_t wait_reply) + { +@@ -484,27 +484,27 @@ int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, + wait_reply); + } + +-int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_resize_t *msg, ++int vc_vchi_sm_resize(struct sm_instance *handle, struct vc_sm_resize_t *msg, + uint32_t *cur_trans_id) + { + return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_RESIZE, + msg, sizeof(*msg), 0, 0, cur_trans_id, 1); + } + +-int vc_vchi_sm_walk_alloc(VC_VCHI_SM_HANDLE_T handle) ++int vc_vchi_sm_walk_alloc(struct sm_instance *handle) + { + return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_WALK_ALLOC, + 0, 0, 0, 0, 0, 0); + } + +-int vc_vchi_sm_clean_up(VC_VCHI_SM_HANDLE_T handle, ++int vc_vchi_sm_clean_up(struct sm_instance *handle, + struct vc_sm_action_clean_t *msg) + { + return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_ACTION_CLEAN, + msg, sizeof(*msg), 0, 0, 0, 0); + } + +-int vc_vchi_sm_import(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_import *msg, ++int vc_vchi_sm_import(struct sm_instance *handle, struct vc_sm_import *msg, + struct vc_sm_import_result *result, + uint32_t *cur_trans_id) + { +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +index 48e721c7f2e4ac5abe376a8481e01b0bbcc6d3ad..abe4ed15836f2be756083d3fdb4edb544dacc1a6 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +@@ -24,26 +24,26 @@ + /* + * Forward declare. + */ +-typedef struct sm_instance *VC_VCHI_SM_HANDLE_T; ++struct sm_instance; + + /* + * Initialize the shared memory service, opens up vchi connection to talk to it. + */ +-VC_VCHI_SM_HANDLE_T vc_vchi_sm_init(VCHI_INSTANCE_T vchi_instance, ++struct sm_instance *vc_vchi_sm_init(VCHI_INSTANCE_T vchi_instance, + VCHI_CONNECTION_T **vchi_connections, + uint32_t num_connections); + + /* + * Terminates the shared memory service. + */ +-int vc_vchi_sm_stop(VC_VCHI_SM_HANDLE_T *handle); ++int vc_vchi_sm_stop(struct sm_instance **handle); + + /* + * Ask the shared memory service to allocate some memory on videocre and + * return the result of this allocation (which upon success will be a pointer + * to some memory in videocore space). + */ +-int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_alloc_t *alloc, ++int vc_vchi_sm_alloc(struct sm_instance *handle, struct vc_sm_alloc_t *alloc, + struct vc_sm_alloc_result_t *alloc_result, + uint32_t *trans_id); + +@@ -51,14 +51,14 @@ int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_alloc_t *alloc, + * Ask the shared memory service to free up some memory that was previously + * allocated by the vc_vchi_sm_alloc function call. + */ +-int vc_vchi_sm_free(VC_VCHI_SM_HANDLE_T handle, ++int vc_vchi_sm_free(struct sm_instance *handle, + struct vc_sm_free_t *free, uint32_t *trans_id); + + /* + * Ask the shared memory service to lock up some memory that was previously + * allocated by the vc_vchi_sm_alloc function call. + */ +-int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, ++int vc_vchi_sm_lock(struct sm_instance *handle, + struct vc_sm_lock_unlock_t *lock_unlock, + struct vc_sm_lock_result_t *lock_result, + uint32_t *trans_id); +@@ -67,7 +67,7 @@ int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, + * Ask the shared memory service to unlock some memory that was previously + * allocated by the vc_vchi_sm_alloc function call. + */ +-int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, ++int vc_vchi_sm_unlock(struct sm_instance *handle, + struct vc_sm_lock_unlock_t *lock_unlock, + uint32_t *trans_id, uint8_t wait_reply); + +@@ -75,7 +75,7 @@ int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, + * Ask the shared memory service to resize some memory that was previously + * allocated by the vc_vchi_sm_alloc function call. + */ +-int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, ++int vc_vchi_sm_resize(struct sm_instance *handle, + struct vc_sm_resize_t *resize, uint32_t *trans_id); + + /* +@@ -83,19 +83,19 @@ int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, + * show up in the log. This is purely for debug/information and takes no + * specific actions. + */ +-int vc_vchi_sm_walk_alloc(VC_VCHI_SM_HANDLE_T handle); ++int vc_vchi_sm_walk_alloc(struct sm_instance *handle); + + /* + * Clean up following a previously interrupted action which left the system + * in a bad state of some sort. + */ +-int vc_vchi_sm_clean_up(VC_VCHI_SM_HANDLE_T handle, ++int vc_vchi_sm_clean_up(struct sm_instance *handle, + struct vc_sm_action_clean_t *action_clean); + + /* + * Import a contiguous block of memory and wrap it in a GPU MEM_HANDLE_T. + */ +-int vc_vchi_sm_import(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_import *msg, ++int vc_vchi_sm_import(struct sm_instance *handle, struct vc_sm_import *msg, + struct vc_sm_import_result *result, + uint32_t *cur_trans_id); + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index b121de3c2502e3d7fb6ef1c1b5e4d797d1f5d233..8c13dab0f59c959226194214d36d9b5c8c6b1818 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -181,7 +181,7 @@ struct SM_PRIV_DATA_T { + */ + struct SM_STATE_T { + struct platform_device *pdev; +- VC_VCHI_SM_HANDLE_T sm_handle; /* Handle for videocore service. */ ++ struct sm_instance *sm_handle; /* Handle for videocore service. */ + struct dentry *dir_root; /* Debug fs entries root. */ + struct dentry *dir_alloc; /* Debug fs entries allocations. */ + struct SM_PDE_T dir_stats; /* Debug fs entries statistics sub-tree. */ + +From f790babcb244d493b2988b4d3528acc1232ce01d Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 16:55:08 +0100 +Subject: [PATCH 182/199] vcsm: "unsigned int" preferred over "unsigned" fixed. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vc_vchi_sm.c | 3 ++- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 2 +- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +index cc1752e9d42ebd1785cbe7dc0607b7e9c03f49de..b9f65e34957506ba0f93d0d0ecd0894ee5be39b5 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +@@ -327,7 +327,8 @@ struct sm_instance *vc_vchi_sm_init(VCHI_INSTANCE_T vchi_instance, + set_user_nice(instance->io_thread, -10); + wake_up_process(instance->io_thread); + +- pr_debug("%s: success - instance 0x%x", __func__, (unsigned)instance); ++ pr_debug("%s: success - instance 0x%x", __func__, ++ (unsigned int)instance); + return instance; + + err_close_services: +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 8c13dab0f59c959226194214d36d9b5c8c6b1818..8bea643957622cb19b9daac124447fe90558e47c 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -227,7 +227,7 @@ static const char *const sm_cache_map_vector[] = { + + /* ---- Private Functions ------------------------------------------------ */ + +-static inline unsigned vcaddr_to_pfn(unsigned long vc_addr) ++static inline unsigned int vcaddr_to_pfn(unsigned long vc_addr) + { + unsigned long pfn = vc_addr & 0x3FFFFFFF; + pfn += mm_vc_mem_phys_addr; + +From a7348ba2deb173782cb1d132ef88fb7773bbfc04 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 16:59:49 +0100 +Subject: [PATCH 183/199] vcsm: Fix blank lines after declarations. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vc_vchi_sm.c | 1 + + drivers/char/broadcom/vc_sm/vmcs_sm.c | 7 +++++++ + 2 files changed, 8 insertions(+) + +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +index b9f65e34957506ba0f93d0d0ecd0894ee5be39b5..f8b909a09adb0743ed5d55dadf8fbf2fef055197 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +@@ -362,6 +362,7 @@ int vc_vchi_sm_stop(struct sm_instance **handle) + /* Close all VCHI service connections */ + for (i = 0; i < instance->num_connections; i++) { + int32_t success; ++ + vchi_service_use(instance->vchi_handle[i]); + + success = vchi_service_close(instance->vchi_handle[i]); +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 8bea643957622cb19b9daac124447fe90558e47c..abee526d6fbbddb8c31096cafdcd69814590d750 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -230,6 +230,7 @@ static const char *const sm_cache_map_vector[] = { + static inline unsigned int vcaddr_to_pfn(unsigned long vc_addr) + { + unsigned long pfn = vc_addr & 0x3FFFFFFF; ++ + pfn += mm_vc_mem_phys_addr; + pfn >>= PAGE_SHIFT; + return pfn; +@@ -1441,9 +1442,11 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + if (resource->map) { + /* We don't use vmf->pgoff since that has the fake offset */ + unsigned long addr; ++ + for (addr = vma->vm_start; addr < vma->vm_end; addr += PAGE_SIZE) { + /* Finally, remap it */ + unsigned long pfn = (unsigned long)resource->res_base_mem & 0x3FFFFFFF; ++ + pfn += mm_vc_mem_phys_addr; + pfn += addr - vma->vm_start; + pfn >>= PAGE_SHIFT; +@@ -1974,6 +1977,7 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + /* Flush if requested */ + if (resource->res_cached && flush) { + dma_addr_t phys_addr = 0; ++ + resource->res_stats[FLUSH]++; + + phys_addr = +@@ -1988,6 +1992,7 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + if (map->vma) { + unsigned long start; + unsigned long end; ++ + start = map->vma->vm_start; + end = map->vma->vm_end; + +@@ -3022,6 +3027,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + if ((resource != NULL) && resource->res_cached) { + unsigned long base = ioparam.s[i].addr & ~(PAGE_SIZE-1); + unsigned long end = (ioparam.s[i].addr + ioparam.s[i].size + PAGE_SIZE-1) & ~(PAGE_SIZE-1); ++ + resource->res_stats[ioparam.s[i].cmd == 1 ? INVALID:FLUSH]++; + + /* L1/L2 cache flush */ +@@ -3071,6 +3077,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + + for (i=0; iblock_count; ++j) { + + + +From 5b9dcc594c4c11855547e61b9ab1a97a85962b9a Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 17:01:11 +0100 +Subject: [PATCH 184/199] vcsm: Fix erroneous space in 'if' statement. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index abee526d6fbbddb8c31096cafdcd69814590d750..6d4729980ebf7dd7b76444dcabf3c85477b51fd4 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -1476,7 +1476,7 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + bool map = false; + + /* flag to requst buffer is mapped up front, rather than lazily */ +- if (cached & 0x80 ) { ++ if (cached & 0x80) { + map = true; + cached &= ~0x80; + } + +From f42f0921569abb774b3d3b0afade8fc9502d7891 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 17:21:09 +0100 +Subject: [PATCH 185/199] vcsm: Fix lots of block quote formatting issues + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 563 ++++++++++++++-------------------- + 1 file changed, 231 insertions(+), 332 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 6d4729980ebf7dd7b76444dcabf3c85477b51fd4..f93f18d3c24e43c9cf79e33f11cba9d1806f3124 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -61,8 +61,7 @@ + #define VC_SM_DEBUG "debug" + #define VC_SM_WRITE_BUF_SIZE 128 + +-/* Statistics tracked per resource and globally. +-*/ ++/* Statistics tracked per resource and globally. */ + enum SM_STATS_T { + /* Attempt. */ + ALLOC, +@@ -109,27 +108,25 @@ struct SM_PDE_T { + + }; + +-/* Single resource allocation tracked for all devices. +-*/ ++/* Single resource allocation tracked for all devices. */ + struct sm_mmap { + struct list_head map_list; /* Linked list of maps. */ + + struct SM_RESOURCE_T *resource; /* Pointer to the resource. */ + +- pid_t res_pid; /* PID owning that resource. */ ++ pid_t res_pid; /* PID owning that resource. */ + unsigned int res_vc_hdl; /* Resource handle (videocore). */ + unsigned int res_usr_hdl; /* Resource handle (user). */ + + long unsigned int res_addr; /* Mapped virtual address. */ + struct vm_area_struct *vma; /* VM area for this mapping. */ +- unsigned int ref_count; /* Reference count to this vma. */ ++ unsigned int ref_count; /* Reference count to this vma. */ + + /* Used to link maps associated with a resource. */ + struct list_head resource_map_list; + }; + +-/* Single resource allocation tracked for each opened device. +-*/ ++/* Single resource allocation tracked for each opened device. */ + struct SM_RESOURCE_T { + struct list_head resource_list; /* List of resources. */ + struct list_head global_resource_list; /* Global list of resources. */ +@@ -160,8 +157,7 @@ struct SM_RESOURCE_T { + bool map; /* whether to map pages up front */ + }; + +-/* Private file data associated with each opened device. +-*/ ++/* Private file data associated with each opened device. */ + struct SM_PRIV_DATA_T { + struct list_head resource_list; /* List of resources. */ + +@@ -177,8 +173,7 @@ struct SM_PRIV_DATA_T { + + }; + +-/* Global state information. +-*/ ++/* Global state information. */ + struct SM_STATE_T { + struct platform_device *pdev; + struct sm_instance *sm_handle; /* Handle for videocore service. */ +@@ -236,9 +231,10 @@ static inline unsigned int vcaddr_to_pfn(unsigned long vc_addr) + return pfn; + } + +-/* Carries over to the state statistics the statistics once owned by a deceased +-** resource. +-*/ ++/* ++ * Carries over to the state statistics the statistics once owned by a deceased ++ * resource. ++ */ + static void vc_sm_resource_deceased(struct SM_RESOURCE_T *p_res, int terminated) + { + if (sm_state != NULL) { +@@ -262,9 +258,10 @@ static void vc_sm_resource_deceased(struct SM_RESOURCE_T *p_res, int terminated) + } + } + +-/* Fetch a videocore handle corresponding to a mapping of the pid+address +-** returns 0 (ie NULL) if no such handle exists in the global map. +-*/ ++/* ++ * Fetch a videocore handle corresponding to a mapping of the pid+address ++ * returns 0 (ie NULL) if no such handle exists in the global map. ++ */ + static unsigned int vmcs_sm_vc_handle_from_pid_and_address(unsigned int pid, + unsigned int addr) + { +@@ -276,8 +273,7 @@ static unsigned int vmcs_sm_vc_handle_from_pid_and_address(unsigned int pid, + + mutex_lock(&(sm_state->map_lock)); + +- /* Lookup the resource. +- */ ++ /* Lookup the resource. */ + if (!list_empty(&sm_state->map_list)) { + list_for_each_entry(map, &sm_state->map_list, map_list) { + if (map->res_pid != pid || map->res_addr != addr) +@@ -295,13 +291,14 @@ static unsigned int vmcs_sm_vc_handle_from_pid_and_address(unsigned int pid, + mutex_unlock(&(sm_state->map_lock)); + + out: +- /* Use a debug log here as it may be a valid situation that we query +- ** for something that is not mapped, we do not want a kernel log each +- ** time around. +- ** +- ** There are other error log that would pop up accordingly if someone +- ** subsequently tries to use something invalid after being told not to +- ** use it... ++ /* ++ * Use a debug log here as it may be a valid situation that we query ++ * for something that is not mapped, we do not want a kernel log each ++ * time around. ++ * ++ * There are other error log that would pop up accordingly if someone ++ * subsequently tries to use something invalid after being told not to ++ * use it... + */ + if (handle == 0) { + pr_debug("[%s]: not a valid map (pid %u, addr %x)\n", +@@ -311,9 +308,10 @@ static unsigned int vmcs_sm_vc_handle_from_pid_and_address(unsigned int pid, + return handle; + } + +-/* Fetch a user handle corresponding to a mapping of the pid+address +-** returns 0 (ie NULL) if no such handle exists in the global map. +-*/ ++/* ++ * Fetch a user handle corresponding to a mapping of the pid+address ++ * returns 0 (ie NULL) if no such handle exists in the global map. ++ */ + static unsigned int vmcs_sm_usr_handle_from_pid_and_address(unsigned int pid, + unsigned int addr) + { +@@ -325,8 +323,7 @@ static unsigned int vmcs_sm_usr_handle_from_pid_and_address(unsigned int pid, + + mutex_lock(&(sm_state->map_lock)); + +- /* Lookup the resource. +- */ ++ /* Lookup the resource. */ + if (!list_empty(&sm_state->map_list)) { + list_for_each_entry(map, &sm_state->map_list, map_list) { + if (map->res_pid != pid || map->res_addr != addr) +@@ -344,7 +341,8 @@ static unsigned int vmcs_sm_usr_handle_from_pid_and_address(unsigned int pid, + mutex_unlock(&(sm_state->map_lock)); + + out: +- /* Use a debug log here as it may be a valid situation that we query ++ /* ++ * Use a debug log here as it may be a valid situation that we query + * for something that is not mapped yet. + * + * There are other error log that would pop up accordingly if someone +@@ -359,9 +357,10 @@ static unsigned int vmcs_sm_usr_handle_from_pid_and_address(unsigned int pid, + } + + #if defined(DO_NOT_USE) +-/* Fetch an address corresponding to a mapping of the pid+handle +-** returns 0 (ie NULL) if no such address exists in the global map. +-*/ ++/* ++ * Fetch an address corresponding to a mapping of the pid+handle ++ * returns 0 (ie NULL) if no such address exists in the global map. ++ */ + static unsigned int vmcs_sm_usr_address_from_pid_and_vc_handle(unsigned int pid, + unsigned int hdl) + { +@@ -373,8 +372,7 @@ static unsigned int vmcs_sm_usr_address_from_pid_and_vc_handle(unsigned int pid, + + mutex_lock(&(sm_state->map_lock)); + +- /* Lookup the resource. +- */ ++ /* Lookup the resource. */ + if (!list_empty(&sm_state->map_list)) { + list_for_each_entry(map, &sm_state->map_list, map_list) { + if (map->res_pid != pid || map->res_vc_hdl != hdl) +@@ -392,13 +390,14 @@ static unsigned int vmcs_sm_usr_address_from_pid_and_vc_handle(unsigned int pid, + mutex_unlock(&(sm_state->map_lock)); + + out: +- /* Use a debug log here as it may be a valid situation that we query +- ** for something that is not mapped, we do not want a kernel log each +- ** time around. +- ** +- ** There are other error log that would pop up accordingly if someone +- ** subsequently tries to use something invalid after being told not to +- ** use it... ++ /* ++ * Use a debug log here as it may be a valid situation that we query ++ * for something that is not mapped, we do not want a kernel log each ++ * time around. ++ * ++ * There are other error log that would pop up accordingly if someone ++ * subsequently tries to use something invalid after being told not to ++ * use it... + */ + if (addr == 0) + pr_debug("[%s]: not a valid map (pid %u, hdl %x)\n", +@@ -408,9 +407,10 @@ static unsigned int vmcs_sm_usr_address_from_pid_and_vc_handle(unsigned int pid, + } + #endif + +-/* Fetch an address corresponding to a mapping of the pid+handle +-** returns 0 (ie NULL) if no such address exists in the global map. +-*/ ++/* ++ * Fetch an address corresponding to a mapping of the pid+handle ++ * returns 0 (ie NULL) if no such address exists in the global map. ++ */ + static unsigned int vmcs_sm_usr_address_from_pid_and_usr_handle(unsigned int + pid, + unsigned int +@@ -424,8 +424,7 @@ static unsigned int vmcs_sm_usr_address_from_pid_and_usr_handle(unsigned int + + mutex_lock(&(sm_state->map_lock)); + +- /* Lookup the resource. +- */ ++ /* Lookup the resource. */ + if (!list_empty(&sm_state->map_list)) { + list_for_each_entry(map, &sm_state->map_list, map_list) { + if (map->res_pid != pid || map->res_usr_hdl != hdl) +@@ -443,7 +442,8 @@ static unsigned int vmcs_sm_usr_address_from_pid_and_usr_handle(unsigned int + mutex_unlock(&(sm_state->map_lock)); + + out: +- /* Use a debug log here as it may be a valid situation that we query ++ /* ++ * Use a debug log here as it may be a valid situation that we query + * for something that is not mapped, we do not want a kernel log each + * time around. + * +@@ -458,19 +458,16 @@ static unsigned int vmcs_sm_usr_address_from_pid_and_usr_handle(unsigned int + return addr; + } + +-/* Adds a resource mapping to the global data list. +-*/ ++/* Adds a resource mapping to the global data list. */ + static void vmcs_sm_add_map(struct SM_STATE_T *state, + struct SM_RESOURCE_T *resource, struct sm_mmap *map) + { + mutex_lock(&(state->map_lock)); + +- /* Add to the global list of mappings +- */ ++ /* Add to the global list of mappings */ + list_add(&map->map_list, &state->map_list); + +- /* Add to the list of mappings for this resource +- */ ++ /* Add to the list of mappings for this resource */ + list_add(&map->resource_map_list, &resource->map_list); + resource->map_count++; + +@@ -481,20 +478,17 @@ static void vmcs_sm_add_map(struct SM_STATE_T *state, + map->res_usr_hdl, map->res_addr); + } + +-/* Removes a resource mapping from the global data list. +-*/ ++/* Removes a resource mapping from the global data list. */ + static void vmcs_sm_remove_map(struct SM_STATE_T *state, + struct SM_RESOURCE_T *resource, + struct sm_mmap *map) + { + mutex_lock(&(state->map_lock)); + +- /* Remove from the global list of mappings +- */ ++ /* Remove from the global list of mappings */ + list_del(&map->map_list); + +- /* Remove from the list of mapping for this resource +- */ ++ /* Remove from the list of mapping for this resource */ + list_del(&map->resource_map_list); + if (resource->map_count > 0) + resource->map_count--; +@@ -508,8 +502,7 @@ static void vmcs_sm_remove_map(struct SM_STATE_T *state, + kfree(map); + } + +-/* Read callback for the global state proc entry. +-*/ ++/* Read callback for the global state proc entry. */ + static int vc_sm_global_state_show(struct seq_file *s, void *v) + { + struct sm_mmap *map = NULL; +@@ -523,8 +516,7 @@ static int vc_sm_global_state_show(struct seq_file *s, void *v) + seq_printf(s, "\nVC-ServiceHandle 0x%x\n", + (unsigned int)sm_state->sm_handle); + +- /* Log all applicable mapping(s). +- */ ++ /* Log all applicable mapping(s). */ + + mutex_lock(&(sm_state->map_lock)); + seq_puts(s, "\nResources\n"); +@@ -591,8 +583,7 @@ static int vc_sm_global_statistics_show(struct seq_file *s, void *v) + { + int ix; + +- /* Global state tracked statistics. +- */ ++ /* Global state tracked statistics. */ + if (sm_state != NULL) { + seq_puts(s, "\nDeceased Resources Statistics\n"); + +@@ -638,8 +629,7 @@ static int vc_sm_global_statistics_show(struct seq_file *s, void *v) + } + + #if 0 +-/* Read callback for the statistics proc entry. +-*/ ++/* Read callback for the statistics proc entry. */ + static int vc_sm_statistics_show(struct seq_file *s, void *v) + { + int ix; +@@ -654,8 +644,7 @@ static int vc_sm_statistics_show(struct seq_file *s, void *v) + if (file_data == NULL) + return 0; + +- /* Per process statistics. +- */ ++ /* Per process statistics. */ + + seq_printf(s, "\nStatistics for TGID %d\n", file_data->pid); + +@@ -771,9 +760,10 @@ static const struct file_operations vc_sm_debug_fs_fops = { + .release = single_release, + }; + +-/* Adds a resource to the private data list which tracks all the allocated +-** data. +-*/ ++/* ++ * Adds a resource to the private data list which tracks all the allocated ++ * data. ++ */ + static void vmcs_sm_add_resource(struct SM_PRIV_DATA_T *privdata, + struct SM_RESOURCE_T *resource) + { +@@ -787,9 +777,10 @@ static void vmcs_sm_add_resource(struct SM_PRIV_DATA_T *privdata, + resource->res_handle, resource->res_size, resource->res_cached); + } + +-/* Locates a resource and acquire a reference on it. +-** The resource won't be deleted while there is a reference on it. +-*/ ++/* ++ * Locates a resource and acquire a reference on it. ++ * The resource won't be deleted while there is a reference on it. ++ */ + static struct SM_RESOURCE_T *vmcs_sm_acquire_resource(struct SM_PRIV_DATA_T + *private, + unsigned int res_guid) +@@ -816,9 +807,10 @@ static struct SM_RESOURCE_T *vmcs_sm_acquire_resource(struct SM_PRIV_DATA_T + return ret; + } + +-/* Locates a resource and acquire a reference on it. +-** The resource won't be deleted while there is a reference on it. +-*/ ++/* ++ * Locates a resource and acquire a reference on it. ++ * The resource won't be deleted while there is a reference on it. ++ */ + static struct SM_RESOURCE_T *vmcs_sm_acquire_first_resource( + struct SM_PRIV_DATA_T *private) + { +@@ -841,9 +833,10 @@ static struct SM_RESOURCE_T *vmcs_sm_acquire_first_resource( + return ret; + } + +-/* Locates a resource and acquire a reference on it. +-** The resource won't be deleted while there is a reference on it. +-*/ ++/* ++ * Locates a resource and acquire a reference on it. ++ * The resource won't be deleted while there is a reference on it. ++ */ + static struct SM_RESOURCE_T *vmcs_sm_acquire_global_resource(unsigned int + res_guid) + { +@@ -870,9 +863,10 @@ static struct SM_RESOURCE_T *vmcs_sm_acquire_global_resource(unsigned int + return ret; + } + +-/* Release a previously acquired resource. +-** The resource will be deleted when its refcount reaches 0. +-*/ ++/* ++ * Release a previously acquired resource. ++ * The resource will be deleted when its refcount reaches 0. ++ */ + static void vmcs_sm_release_resource(struct SM_RESOURCE_T *resource, int force) + { + struct SM_PRIV_DATA_T *private = resource->private; +@@ -961,16 +955,16 @@ static void vmcs_sm_release_resource(struct SM_RESOURCE_T *resource, int force) + kfree(resource); + } + +-/* Dump the map table for the driver. If process is -1, dumps the whole table, +-** if process is a valid pid (non -1) dump only the entries associated with the +-** pid of interest. +-*/ ++/* ++ * Dump the map table for the driver. If process is -1, dumps the whole table, ++ * if process is a valid pid (non -1) dump only the entries associated with the ++ * pid of interest. ++ */ + static void vmcs_sm_host_walk_map_per_pid(int pid) + { + struct sm_mmap *map = NULL; + +- /* Make sure the device was started properly. +- */ ++ /* Make sure the device was started properly. */ + if (sm_state == NULL) { + pr_err("[%s]: invalid device\n", __func__); + return; +@@ -978,8 +972,7 @@ static void vmcs_sm_host_walk_map_per_pid(int pid) + + mutex_lock(&(sm_state->map_lock)); + +- /* Log all applicable mapping(s). +- */ ++ /* Log all applicable mapping(s). */ + if (!list_empty(&sm_state->map_list)) { + list_for_each_entry(map, &sm_state->map_list, map_list) { + if (pid == -1 || map->res_pid == pid) { +@@ -995,15 +988,15 @@ static void vmcs_sm_host_walk_map_per_pid(int pid) + return; + } + +-/* Dump the allocation table from host side point of view. This only dumps the +-** data allocated for this process/device referenced by the file_data. +-*/ ++/* ++ * Dump the allocation table from host side point of view. This only dumps the ++ * data allocated for this process/device referenced by the file_data. ++ */ + static void vmcs_sm_host_walk_alloc(struct SM_PRIV_DATA_T *file_data) + { + struct SM_RESOURCE_T *resource = NULL; + +- /* Make sure the device was started properly. +- */ ++ /* Make sure the device was started properly. */ + if ((sm_state == NULL) || (file_data == NULL)) { + pr_err("[%s]: invalid device\n", __func__); + return; +@@ -1026,8 +1019,7 @@ static void vmcs_sm_host_walk_alloc(struct SM_PRIV_DATA_T *file_data) + return; + } + +-/* Create support for private data tracking. +-*/ ++/* Create support for private data tracking. */ + static struct SM_PRIV_DATA_T *vc_sm_create_priv_data(pid_t id) + { + char alloc_name[32]; +@@ -1078,15 +1070,15 @@ static struct SM_PRIV_DATA_T *vc_sm_create_priv_data(pid_t id) + return file_data; + } + +-/* Open the device. Creates a private state to help track all allocation +-** associated with this device. +-*/ ++/* ++ * Open the device. Creates a private state to help track all allocation ++ * associated with this device. ++ */ + static int vc_sm_open(struct inode *inode, struct file *file) + { + int ret = 0; + +- /* Make sure the device was started properly. +- */ ++ /* Make sure the device was started properly. */ + if (!sm_state) { + pr_err("[%s]: invalid device\n", __func__); + ret = -EPERM; +@@ -1105,9 +1097,10 @@ static int vc_sm_open(struct inode *inode, struct file *file) + return ret; + } + +-/* Close the device. Free up all resources still associated with this device +-** at the time. +-*/ ++/* ++ * Close the device. Free up all resources still associated with this device ++ * at the time. ++ */ + static int vc_sm_release(struct inode *inode, struct file *file) + { + struct SM_PRIV_DATA_T *file_data = +@@ -1115,8 +1108,7 @@ static int vc_sm_release(struct inode *inode, struct file *file) + struct SM_RESOURCE_T *resource; + int ret = 0; + +- /* Make sure the device was started properly. +- */ ++ /* Make sure the device was started properly. */ + if (sm_state == NULL || file_data == NULL) { + pr_err("[%s]: invalid device\n", __func__); + ret = -EPERM; +@@ -1146,8 +1138,7 @@ static int vc_sm_release(struct inode *inode, struct file *file) + /* Remove the corresponding proc entry. */ + debugfs_remove_recursive(file_data->dir_pid); + +- /* Terminate the private data. +- */ ++ /* Terminate the private data. */ + kfree(file_data); + + out: +@@ -1175,8 +1166,7 @@ static void vcsm_vma_close(struct vm_area_struct *vma) + + map->ref_count--; + +- /* Remove from the map table. +- */ ++ /* Remove from the map table. */ + if (map->ref_count == 0) + vmcs_sm_remove_map(sm_state, map->resource, map); + } +@@ -1189,8 +1179,7 @@ static int vcsm_vma_fault(struct vm_fault *vmf) + unsigned long pfn; + int ret = 0; + +- /* Lock the resource if necessary. +- */ ++ /* Lock the resource if necessary. */ + if (!resource->lock_count) { + struct vc_sm_lock_unlock_t lock_unlock; + struct vc_sm_lock_result_t lock_result; +@@ -1203,8 +1192,7 @@ static int vcsm_vma_fault(struct vm_fault *vmf) + __func__, lock_unlock.res_handle, + (void *)lock_unlock.res_mem); + +- /* Lock the videocore allocated resource. +- */ ++ /* Lock the videocore allocated resource. */ + status = vc_vchi_sm_lock(sm_state->sm_handle, + &lock_unlock, &lock_result, 0); + if (status || !lock_result.res_mem) { +@@ -1221,8 +1209,7 @@ static int vcsm_vma_fault(struct vm_fault *vmf) + resource->res_stats[LOCK]++; + resource->lock_count++; + +- /* Keep track of the new base memory. +- */ ++ /* Keep track of the new base memory. */ + if (lock_result.res_mem && + lock_result.res_old_mem && + (lock_result.res_mem != lock_result.res_old_mem)) { +@@ -1244,9 +1231,9 @@ static int vcsm_vma_fault(struct vm_fault *vmf) + case 0: + case -ERESTARTSYS: + /* +- * EBUSY is ok: this just means that another thread +- * already did the job. +- */ ++ * EBUSY is ok: this just means that another thread ++ * already did the job. ++ */ + case -EBUSY: + return VM_FAULT_NOPAGE; + case -ENOMEM: +@@ -1324,8 +1311,7 @@ static void vcsm_vma_cache_clean_page_range(unsigned long addr, + } while (pgd++, addr = pgd_next, addr != end); + } + +-/* Map an allocated data into something that the user space. +-*/ ++/* Map an allocated data into something that the user space. */ + static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + { + int ret = 0; +@@ -1334,8 +1320,7 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + struct SM_RESOURCE_T *resource = NULL; + struct sm_mmap *map = NULL; + +- /* Make sure the device was started properly. +- */ ++ /* Make sure the device was started properly. */ + if ((sm_state == NULL) || (file_data == NULL)) { + pr_err("[%s]: invalid device\n", __func__); + return -EPERM; +@@ -1344,11 +1329,12 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + pr_debug("[%s]: private data %p, guid %x\n", __func__, file_data, + ((unsigned int)vma->vm_pgoff << PAGE_SHIFT)); + +- /* We lookup to make sure that the data we are being asked to mmap is +- ** something that we allocated. +- ** +- ** We use the offset information as the key to tell us which resource +- ** we are mapping. ++ /* ++ * We lookup to make sure that the data we are being asked to mmap is ++ * something that we allocated. ++ * ++ * We use the offset information as the key to tell us which resource ++ * we are mapping. + */ + resource = vmcs_sm_acquire_resource(file_data, + ((unsigned int)vma->vm_pgoff << +@@ -1363,8 +1349,7 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + __func__, resource->res_guid, current->tgid, resource->pid, + file_data->pid); + +- /* Check permissions. +- */ ++ /* Check permissions. */ + if (resource->pid && (resource->pid != current->tgid)) { + pr_err("[%s]: current tgid %u != %u owner\n", + __func__, current->tgid, resource->pid); +@@ -1372,8 +1357,7 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + goto error; + } + +- /* Verify that what we are asked to mmap is proper. +- */ ++ /* Verify that what we are asked to mmap is proper. */ + if (resource->res_size != (unsigned int)(vma->vm_end - vma->vm_start)) { + pr_err("[%s]: size inconsistency (resource: %u - mmap: %u)\n", + __func__, +@@ -1384,7 +1368,8 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + goto error; + } + +- /* Keep track of the tuple in the global resource list such that one ++ /* ++ * Keep track of the tuple in the global resource list such that one + * can do a mapping lookup for address/memory handle. + */ + map = kzalloc(sizeof(*map), GFP_KERNEL); +@@ -1403,8 +1388,9 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + map->vma = vma; + vmcs_sm_add_map(sm_state, resource, map); + +- /* We are not actually mapping the pages, we just provide a fault +- ** handler to allow pages to be mapped when accessed ++ /* ++ * We are not actually mapping the pages, we just provide a fault ++ * handler to allow pages to be mapped when accessed + */ + vma->vm_flags |= + VM_IO | VM_PFNMAP | VM_DONTCOPY | VM_DONTEXPAND; +@@ -1418,8 +1404,7 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + + if ((resource->res_cached == VMCS_SM_CACHE_NONE) || + (resource->res_cached == VMCS_SM_CACHE_VC)) { +- /* Allocated non host cached memory, honour it. +- */ ++ /* Allocated non host cached memory, honour it. */ + vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); + } + +@@ -1462,8 +1447,7 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + return ret; + } + +-/* Allocate a shared memory handle and block. +-*/ ++/* Allocate a shared memory handle and block. */ + int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + struct vmcs_sm_ioctl_alloc *ioparam) + { +@@ -1505,8 +1489,7 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + __func__, alloc.name, alloc.type, ioparam->size, + alloc.base_unit, alloc.num_unit, alloc.alignement); + +- /* Allocate local resource to track this allocation. +- */ ++ /* Allocate local resource to track this allocation. */ + resource = kzalloc(sizeof(*resource), GFP_KERNEL); + if (!resource) { + ret = -ENOMEM; +@@ -1516,8 +1499,7 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + resource->ref_count++; + resource->pid = current->tgid; + +- /* Allocate the videocore resource. +- */ ++ /* Allocate the videocore resource. */ + status = vc_vchi_sm_alloc(sm_state->sm_handle, &alloc, &result, + &private->int_trans_id); + if (status == -EINTR) { +@@ -1535,8 +1517,7 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + goto error; + } + +- /* Keep track of the resource we created. +- */ ++ /* Keep track of the resource we created. */ + resource->private = private; + resource->res_handle = result.res_handle; + resource->res_base_mem = (void *)result.res_mem; +@@ -1544,7 +1525,8 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + resource->res_cached = cached; + resource->map = map; + +- /* Kernel/user GUID. This global identifier is used for mmap'ing the ++ /* ++ * Kernel/user GUID. This global identifier is used for mmap'ing the + * allocated region from user space, it is passed as the mmap'ing + * offset, we use it to 'hide' the videocore handle/address. + */ +@@ -1576,8 +1558,7 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + return ret; + } + +-/* Share an allocate memory handle and block. +-*/ ++/* Share an allocate memory handle and block.*/ + int vc_sm_ioctl_alloc_share(struct SM_PRIV_DATA_T *private, + struct vmcs_sm_ioctl_alloc_share *ioparam) + { +@@ -1593,8 +1574,7 @@ int vc_sm_ioctl_alloc_share(struct SM_PRIV_DATA_T *private, + goto error; + } + +- /* Allocate local resource to track this allocation. +- */ ++ /* Allocate local resource to track this allocation. */ + resource = kzalloc(sizeof(*resource), GFP_KERNEL); + if (resource == NULL) { + pr_err("[%s]: failed to allocate local tracking resource\n", +@@ -1606,8 +1586,7 @@ int vc_sm_ioctl_alloc_share(struct SM_PRIV_DATA_T *private, + resource->ref_count++; + resource->pid = current->tgid; + +- /* Keep track of the resource we created. +- */ ++ /* Keep track of the resource we created. */ + resource->private = private; + resource->res_handle = shared_resource->res_handle; + resource->res_base_mem = shared_resource->res_base_mem; +@@ -1641,8 +1620,7 @@ int vc_sm_ioctl_alloc_share(struct SM_PRIV_DATA_T *private, + return ret; + } + +-/* Free a previously allocated shared memory handle and block. +-*/ ++/* Free a previously allocated shared memory handle and block.*/ + static int vc_sm_ioctl_free(struct SM_PRIV_DATA_T *private, + struct vmcs_sm_ioctl_free *ioparam) + { +@@ -1655,8 +1633,7 @@ static int vc_sm_ioctl_free(struct SM_PRIV_DATA_T *private, + return -EINVAL; + } + +- /* Check permissions. +- */ ++ /* Check permissions. */ + if (resource->pid && (resource->pid != current->tgid)) { + pr_err("[%s]: current tgid %u != %u owner\n", + __func__, current->tgid, resource->pid); +@@ -1669,8 +1646,7 @@ static int vc_sm_ioctl_free(struct SM_PRIV_DATA_T *private, + return 0; + } + +-/* Resize a previously allocated shared memory handle and block. +-*/ ++/* Resize a previously allocated shared memory handle and block. */ + static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + struct vmcs_sm_ioctl_resize *ioparam) + { +@@ -1679,8 +1655,7 @@ static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + struct vc_sm_resize_t resize; + struct SM_RESOURCE_T *resource; + +- /* Locate resource from GUID. +- */ ++ /* Locate resource from GUID. */ + resource = vmcs_sm_acquire_resource(private, ioparam->handle); + if (!resource) { + pr_err("[%s]: failed resource - guid %x\n", +@@ -1689,9 +1664,10 @@ static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + goto error; + } + +- /* If the resource is locked, its reference count will be not NULL, +- ** in which case we will not be allowed to resize it anyways, so +- ** reject the attempt here. ++ /* ++ * If the resource is locked, its reference count will be not NULL, ++ * in which case we will not be allowed to resize it anyways, so ++ * reject the attempt here. + */ + if (resource->lock_count != 0) { + pr_err("[%s]: cannot resize - guid %x, ref-cnt %d\n", +@@ -1700,8 +1676,7 @@ static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + goto error; + } + +- /* Check permissions. +- */ ++ /* Check permissions. */ + if (resource->pid && (resource->pid != current->tgid)) { + pr_err("[%s]: current tgid %u != %u owner\n", __func__, + current->tgid, resource->pid); +@@ -1724,8 +1699,7 @@ static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + __func__, ioparam->handle, resize.res_handle, + (void *)resize.res_mem); + +- /* Resize the videocore allocated resource. +- */ ++ /* Resize the videocore allocated resource. */ + status = vc_vchi_sm_resize(sm_state->sm_handle, &resize, + &private->int_trans_id); + if (status == -EINTR) { +@@ -1746,8 +1720,7 @@ static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + __func__, resize.res_handle, resource->res_size, + resize.res_new_size); + +- /* Successfully resized, save the information and inform the user. +- */ ++ /* Successfully resized, save the information and inform the user. */ + ioparam->old_size = resource->res_size; + resource->res_size = resize.res_new_size; + +@@ -1758,8 +1731,7 @@ static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + return ret; + } + +-/* Lock a previously allocated shared memory handle and block. +-*/ ++/* Lock a previously allocated shared memory handle and block. */ + static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + struct vmcs_sm_ioctl_lock_unlock *ioparam, + int change_cache, enum vmcs_sm_cache_e cache_type, +@@ -1775,16 +1747,14 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + + map = NULL; + +- /* Locate resource from GUID. +- */ ++ /* Locate resource from GUID. */ + resource = vmcs_sm_acquire_resource(private, ioparam->handle); + if (resource == NULL) { + ret = -EINVAL; + goto error; + } + +- /* Check permissions. +- */ ++ /* Check permissions. */ + if (resource->pid && (resource->pid != current->tgid)) { + pr_err("[%s]: current tgid %u != %u owner\n", __func__, + current->tgid, resource->pid); +@@ -1795,15 +1765,13 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + lock.res_handle = resource->res_handle; + lock.res_mem = (uint32_t)resource->res_base_mem; + +- /* Take the lock and get the address to be mapped. +- */ ++ /* Take the lock and get the address to be mapped. */ + if (vc_addr == 0) { + pr_debug("[%s]: attempt to lock data - guid %x, hdl %x, base address %p\n", + __func__, ioparam->handle, lock.res_handle, + (void *)lock.res_mem); + +- /* Lock the videocore allocated resource. +- */ ++ /* Lock the videocore allocated resource. */ + status = vc_vchi_sm_lock(sm_state->sm_handle, &lock, &result, + &private->int_trans_id); + if (status == -EINTR) { +@@ -1826,24 +1794,21 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + __func__, lock.res_handle, (void *)result.res_mem, + (void *)lock.res_mem, resource->lock_count); + } +- /* Lock assumed taken already, address to be mapped is known. +- */ ++ /* Lock assumed taken already, address to be mapped is known. */ + else + resource->res_base_mem = (void *)vc_addr; + + resource->res_stats[LOCK]++; + resource->lock_count++; + +- /* Keep track of the new base memory allocation if it has changed. +- */ ++ /* Keep track of the new base memory allocation if it has changed. */ + if ((vc_addr == 0) && + ((void *)result.res_mem) && + ((void *)result.res_old_mem) && + (result.res_mem != result.res_old_mem)) { + resource->res_base_mem = (void *)result.res_mem; + +- /* Kernel allocated resources. +- */ ++ /* Kernel allocated resources. */ + if (resource->pid == 0) { + if (!list_empty(&resource->map_list)) { + list_for_each_entry_safe(map, map_tmp, +@@ -1875,8 +1840,7 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + __func__, resource->map_count, private->pid, + current->tgid, ioparam->handle, ioparam->addr); + } else { +- /* Kernel allocated resources. +- */ ++ /* Kernel allocated resources. */ + if (resource->pid == 0) { + pr_debug("[%s]: attempt mapping kernel resource - guid %x, hdl %x\n", + __func__, ioparam->handle, lock.res_handle); +@@ -1933,8 +1897,7 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + return ret; + } + +-/* Unlock a previously allocated shared memory handle and block. +-*/ ++/* Unlock a previously allocated shared memory handle and block.*/ + static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + struct vmcs_sm_ioctl_lock_unlock *ioparam, + int flush, int wait_reply, int no_vc_unlock) +@@ -1947,16 +1910,14 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + + map = NULL; + +- /* Locate resource from GUID. +- */ ++ /* Locate resource from GUID. */ + resource = vmcs_sm_acquire_resource(private, ioparam->handle); + if (resource == NULL) { + ret = -EINVAL; + goto error; + } + +- /* Check permissions. +- */ ++ /* Check permissions. */ + if (resource->pid && (resource->pid != current->tgid)) { + pr_err("[%s]: current tgid %u != %u owner\n", + __func__, current->tgid, resource->pid); +@@ -1971,8 +1932,7 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + __func__, ioparam->handle, unlock.res_handle, + (void *)unlock.res_mem); + +- /* User space allocated resources. +- */ ++ /* User space allocated resources. */ + if (resource->pid) { + /* Flush if requested */ + if (resource->res_cached && flush) { +@@ -2071,12 +2031,10 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + } + + if (resource->lock_count) { +- /* Bypass the videocore unlock. +- */ ++ /* Bypass the videocore unlock. */ + if (no_vc_unlock) + status = 0; +- /* Unlock the videocore allocated resource. +- */ ++ /* Unlock the videocore allocated resource. */ + else { + status = + vc_vchi_sm_unlock(sm_state->sm_handle, &unlock, +@@ -2116,9 +2074,7 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + return ret; + } + +-/* +- * Import a contiguous block of memory to be shared with VC. +- */ ++/* Import a contiguous block of memory to be shared with VC. */ + int vc_sm_ioctl_import_dmabuf(struct SM_PRIV_DATA_T *private, + struct vmcs_sm_ioctl_import_dmabuf *ioparam, + struct dma_buf *src_dma_buf) +@@ -2205,8 +2161,7 @@ int vc_sm_ioctl_import_dmabuf(struct SM_PRIV_DATA_T *private, + goto error; + } + +- /* Keep track of the resource we created. +- */ ++ /* Keep track of the resource we created. */ + resource->private = private; + resource->res_handle = result.res_handle; + resource->res_size = import.size; +@@ -2217,7 +2172,8 @@ int vc_sm_ioctl_import_dmabuf(struct SM_PRIV_DATA_T *private, + resource->sgt = sgt; + resource->dma_addr = sg_dma_address(sgt->sgl); + +- /* Kernel/user GUID. This global identifier is used for mmap'ing the ++ /* ++ * Kernel/user GUID. This global identifier is used for mmap'ing the + * allocated region from user space, it is passed as the mmap'ing + * offset, we use it to 'hide' the videocore handle/address. + */ +@@ -2282,8 +2238,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + file_data->restart_sys = 0; + } + +- /* Now process the command. +- */ ++ /* Now process the command. */ + switch (cmdnr) { + /* New memory allocation. + */ +@@ -2291,8 +2246,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + { + struct vmcs_sm_ioctl_alloc ioparam; + +- /* Get the parameter data. +- */ ++ /* Get the parameter data. */ + if (copy_from_user + (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { + pr_err("[%s]: failed to copy-from-user for cmd %x\n", +@@ -2314,20 +2268,17 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + ret = -EFAULT; + } + +- /* Done. +- */ ++ /* Done. */ + goto out; + } + break; + +- /* Share existing memory allocation. +- */ ++ /* Share existing memory allocation. */ + case VMCS_SM_CMD_ALLOC_SHARE: + { + struct vmcs_sm_ioctl_alloc_share ioparam; + +- /* Get the parameter data. +- */ ++ /* Get the parameter data. */ + if (copy_from_user + (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { + pr_err("[%s]: failed to copy-from-user for cmd %x\n", +@@ -2338,8 +2289,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + + ret = vc_sm_ioctl_alloc_share(file_data, &ioparam); + +- /* Copy result back to user. +- */ ++ /* Copy result back to user. */ + if (!ret + && copy_to_user((void *)arg, &ioparam, + sizeof(ioparam)) != 0) { +@@ -2352,8 +2302,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + ret = -EFAULT; + } + +- /* Done. +- */ ++ /* Done. */ + goto out; + } + break; +@@ -2362,8 +2311,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + { + struct vmcs_sm_ioctl_import_dmabuf ioparam; + +- /* Get the parameter data. +- */ ++ /* Get the parameter data. */ + if (copy_from_user + (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { + pr_err("[%s]: failed to copy-from-user for cmd %x\n", +@@ -2386,21 +2334,18 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + ret = -EFAULT; + } + +- /* Done. +- */ ++ /* Done. */ + goto out; + } + break; + +- /* Lock (attempt to) *and* register a cache behavior change. +- */ ++ /* Lock (attempt to) *and* register a cache behavior change. */ + case VMCS_SM_CMD_LOCK_CACHE: + { + struct vmcs_sm_ioctl_lock_cache ioparam; + struct vmcs_sm_ioctl_lock_unlock lock; + +- /* Get parameter data. +- */ ++ /* Get parameter data. */ + if (copy_from_user + (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { + pr_err("[%s]: failed to copy-from-user for cmd %x\n", +@@ -2414,20 +2359,17 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + vc_sm_ioctl_lock(file_data, &lock, 1, + ioparam.cached, 0); + +- /* Done. +- */ ++ /* Done. */ + goto out; + } + break; + +- /* Lock (attempt to) existing memory allocation. +- */ ++ /* Lock (attempt to) existing memory allocation. */ + case VMCS_SM_CMD_LOCK: + { + struct vmcs_sm_ioctl_lock_unlock ioparam; + +- /* Get parameter data. +- */ ++ /* Get parameter data. */ + if (copy_from_user + (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { + pr_err("[%s]: failed to copy-from-user for cmd %x\n", +@@ -2438,8 +2380,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + + ret = vc_sm_ioctl_lock(file_data, &ioparam, 0, 0, 0); + +- /* Copy result back to user. +- */ ++ /* Copy result back to user. */ + if (copy_to_user((void *)arg, &ioparam, sizeof(ioparam)) + != 0) { + pr_err("[%s]: failed to copy-to-user for cmd %x\n", +@@ -2447,20 +2388,17 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + ret = -EFAULT; + } + +- /* Done. +- */ ++ /* Done. */ + goto out; + } + break; + +- /* Unlock (attempt to) existing memory allocation. +- */ ++ /* Unlock (attempt to) existing memory allocation. */ + case VMCS_SM_CMD_UNLOCK: + { + struct vmcs_sm_ioctl_lock_unlock ioparam; + +- /* Get parameter data. +- */ ++ /* Get parameter data. */ + if (copy_from_user + (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { + pr_err("[%s]: failed to copy-from-user for cmd %x\n", +@@ -2471,20 +2409,17 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + + ret = vc_sm_ioctl_unlock(file_data, &ioparam, 0, 1, 0); + +- /* Done. +- */ ++ /* Done. */ + goto out; + } + break; + +- /* Resize (attempt to) existing memory allocation. +- */ ++ /* Resize (attempt to) existing memory allocation. */ + case VMCS_SM_CMD_RESIZE: + { + struct vmcs_sm_ioctl_resize ioparam; + +- /* Get parameter data. +- */ ++ /* Get parameter data. */ + if (copy_from_user + (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { + pr_err("[%s]: failed to copy-from-user for cmd %x\n", +@@ -2495,17 +2430,13 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + + ret = vc_sm_ioctl_resize(file_data, &ioparam); + +- /* Copy result back to user. +- */ ++ /* Copy result back to user. */ + if (copy_to_user((void *)arg, &ioparam, sizeof(ioparam)) + != 0) { + pr_err("[%s]: failed to copy-to-user for cmd %x\n", + __func__, cmdnr); + ret = -EFAULT; + } +- +- /* Done. +- */ + goto out; + } + break; +@@ -2550,7 +2481,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + goto out; + } + break; +-/* Walk mapping table on host, information shows up in the ++ /* Walk mapping table on host, information shows up in the + ** kernel log. + */ + case VMCS_SM_CMD_HOST_WALK_MAP: +@@ -2589,7 +2520,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + { + struct vmcs_sm_ioctl_walk ioparam; + +- /* Get parameter data. */ ++ /* Get parameter data. */ + if (copy_from_user(&ioparam, + (void *)arg, sizeof(ioparam)) != 0) { + pr_err("[%s]: failed to copy-from-user for cmd %x\n", +@@ -2646,8 +2577,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + { + struct vmcs_sm_ioctl_chk ioparam; + +- /* Get parameter data. +- */ ++ /* Get parameter data. */ + if (copy_from_user(&ioparam, + (void *)arg, sizeof(ioparam)) != 0) { + pr_err("[%s]: failed to copy-from-user for cmd %x\n", +@@ -2662,7 +2592,8 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + vmcs_sm_acquire_resource(file_data, ioparam.handle); + if (resource == NULL) + ret = -EINVAL; +- /* If the resource is cacheable, return additional ++ /* ++ * If the resource is cacheable, return additional + * information that may be needed to flush the cache. + */ + else if ((resource->res_cached == VMCS_SM_CACHE_HOST) || +@@ -2688,8 +2619,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + ret = -EFAULT; + } + +- /* Done. +- */ ++ /* Done. */ + goto out; + } + break; +@@ -2768,8 +2698,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + ret = -EFAULT; + } + +- /* Done. +- */ ++ /* Done. */ + goto out; + } + break; +@@ -2851,8 +2780,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + } + break; + +- /* Maps a user address given process and vc handle. +- */ ++ /* Maps a user address given process and vc handle. */ + case VMCS_SM_CMD_MAPPED_USR_ADDRESS: + { + struct vmcs_sm_ioctl_map ioparam; +@@ -2955,8 +2883,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + goto out; + } + +- /* Locate resource from GUID. +- */ ++ /* Locate resource from GUID. */ + resource = + vmcs_sm_acquire_resource(file_data, ioparam.handle); + +@@ -2992,8 +2919,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + if (resource) + vmcs_sm_release_resource(resource, 0); + +- /* Done. +- */ ++ /* Done. */ + goto out; + } + break; +@@ -3019,8 +2945,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + case 2: /* L1/L2 clean physical range */ + case 3: /* L1/L2 clean+invalidate all */ + { +- /* Locate resource from GUID. +- */ ++ /* Locate resource from GUID. */ + resource = + vmcs_sm_acquire_resource(file_data, ioparam.s[i].handle); + +@@ -3123,8 +3048,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + return ret; + } + +-/* Device operations that we managed in this driver. +-*/ ++/* Device operations that we managed in this driver. */ + static const struct file_operations vmcs_sm_ops = { + .owner = THIS_MODULE, + .unlocked_ioctl = vc_sm_ioctl, +@@ -3133,8 +3057,7 @@ static const struct file_operations vmcs_sm_ops = { + .mmap = vc_sm_mmap, + }; + +-/* Creation of device. +-*/ ++/* Creation of device. */ + static int vc_sm_create_sharedmemory(void) + { + int ret; +@@ -3144,8 +3067,7 @@ static int vc_sm_create_sharedmemory(void) + goto out; + } + +- /* Create a device class for creating dev nodes. +- */ ++ /* Create a device class for creating dev nodes. */ + sm_state->sm_class = class_create(THIS_MODULE, "vc-sm"); + if (IS_ERR(sm_state->sm_class)) { + pr_err("[%s]: unable to create device class\n", __func__); +@@ -3153,8 +3075,7 @@ static int vc_sm_create_sharedmemory(void) + goto out; + } + +- /* Create a character driver. +- */ ++ /* Create a character driver. */ + ret = alloc_chrdev_region(&sm_state->sm_devid, + DEVICE_MINOR, 1, DEVICE_NAME); + if (ret != 0) { +@@ -3169,8 +3090,7 @@ static int vc_sm_create_sharedmemory(void) + goto out_chrdev_unreg; + } + +- /* Create a device node. +- */ ++ /* Create a device node. */ + sm_state->sm_dev = device_create(sm_state->sm_class, + NULL, + MKDEV(MAJOR(sm_state->sm_devid), +@@ -3195,25 +3115,21 @@ static int vc_sm_create_sharedmemory(void) + return ret; + } + +-/* Termination of the device. +-*/ ++/* Termination of the device. */ + static int vc_sm_remove_sharedmemory(void) + { + int ret; + + if (sm_state == NULL) { +- /* Nothing to do. +- */ ++ /* Nothing to do. */ + ret = 0; + goto out; + } + +- /* Remove the sharedmemory character driver. +- */ ++ /* Remove the sharedmemory character driver. */ + cdev_del(&sm_state->sm_cdev); + +- /* Unregister region. +- */ ++ /* Unregister region. */ + unregister_chrdev_region(sm_state->sm_devid, 1); + + ret = 0; +@@ -3232,8 +3148,9 @@ static void vc_sm_connected_init(void) + + pr_info("[%s]: start\n", __func__); + +- /* Initialize and create a VCHI connection for the shared memory service +- ** running on videocore. ++ /* ++ * Initialize and create a VCHI connection for the shared memory service ++ * running on videocore. + */ + ret = vchi_initialise(&vchi_instance); + if (ret != 0) { +@@ -3306,8 +3223,7 @@ static void vc_sm_connected_init(void) + goto err_remove_shared_memory; + } + +- /* Done! +- */ ++ /* Done! */ + sm_inited = 1; + goto out; + +@@ -3344,20 +3260,16 @@ static int bcm2835_vcsm_remove(struct platform_device *pdev) + { + pr_debug("[%s]: start\n", __func__); + if (sm_inited) { +- /* Remove shared memory device. +- */ ++ /* Remove shared memory device. */ + vc_sm_remove_sharedmemory(); + +- /* Remove all proc entries. +- */ ++ /* Remove all proc entries. */ + debugfs_remove_recursive(sm_state->dir_root); + +- /* Stop the videocore shared memory service. +- */ ++ /* Stop the videocore shared memory service. */ + vc_vchi_sm_stop(&sm_state->sm_handle); + +- /* Free the memory for the state structure. +- */ ++ /* Free the memory for the state structure. */ + mutex_destroy(&(sm_state->map_lock)); + kfree(sm_state); + } +@@ -3374,8 +3286,7 @@ int vc_sm_alloc(struct vc_sm_alloc_t *alloc, int *handle) + int ret; + struct SM_RESOURCE_T *resource; + +- /* Validate we can work with this device. +- */ ++ /* Validate we can work with this device. */ + if (sm_state == NULL || alloc == NULL || handle == NULL) { + pr_err("[%s]: invalid input\n", __func__); + return -EPERM; +@@ -3396,8 +3307,7 @@ int vc_sm_alloc(struct vc_sm_alloc_t *alloc, int *handle) + resource->pid = 0; + vmcs_sm_release_resource(resource, 0); + +- /* Assign valid handle at this time. +- */ ++ /* Assign valid handle at this time. */ + *handle = ioparam.handle; + } else { + ret = -ENOMEM; +@@ -3408,22 +3318,19 @@ int vc_sm_alloc(struct vc_sm_alloc_t *alloc, int *handle) + } + EXPORT_SYMBOL_GPL(vc_sm_alloc); + +-/* Get an internal resource handle mapped from the external one. +-*/ ++/* Get an internal resource handle mapped from the external one. */ + int vc_sm_int_handle(int handle) + { + struct SM_RESOURCE_T *resource; + int ret = 0; + +- /* Validate we can work with this device. +- */ ++ /* Validate we can work with this device. */ + if (sm_state == NULL || handle == 0) { + pr_err("[%s]: invalid input\n", __func__); + return 0; + } + +- /* Locate resource from GUID. +- */ ++ /* Locate resource from GUID. */ + resource = vmcs_sm_acquire_resource(sm_state->data_knl, handle); + if (resource) { + ret = resource->res_handle; +@@ -3434,14 +3341,12 @@ int vc_sm_int_handle(int handle) + } + EXPORT_SYMBOL_GPL(vc_sm_int_handle); + +-/* Free a previously allocated shared memory handle and block. +-*/ ++/* Free a previously allocated shared memory handle and block. */ + int vc_sm_free(int handle) + { + struct vmcs_sm_ioctl_free ioparam = { handle }; + +- /* Validate we can work with this device. +- */ ++ /* Validate we can work with this device. */ + if (sm_state == NULL || handle == 0) { + pr_err("[%s]: invalid input\n", __func__); + return -EPERM; +@@ -3451,16 +3356,14 @@ int vc_sm_free(int handle) + } + EXPORT_SYMBOL_GPL(vc_sm_free); + +-/* Lock a memory handle for use by kernel. +-*/ ++/* Lock a memory handle for use by kernel. */ + int vc_sm_lock(int handle, VC_SM_LOCK_CACHE_MODE_T mode, + long unsigned int *data) + { + struct vmcs_sm_ioctl_lock_unlock ioparam; + int ret; + +- /* Validate we can work with this device. +- */ ++ /* Validate we can work with this device. */ + if (sm_state == NULL || handle == 0 || data == NULL) { + pr_err("[%s]: invalid input\n", __func__); + return -EPERM; +@@ -3481,14 +3384,12 @@ int vc_sm_lock(int handle, VC_SM_LOCK_CACHE_MODE_T mode, + } + EXPORT_SYMBOL_GPL(vc_sm_lock); + +-/* Unlock a memory handle in use by kernel. +-*/ ++/* Unlock a memory handle in use by kernel. */ + int vc_sm_unlock(int handle, int flush, int no_vc_unlock) + { + struct vmcs_sm_ioctl_lock_unlock ioparam; + +- /* Validate we can work with this device. +- */ ++ /* Validate we can work with this device. */ + if (sm_state == NULL || handle == 0) { + pr_err("[%s]: invalid input\n", __func__); + return -EPERM; +@@ -3500,16 +3401,14 @@ int vc_sm_unlock(int handle, int flush, int no_vc_unlock) + } + EXPORT_SYMBOL_GPL(vc_sm_unlock); + +-/* Map a shared memory region for use by kernel. +-*/ ++/* Map a shared memory region for use by kernel. */ + int vc_sm_map(int handle, unsigned int sm_addr, VC_SM_LOCK_CACHE_MODE_T mode, + long unsigned int *data) + { + struct vmcs_sm_ioctl_lock_unlock ioparam; + int ret; + +- /* Validate we can work with this device. +- */ ++ /* Validate we can work with this device. */ + if (sm_state == NULL || handle == 0 || data == NULL || sm_addr == 0) { + pr_err("[%s]: invalid input\n", __func__); + return -EPERM; + +From 1425d69839100270659e2c8d634afba48d5bd57c Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 17:29:37 +0100 +Subject: [PATCH 186/199] vcsm: Fix indentation of switch/case statement. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 53 ++++++++++++++++++----------------- + 1 file changed, 27 insertions(+), 26 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index f93f18d3c24e43c9cf79e33f11cba9d1806f3124..9627a2b187130a68a15ea6fe46a72cf6cb5fe27e 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -2940,33 +2940,34 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + } + for (i=0; ires_cached) { +- unsigned long base = ioparam.s[i].addr & ~(PAGE_SIZE-1); +- unsigned long end = (ioparam.s[i].addr + ioparam.s[i].size + PAGE_SIZE-1) & ~(PAGE_SIZE-1); +- +- resource->res_stats[ioparam.s[i].cmd == 1 ? INVALID:FLUSH]++; +- +- /* L1/L2 cache flush */ +- down_read(¤t->mm->mmap_sem); +- vcsm_vma_cache_clean_page_range(base, end); +- up_read(¤t->mm->mmap_sem); +- } else if (resource == NULL) { +- ret = -EINVAL; +- goto out; +- } +- +- if (resource) +- vmcs_sm_release_resource(resource, 0); ++ default: ++ case 0: ++ break; /* NOOP */ ++ case 1: /* L1/L2 invalidate virtual range */ ++ case 2: /* L1/L2 clean physical range */ ++ case 3: /* L1/L2 clean+invalidate all */ ++ /* Locate resource from GUID. */ ++ resource = ++ vmcs_sm_acquire_resource(file_data, ioparam.s[i].handle); ++ ++ if ((resource != NULL) && resource->res_cached) { ++ unsigned long base = ioparam.s[i].addr & ~(PAGE_SIZE-1); ++ unsigned long end = (ioparam.s[i].addr + ioparam.s[i].size + PAGE_SIZE-1) & ~(PAGE_SIZE-1); ++ ++ resource->res_stats[ioparam.s[i].cmd == 1 ? INVALID:FLUSH]++; ++ ++ /* L1/L2 cache flush */ ++ down_read(¤t->mm->mmap_sem); ++ vcsm_vma_cache_clean_page_range(base, end); ++ up_read(¤t->mm->mmap_sem); ++ } else if (resource == NULL) { ++ ret = -EINVAL; ++ goto out; + } ++ ++ if (resource) ++ vmcs_sm_release_resource(resource, 0); ++ + break; + } + } + +From 0825e0228c00a66d6a553467ffbdab50f4fe6763 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 17:24:48 +0100 +Subject: [PATCH 187/199] vcsm: Fix spaces around operators. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 9627a2b187130a68a15ea6fe46a72cf6cb5fe27e..2b29c1f1ad611fe5ad04d0cf7c757370c850a5e9 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -2938,7 +2938,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + ret = -EFAULT; + goto out; + } +- for (i=0; ires_cached) { +- unsigned long base = ioparam.s[i].addr & ~(PAGE_SIZE-1); +- unsigned long end = (ioparam.s[i].addr + ioparam.s[i].size + PAGE_SIZE-1) & ~(PAGE_SIZE-1); ++ unsigned long base = ioparam.s[i].addr & ~(PAGE_SIZE - 1); ++ unsigned long end = (ioparam.s[i].addr + ioparam.s[i].size + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1); + +- resource->res_stats[ioparam.s[i].cmd == 1 ? INVALID:FLUSH]++; ++ resource->res_stats[ioparam.s[i].cmd == 1 ? INVALID : FLUSH]++; + + /* L1/L2 cache flush */ + down_read(¤t->mm->mmap_sem); +@@ -3001,7 +3001,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + goto out; + } + +- for (i=0; iblock_count; ++j) { + +From e156456b178b2b43d6db635da7953612720e4569 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 17:33:49 +0100 +Subject: [PATCH 188/199] vcsm: Fix use of S_IRUGO and use 0444 instead + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 2b29c1f1ad611fe5ad04d0cf7c757370c850a5e9..25dc958a35bac88e5ec6e0865d7cf35953d1b70b 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -1047,7 +1047,7 @@ static struct SM_PRIV_DATA_T *vc_sm_create_priv_data(pid_t id) + } else { + struct dentry *dir_entry; + +- dir_entry = debugfs_create_file(VC_SM_RESOURCES, S_IRUGO, ++ dir_entry = debugfs_create_file(VC_SM_RESOURCES, 0444, + file_data->dir_pid, file_data, + vc_sm_debug_fs_fops); + +@@ -1055,7 +1055,7 @@ static struct SM_PRIV_DATA_T *vc_sm_create_priv_data(pid_t id) + file_data->dir_res.priv_data = file_data; + file_data->dir_res.show = &vc_sm_alloc_show; + +- dir_entry = debugfs_create_file(VC_SM_STATS, S_IRUGO, ++ dir_entry = debugfs_create_file(VC_SM_STATS, 0444, + file_data->dir_pid, file_data, + vc_sm_debug_fs_fops); + +@@ -3194,12 +3194,12 @@ static void vc_sm_connected_init(void) + + sm_state->dir_state.show = &vc_sm_global_state_show; + sm_state->dir_state.dir_entry = debugfs_create_file(VC_SM_STATE, +- S_IRUGO, sm_state->dir_root, &sm_state->dir_state, ++ 0444, sm_state->dir_root, &sm_state->dir_state, + &vc_sm_debug_fs_fops); + + sm_state->dir_stats.show = &vc_sm_global_statistics_show; + sm_state->dir_stats.dir_entry = debugfs_create_file(VC_SM_STATS, +- S_IRUGO, sm_state->dir_root, &sm_state->dir_stats, ++ 0444, sm_state->dir_root, &sm_state->dir_stats, + &vc_sm_debug_fs_fops); + + /* Create the proc entry children. */ + +From 7bd1557a90736e09b4c8ee4e2c9ef5577da1b641 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 17:36:11 +0100 +Subject: [PATCH 189/199] vcsm: Correct "long unsigned int" to "unsigned long" + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vc_sm_knl.h | 4 ++-- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 16 ++++++++-------- + 2 files changed, 10 insertions(+), 10 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_knl.h b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +index 8252d13999a78609fcc7e1bbe83307e2b1c1f8f1..8538f618ffd33b2901d220f3fb755aae6001e6d7 100644 +--- a/drivers/char/broadcom/vc_sm/vc_sm_knl.h ++++ b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +@@ -36,7 +36,7 @@ int vc_sm_free(int handle); + + /* Lock a memory handle for use by kernel. */ + int vc_sm_lock(int handle, VC_SM_LOCK_CACHE_MODE_T mode, +- long unsigned int *data); ++ unsigned long *data); + + /* Unlock a memory handle in use by kernel. */ + int vc_sm_unlock(int handle, int flush, int no_vc_unlock); +@@ -46,7 +46,7 @@ int vc_sm_int_handle(int handle); + + /* Map a shared memory region for use by kernel. */ + int vc_sm_map(int handle, unsigned int sm_addr, VC_SM_LOCK_CACHE_MODE_T mode, +- long unsigned int *data); ++ unsigned long *data); + + /* Import a block of memory into the GPU space. */ + int vc_sm_import_dmabuf(struct dma_buf *dmabuf, int *handle); +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 25dc958a35bac88e5ec6e0865d7cf35953d1b70b..8244b365b690f8e2d00a8fae3754ce1f8bc23fbf 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -118,7 +118,7 @@ struct sm_mmap { + unsigned int res_vc_hdl; /* Resource handle (videocore). */ + unsigned int res_usr_hdl; /* Resource handle (user). */ + +- long unsigned int res_addr; /* Mapped virtual address. */ ++ unsigned long res_addr; /* Mapped virtual address. */ + struct vm_area_struct *vma; /* VM area for this mapping. */ + unsigned int ref_count; /* Reference count to this vma. */ + +@@ -1383,7 +1383,7 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + map->res_pid = current->tgid; + map->res_vc_hdl = resource->res_handle; + map->res_usr_hdl = resource->res_guid; +- map->res_addr = (long unsigned int)vma->vm_start; ++ map->res_addr = (unsigned long)vma->vm_start; + map->resource = resource; + map->vma = vma; + vmcs_sm_add_map(sm_state, resource, map); +@@ -1743,7 +1743,7 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + struct SM_RESOURCE_T *resource; + int ret = 0; + struct sm_mmap *map, *map_tmp; +- long unsigned int phys_addr; ++ unsigned long phys_addr; + + map = NULL; + +@@ -1859,7 +1859,7 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + phys_addr += mm_vc_mem_phys_addr; + if (resource->res_cached + == VMCS_SM_CACHE_HOST) { +- ioparam->addr = (long unsigned int) ++ ioparam->addr = (unsigned long) + /* TODO - make cached work */ + ioremap_nocache(phys_addr, + resource->res_size); +@@ -1868,7 +1868,7 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + __func__, ioparam->handle, + lock.res_handle, ioparam->addr); + } else { +- ioparam->addr = (long unsigned int) ++ ioparam->addr = (unsigned long) + ioremap_nocache(phys_addr, + resource->res_size); + +@@ -1995,7 +1995,7 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + if (flush && + (resource->res_cached == + VMCS_SM_CACHE_HOST)) { +- long unsigned int ++ unsigned long + phys_addr; + phys_addr = (uint32_t) + resource->res_base_mem & 0x3FFFFFFF; +@@ -3359,7 +3359,7 @@ EXPORT_SYMBOL_GPL(vc_sm_free); + + /* Lock a memory handle for use by kernel. */ + int vc_sm_lock(int handle, VC_SM_LOCK_CACHE_MODE_T mode, +- long unsigned int *data) ++ unsigned long *data) + { + struct vmcs_sm_ioctl_lock_unlock ioparam; + int ret; +@@ -3404,7 +3404,7 @@ EXPORT_SYMBOL_GPL(vc_sm_unlock); + + /* Map a shared memory region for use by kernel. */ + int vc_sm_map(int handle, unsigned int sm_addr, VC_SM_LOCK_CACHE_MODE_T mode, +- long unsigned int *data) ++ unsigned long *data) + { + struct vmcs_sm_ioctl_lock_unlock ioparam; + int ret; + +From 93cfd41b8dde48c4abb4d54a27e85ee44a5544ca Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 17:38:27 +0100 +Subject: [PATCH 190/199] vcsm: Fix "struct vm_operations_struct should + normally be const" + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 8244b365b690f8e2d00a8fae3754ce1f8bc23fbf..d8fe579a999d011d0af986a88398ac8b0947b7f3 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -1248,7 +1248,7 @@ static int vcsm_vma_fault(struct vm_fault *vmf) + } + } + +-static struct vm_operations_struct vcsm_vm_ops = { ++static const struct vm_operations_struct vcsm_vm_ops = { + .open = vcsm_vma_open, + .close = vcsm_vma_close, + .fault = vcsm_vma_fault, + +From bb96bdcc4eb7d03a61a32256471c52d137297bdb Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 17:45:34 +0100 +Subject: [PATCH 191/199] vcsm: Fix "void function return statements are not + generally useful" + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index d8fe579a999d011d0af986a88398ac8b0947b7f3..ecff69dce678b5125b81ed82b74b950720c472b0 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -984,8 +984,6 @@ static void vmcs_sm_host_walk_map_per_pid(int pid) + } + + mutex_unlock(&(sm_state->map_lock)); +- +- return; + } + + /* +@@ -1015,8 +1013,6 @@ static void vmcs_sm_host_walk_alloc(struct SM_PRIV_DATA_T *file_data) + } + + mutex_unlock(&(sm_state->map_lock)); +- +- return; + } + + /* Create support for private data tracking. */ + +From 4e47c87c05563c652cb1510b8184833aaf48e0df Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 17:47:32 +0100 +Subject: [PATCH 192/199] vcsm: Fix "Prefer kcalloc over kzalloc with multiply" + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index ecff69dce678b5125b81ed82b74b950720c472b0..ea82a374a5e2ad51cefcfc20ea4265c436258646 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -2984,7 +2984,9 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + ret = -EFAULT; + goto out; + } +- block = kzalloc(ioparam.op_count * sizeof(struct vmcs_sm_ioctl_clean_invalid_block), GFP_KERNEL); ++ block = kcalloc(ioparam.op_count, ++ sizeof(struct vmcs_sm_ioctl_clean_invalid_block), ++ GFP_KERNEL); + if (!block) { + ret = -EFAULT; + goto out; + +From 8d28d3df62ba49f039a998e2eca7bbc3235864ec Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 17:55:07 +0100 +Subject: [PATCH 193/199] vcsm: Remove VC_SM_LOCK_CACHE_MODE_T typedef. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vc_sm_knl.h | 11 +++++------ + drivers/char/broadcom/vc_sm/vmcs_sm.c | 6 +++--- + 2 files changed, 8 insertions(+), 9 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_knl.h b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +index 8538f618ffd33b2901d220f3fb755aae6001e6d7..f7f74750d8358779c61dfcd6fc841aa1789a2c5e 100644 +--- a/drivers/char/broadcom/vc_sm/vc_sm_knl.h ++++ b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +@@ -22,11 +22,10 @@ + #endif + + /* Type of memory to be locked (ie mapped) */ +-typedef enum { ++enum vc_sm_lock_cache_mode { + VC_SM_LOCK_CACHED, + VC_SM_LOCK_NON_CACHED, +- +-} VC_SM_LOCK_CACHE_MODE_T; ++}; + + /* Allocate a shared memory handle and block. */ + int vc_sm_alloc(struct vc_sm_alloc_t *alloc, int *handle); +@@ -35,7 +34,7 @@ int vc_sm_alloc(struct vc_sm_alloc_t *alloc, int *handle); + int vc_sm_free(int handle); + + /* Lock a memory handle for use by kernel. */ +-int vc_sm_lock(int handle, VC_SM_LOCK_CACHE_MODE_T mode, ++int vc_sm_lock(int handle, enum vc_sm_lock_cache_mode mode, + unsigned long *data); + + /* Unlock a memory handle in use by kernel. */ +@@ -45,8 +44,8 @@ int vc_sm_unlock(int handle, int flush, int no_vc_unlock); + int vc_sm_int_handle(int handle); + + /* Map a shared memory region for use by kernel. */ +-int vc_sm_map(int handle, unsigned int sm_addr, VC_SM_LOCK_CACHE_MODE_T mode, +- unsigned long *data); ++int vc_sm_map(int handle, unsigned int sm_addr, ++ enum vc_sm_lock_cache_mode mode, unsigned long *data); + + /* Import a block of memory into the GPU space. */ + int vc_sm_import_dmabuf(struct dma_buf *dmabuf, int *handle); +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index ea82a374a5e2ad51cefcfc20ea4265c436258646..b2452f3d0dfc207deed3703cb3ad43221af50b46 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -3356,7 +3356,7 @@ int vc_sm_free(int handle) + EXPORT_SYMBOL_GPL(vc_sm_free); + + /* Lock a memory handle for use by kernel. */ +-int vc_sm_lock(int handle, VC_SM_LOCK_CACHE_MODE_T mode, ++int vc_sm_lock(int handle, enum vc_sm_lock_cache_mode mode, + unsigned long *data) + { + struct vmcs_sm_ioctl_lock_unlock ioparam; +@@ -3401,8 +3401,8 @@ int vc_sm_unlock(int handle, int flush, int no_vc_unlock) + EXPORT_SYMBOL_GPL(vc_sm_unlock); + + /* Map a shared memory region for use by kernel. */ +-int vc_sm_map(int handle, unsigned int sm_addr, VC_SM_LOCK_CACHE_MODE_T mode, +- unsigned long *data) ++int vc_sm_map(int handle, unsigned int sm_addr, ++ enum vc_sm_lock_cache_mode mode, unsigned long *data) + { + struct vmcs_sm_ioctl_lock_unlock ioparam; + int ret; + +From 7aff1a4e86c2aa8af1e5b29162ba2a78e638bcf2 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Tue, 5 Sep 2017 10:12:21 +0100 +Subject: [PATCH 194/199] vcsm: Replace SM_RESOURCE_T with sm_resource_t + +Follow the Linux kernel coding style. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 66 +++++++++++++++++------------------ + 1 file changed, 33 insertions(+), 33 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index b2452f3d0dfc207deed3703cb3ad43221af50b46..59e1239b42ba139e29b22017a1b2a669bec6b884 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -112,7 +112,7 @@ struct SM_PDE_T { + struct sm_mmap { + struct list_head map_list; /* Linked list of maps. */ + +- struct SM_RESOURCE_T *resource; /* Pointer to the resource. */ ++ struct sm_resource_t *resource; /* Pointer to the resource. */ + + pid_t res_pid; /* PID owning that resource. */ + unsigned int res_vc_hdl; /* Resource handle (videocore). */ +@@ -127,7 +127,7 @@ struct sm_mmap { + }; + + /* Single resource allocation tracked for each opened device. */ +-struct SM_RESOURCE_T { ++struct sm_resource_t { + struct list_head resource_list; /* List of resources. */ + struct list_head global_resource_list; /* Global list of resources. */ + +@@ -140,7 +140,7 @@ struct SM_RESOURCE_T { + void *res_base_mem; /* Resource base memory address. */ + uint32_t res_size; /* Resource size allocated. */ + enum vmcs_sm_cache_e res_cached; /* Resource cache type. */ +- struct SM_RESOURCE_T *res_shared; /* Shared resource */ ++ struct sm_resource_t *res_shared; /* Shared resource */ + + enum SM_STATS_T res_stats[END_ALL]; /* Resource statistics. */ + +@@ -235,7 +235,7 @@ static inline unsigned int vcaddr_to_pfn(unsigned long vc_addr) + * Carries over to the state statistics the statistics once owned by a deceased + * resource. + */ +-static void vc_sm_resource_deceased(struct SM_RESOURCE_T *p_res, int terminated) ++static void vc_sm_resource_deceased(struct sm_resource_t *p_res, int terminated) + { + if (sm_state != NULL) { + if (p_res != NULL) { +@@ -460,7 +460,7 @@ static unsigned int vmcs_sm_usr_address_from_pid_and_usr_handle(unsigned int + + /* Adds a resource mapping to the global data list. */ + static void vmcs_sm_add_map(struct SM_STATE_T *state, +- struct SM_RESOURCE_T *resource, struct sm_mmap *map) ++ struct sm_resource_t *resource, struct sm_mmap *map) + { + mutex_lock(&(state->map_lock)); + +@@ -480,7 +480,7 @@ static void vmcs_sm_add_map(struct SM_STATE_T *state, + + /* Removes a resource mapping from the global data list. */ + static void vmcs_sm_remove_map(struct SM_STATE_T *state, +- struct SM_RESOURCE_T *resource, ++ struct sm_resource_t *resource, + struct sm_mmap *map) + { + mutex_lock(&(state->map_lock)); +@@ -506,7 +506,7 @@ static void vmcs_sm_remove_map(struct SM_STATE_T *state, + static int vc_sm_global_state_show(struct seq_file *s, void *v) + { + struct sm_mmap *map = NULL; +- struct SM_RESOURCE_T *resource = NULL; ++ struct sm_resource_t *resource = NULL; + int map_count = 0; + int resource_count = 0; + +@@ -634,7 +634,7 @@ static int vc_sm_statistics_show(struct seq_file *s, void *v) + { + int ix; + struct SM_PRIV_DATA_T *file_data; +- struct SM_RESOURCE_T *resource; ++ struct sm_resource_t *resource; + int res_count = 0; + struct SM_PDE_T *p_pde; + +@@ -691,7 +691,7 @@ static int vc_sm_statistics_show(struct seq_file *s, void *v) + static int vc_sm_alloc_show(struct seq_file *s, void *v) + { + struct SM_PRIV_DATA_T *file_data; +- struct SM_RESOURCE_T *resource; ++ struct sm_resource_t *resource; + int alloc_count = 0; + struct SM_PDE_T *p_pde; + +@@ -765,7 +765,7 @@ static const struct file_operations vc_sm_debug_fs_fops = { + * data. + */ + static void vmcs_sm_add_resource(struct SM_PRIV_DATA_T *privdata, +- struct SM_RESOURCE_T *resource) ++ struct sm_resource_t *resource) + { + mutex_lock(&(sm_state->map_lock)); + list_add(&resource->resource_list, &privdata->resource_list); +@@ -781,11 +781,11 @@ static void vmcs_sm_add_resource(struct SM_PRIV_DATA_T *privdata, + * Locates a resource and acquire a reference on it. + * The resource won't be deleted while there is a reference on it. + */ +-static struct SM_RESOURCE_T *vmcs_sm_acquire_resource(struct SM_PRIV_DATA_T ++static struct sm_resource_t *vmcs_sm_acquire_resource(struct SM_PRIV_DATA_T + *private, + unsigned int res_guid) + { +- struct SM_RESOURCE_T *resource, *ret = NULL; ++ struct sm_resource_t *resource, *ret = NULL; + + mutex_lock(&(sm_state->map_lock)); + +@@ -811,10 +811,10 @@ static struct SM_RESOURCE_T *vmcs_sm_acquire_resource(struct SM_PRIV_DATA_T + * Locates a resource and acquire a reference on it. + * The resource won't be deleted while there is a reference on it. + */ +-static struct SM_RESOURCE_T *vmcs_sm_acquire_first_resource( ++static struct sm_resource_t *vmcs_sm_acquire_first_resource( + struct SM_PRIV_DATA_T *private) + { +- struct SM_RESOURCE_T *resource, *ret = NULL; ++ struct sm_resource_t *resource, *ret = NULL; + + mutex_lock(&(sm_state->map_lock)); + +@@ -837,10 +837,10 @@ static struct SM_RESOURCE_T *vmcs_sm_acquire_first_resource( + * Locates a resource and acquire a reference on it. + * The resource won't be deleted while there is a reference on it. + */ +-static struct SM_RESOURCE_T *vmcs_sm_acquire_global_resource(unsigned int ++static struct sm_resource_t *vmcs_sm_acquire_global_resource(unsigned int + res_guid) + { +- struct SM_RESOURCE_T *resource, *ret = NULL; ++ struct sm_resource_t *resource, *ret = NULL; + + mutex_lock(&(sm_state->map_lock)); + +@@ -867,11 +867,11 @@ static struct SM_RESOURCE_T *vmcs_sm_acquire_global_resource(unsigned int + * Release a previously acquired resource. + * The resource will be deleted when its refcount reaches 0. + */ +-static void vmcs_sm_release_resource(struct SM_RESOURCE_T *resource, int force) ++static void vmcs_sm_release_resource(struct sm_resource_t *resource, int force) + { + struct SM_PRIV_DATA_T *private = resource->private; + struct sm_mmap *map, *map_tmp; +- struct SM_RESOURCE_T *res_tmp; ++ struct sm_resource_t *res_tmp; + int ret; + + mutex_lock(&(sm_state->map_lock)); +@@ -992,7 +992,7 @@ static void vmcs_sm_host_walk_map_per_pid(int pid) + */ + static void vmcs_sm_host_walk_alloc(struct SM_PRIV_DATA_T *file_data) + { +- struct SM_RESOURCE_T *resource = NULL; ++ struct sm_resource_t *resource = NULL; + + /* Make sure the device was started properly. */ + if ((sm_state == NULL) || (file_data == NULL)) { +@@ -1101,7 +1101,7 @@ static int vc_sm_release(struct inode *inode, struct file *file) + { + struct SM_PRIV_DATA_T *file_data = + (struct SM_PRIV_DATA_T *)file->private_data; +- struct SM_RESOURCE_T *resource; ++ struct sm_resource_t *resource; + int ret = 0; + + /* Make sure the device was started properly. */ +@@ -1170,7 +1170,7 @@ static void vcsm_vma_close(struct vm_area_struct *vma) + static int vcsm_vma_fault(struct vm_fault *vmf) + { + struct sm_mmap *map = (struct sm_mmap *)vmf->vma->vm_private_data; +- struct SM_RESOURCE_T *resource = map->resource; ++ struct sm_resource_t *resource = map->resource; + pgoff_t page_offset; + unsigned long pfn; + int ret = 0; +@@ -1313,7 +1313,7 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + int ret = 0; + struct SM_PRIV_DATA_T *file_data = + (struct SM_PRIV_DATA_T *)file->private_data; +- struct SM_RESOURCE_T *resource = NULL; ++ struct sm_resource_t *resource = NULL; + struct sm_mmap *map = NULL; + + /* Make sure the device was started properly. */ +@@ -1449,7 +1449,7 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + { + int ret = 0; + int status; +- struct SM_RESOURCE_T *resource; ++ struct sm_resource_t *resource; + struct vc_sm_alloc_t alloc = { 0 }; + struct vc_sm_alloc_result_t result = { 0 }; + enum vmcs_sm_cache_e cached = ioparam->cached; +@@ -1558,7 +1558,7 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + int vc_sm_ioctl_alloc_share(struct SM_PRIV_DATA_T *private, + struct vmcs_sm_ioctl_alloc_share *ioparam) + { +- struct SM_RESOURCE_T *resource, *shared_resource; ++ struct sm_resource_t *resource, *shared_resource; + int ret = 0; + + pr_debug("[%s]: attempt to share resource %u\n", __func__, +@@ -1620,7 +1620,7 @@ int vc_sm_ioctl_alloc_share(struct SM_PRIV_DATA_T *private, + static int vc_sm_ioctl_free(struct SM_PRIV_DATA_T *private, + struct vmcs_sm_ioctl_free *ioparam) + { +- struct SM_RESOURCE_T *resource = ++ struct sm_resource_t *resource = + vmcs_sm_acquire_resource(private, ioparam->handle); + + if (resource == NULL) { +@@ -1649,7 +1649,7 @@ static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + int ret = 0; + int status; + struct vc_sm_resize_t resize; +- struct SM_RESOURCE_T *resource; ++ struct sm_resource_t *resource; + + /* Locate resource from GUID. */ + resource = vmcs_sm_acquire_resource(private, ioparam->handle); +@@ -1736,7 +1736,7 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + int status; + struct vc_sm_lock_unlock_t lock; + struct vc_sm_lock_result_t result; +- struct SM_RESOURCE_T *resource; ++ struct sm_resource_t *resource; + int ret = 0; + struct sm_mmap *map, *map_tmp; + unsigned long phys_addr; +@@ -1901,7 +1901,7 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + int status; + struct vc_sm_lock_unlock_t unlock; + struct sm_mmap *map, *map_tmp; +- struct SM_RESOURCE_T *resource; ++ struct sm_resource_t *resource; + int ret = 0; + + map = NULL; +@@ -2077,7 +2077,7 @@ int vc_sm_ioctl_import_dmabuf(struct SM_PRIV_DATA_T *private, + { + int ret = 0; + int status; +- struct SM_RESOURCE_T *resource = NULL; ++ struct sm_resource_t *resource = NULL; + struct vc_sm_import import = { 0 }; + struct vc_sm_import_result result = { 0 }; + struct dma_buf *dma_buf; +@@ -2206,7 +2206,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + unsigned int cmdnr = _IOC_NR(cmd); + struct SM_PRIV_DATA_T *file_data = + (struct SM_PRIV_DATA_T *)file->private_data; +- struct SM_RESOURCE_T *resource = NULL; ++ struct sm_resource_t *resource = NULL; + + /* Validate we can work with this device. */ + if ((sm_state == NULL) || (file_data == NULL)) { +@@ -3283,7 +3283,7 @@ int vc_sm_alloc(struct vc_sm_alloc_t *alloc, int *handle) + { + struct vmcs_sm_ioctl_alloc ioparam = { 0 }; + int ret; +- struct SM_RESOURCE_T *resource; ++ struct sm_resource_t *resource; + + /* Validate we can work with this device. */ + if (sm_state == NULL || alloc == NULL || handle == NULL) { +@@ -3320,7 +3320,7 @@ EXPORT_SYMBOL_GPL(vc_sm_alloc); + /* Get an internal resource handle mapped from the external one. */ + int vc_sm_int_handle(int handle) + { +- struct SM_RESOURCE_T *resource; ++ struct sm_resource_t *resource; + int ret = 0; + + /* Validate we can work with this device. */ +@@ -3433,7 +3433,7 @@ int vc_sm_import_dmabuf(struct dma_buf *dmabuf, int *handle) + { + struct vmcs_sm_ioctl_import_dmabuf ioparam = { 0 }; + int ret; +- struct SM_RESOURCE_T *resource; ++ struct sm_resource_t *resource; + + /* Validate we can work with this device. */ + if (!sm_state || !dmabuf || !handle) { + +From 600dd0a90e3e54e9635d60750dfe69621c645288 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Tue, 5 Sep 2017 10:15:25 +0100 +Subject: [PATCH 195/199] vcsm: Replace SM_STATS_T with sm_stats_t + +Follows the kernel coding style + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 59e1239b42ba139e29b22017a1b2a669bec6b884..08567b018a63cb783d1e66056f64b2d888f10315 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -62,7 +62,7 @@ + #define VC_SM_WRITE_BUF_SIZE 128 + + /* Statistics tracked per resource and globally. */ +-enum SM_STATS_T { ++enum sm_stats_t { + /* Attempt. */ + ALLOC, + FREE, +@@ -142,7 +142,7 @@ struct sm_resource_t { + enum vmcs_sm_cache_e res_cached; /* Resource cache type. */ + struct sm_resource_t *res_shared; /* Shared resource */ + +- enum SM_STATS_T res_stats[END_ALL]; /* Resource statistics. */ ++ enum sm_stats_t res_stats[END_ALL]; /* Resource statistics. */ + + uint8_t map_count; /* Counter of mappings for this resource. */ + struct list_head map_list; /* Maps associated with a resource. */ +@@ -187,8 +187,8 @@ struct SM_STATE_T { + struct list_head map_list; /* List of maps. */ + struct list_head resource_list; /* List of resources. */ + +- enum SM_STATS_T deceased[END_ALL]; /* Natural termination stats. */ +- enum SM_STATS_T terminated[END_ALL]; /* Forced termination stats. */ ++ enum sm_stats_t deceased[END_ALL]; /* Natural termination stats. */ ++ enum sm_stats_t terminated[END_ALL]; /* Forced termination stats. */ + uint32_t res_deceased_cnt; /* Natural termination counter. */ + uint32_t res_terminated_cnt; /* Forced termination counter. */ + + +From e81fef4ddc170835dc35a05d8015569bd3f84250 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Tue, 5 Sep 2017 10:16:07 +0100 +Subject: [PATCH 196/199] vcsm: Replace SM_STATE_T with sm_state_t + +Follow the Linux kernel coding style + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 08567b018a63cb783d1e66056f64b2d888f10315..39c64c38ce7638592eeb98583fdb2ddee981a9ec 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -174,7 +174,7 @@ struct SM_PRIV_DATA_T { + }; + + /* Global state information. */ +-struct SM_STATE_T { ++struct sm_state_t { + struct platform_device *pdev; + struct sm_instance *sm_handle; /* Handle for videocore service. */ + struct dentry *dir_root; /* Debug fs entries root. */ +@@ -206,7 +206,7 @@ struct SM_STATE_T { + + /* ---- Private Variables ----------------------------------------------- */ + +-static struct SM_STATE_T *sm_state; ++static struct sm_state_t *sm_state; + static int sm_inited; + + #if 0 +@@ -459,7 +459,7 @@ static unsigned int vmcs_sm_usr_address_from_pid_and_usr_handle(unsigned int + } + + /* Adds a resource mapping to the global data list. */ +-static void vmcs_sm_add_map(struct SM_STATE_T *state, ++static void vmcs_sm_add_map(struct sm_state_t *state, + struct sm_resource_t *resource, struct sm_mmap *map) + { + mutex_lock(&(state->map_lock)); +@@ -479,7 +479,7 @@ static void vmcs_sm_add_map(struct SM_STATE_T *state, + } + + /* Removes a resource mapping from the global data list. */ +-static void vmcs_sm_remove_map(struct SM_STATE_T *state, ++static void vmcs_sm_remove_map(struct sm_state_t *state, + struct sm_resource_t *resource, + struct sm_mmap *map) + { + +From 34628edd77ed91d466cf9e790158d13a9f37224d Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Tue, 5 Sep 2017 10:17:18 +0100 +Subject: [PATCH 197/199] vcsm: Replace SM_PRIV_DATA_T with sm_priv_data_t + +Follows the Linux kernel coding style + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 54 +++++++++++++++++------------------ + 1 file changed, 27 insertions(+), 27 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 39c64c38ce7638592eeb98583fdb2ddee981a9ec..9f1ea8269385b9c2cf4f7ab0ca6ba99b3ca12b6c 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -153,12 +153,12 @@ struct sm_resource_t { + struct sg_table *sgt; + dma_addr_t dma_addr; + +- struct SM_PRIV_DATA_T *private; ++ struct sm_priv_data_t *private; + bool map; /* whether to map pages up front */ + }; + + /* Private file data associated with each opened device. */ +-struct SM_PRIV_DATA_T { ++struct sm_priv_data_t { + struct list_head resource_list; /* List of resources. */ + + pid_t pid; /* PID of creator. */ +@@ -197,7 +197,7 @@ struct sm_state_t { + struct class *sm_class; /* Class. */ + struct device *sm_dev; /* Device. */ + +- struct SM_PRIV_DATA_T *data_knl; /* Kernel internal data tracking. */ ++ struct sm_priv_data_t *data_knl; /* Kernel internal data tracking. */ + + struct mutex lock; /* Global lock. */ + uint32_t guid; /* GUID (next) tracker. */ +@@ -633,13 +633,13 @@ static int vc_sm_global_statistics_show(struct seq_file *s, void *v) + static int vc_sm_statistics_show(struct seq_file *s, void *v) + { + int ix; +- struct SM_PRIV_DATA_T *file_data; ++ struct sm_priv_data_t *file_data; + struct sm_resource_t *resource; + int res_count = 0; + struct SM_PDE_T *p_pde; + + p_pde = (struct SM_PDE_T *)(s->private); +- file_data = (struct SM_PRIV_DATA_T *)(p_pde->priv_data); ++ file_data = (struct sm_priv_data_t *)(p_pde->priv_data); + + if (file_data == NULL) + return 0; +@@ -690,13 +690,13 @@ static int vc_sm_statistics_show(struct seq_file *s, void *v) + /* Read callback for the allocation proc entry. */ + static int vc_sm_alloc_show(struct seq_file *s, void *v) + { +- struct SM_PRIV_DATA_T *file_data; ++ struct sm_priv_data_t *file_data; + struct sm_resource_t *resource; + int alloc_count = 0; + struct SM_PDE_T *p_pde; + + p_pde = (struct SM_PDE_T *)(s->private); +- file_data = (struct SM_PRIV_DATA_T *)(p_pde->priv_data); ++ file_data = (struct sm_priv_data_t *)(p_pde->priv_data); + + if (!file_data) + return 0; +@@ -764,7 +764,7 @@ static const struct file_operations vc_sm_debug_fs_fops = { + * Adds a resource to the private data list which tracks all the allocated + * data. + */ +-static void vmcs_sm_add_resource(struct SM_PRIV_DATA_T *privdata, ++static void vmcs_sm_add_resource(struct sm_priv_data_t *privdata, + struct sm_resource_t *resource) + { + mutex_lock(&(sm_state->map_lock)); +@@ -781,7 +781,7 @@ static void vmcs_sm_add_resource(struct SM_PRIV_DATA_T *privdata, + * Locates a resource and acquire a reference on it. + * The resource won't be deleted while there is a reference on it. + */ +-static struct sm_resource_t *vmcs_sm_acquire_resource(struct SM_PRIV_DATA_T ++static struct sm_resource_t *vmcs_sm_acquire_resource(struct sm_priv_data_t + *private, + unsigned int res_guid) + { +@@ -812,7 +812,7 @@ static struct sm_resource_t *vmcs_sm_acquire_resource(struct SM_PRIV_DATA_T + * The resource won't be deleted while there is a reference on it. + */ + static struct sm_resource_t *vmcs_sm_acquire_first_resource( +- struct SM_PRIV_DATA_T *private) ++ struct sm_priv_data_t *private) + { + struct sm_resource_t *resource, *ret = NULL; + +@@ -869,7 +869,7 @@ static struct sm_resource_t *vmcs_sm_acquire_global_resource(unsigned int + */ + static void vmcs_sm_release_resource(struct sm_resource_t *resource, int force) + { +- struct SM_PRIV_DATA_T *private = resource->private; ++ struct sm_priv_data_t *private = resource->private; + struct sm_mmap *map, *map_tmp; + struct sm_resource_t *res_tmp; + int ret; +@@ -990,7 +990,7 @@ static void vmcs_sm_host_walk_map_per_pid(int pid) + * Dump the allocation table from host side point of view. This only dumps the + * data allocated for this process/device referenced by the file_data. + */ +-static void vmcs_sm_host_walk_alloc(struct SM_PRIV_DATA_T *file_data) ++static void vmcs_sm_host_walk_alloc(struct sm_priv_data_t *file_data) + { + struct sm_resource_t *resource = NULL; + +@@ -1016,10 +1016,10 @@ static void vmcs_sm_host_walk_alloc(struct SM_PRIV_DATA_T *file_data) + } + + /* Create support for private data tracking. */ +-static struct SM_PRIV_DATA_T *vc_sm_create_priv_data(pid_t id) ++static struct sm_priv_data_t *vc_sm_create_priv_data(pid_t id) + { + char alloc_name[32]; +- struct SM_PRIV_DATA_T *file_data = NULL; ++ struct sm_priv_data_t *file_data = NULL; + + /* Allocate private structure. */ + file_data = kzalloc(sizeof(*file_data), GFP_KERNEL); +@@ -1099,8 +1099,8 @@ static int vc_sm_open(struct inode *inode, struct file *file) + */ + static int vc_sm_release(struct inode *inode, struct file *file) + { +- struct SM_PRIV_DATA_T *file_data = +- (struct SM_PRIV_DATA_T *)file->private_data; ++ struct sm_priv_data_t *file_data = ++ (struct sm_priv_data_t *)file->private_data; + struct sm_resource_t *resource; + int ret = 0; + +@@ -1311,8 +1311,8 @@ static void vcsm_vma_cache_clean_page_range(unsigned long addr, + static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + { + int ret = 0; +- struct SM_PRIV_DATA_T *file_data = +- (struct SM_PRIV_DATA_T *)file->private_data; ++ struct sm_priv_data_t *file_data = ++ (struct sm_priv_data_t *)file->private_data; + struct sm_resource_t *resource = NULL; + struct sm_mmap *map = NULL; + +@@ -1444,7 +1444,7 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + } + + /* Allocate a shared memory handle and block. */ +-int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, ++int vc_sm_ioctl_alloc(struct sm_priv_data_t *private, + struct vmcs_sm_ioctl_alloc *ioparam) + { + int ret = 0; +@@ -1555,7 +1555,7 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + } + + /* Share an allocate memory handle and block.*/ +-int vc_sm_ioctl_alloc_share(struct SM_PRIV_DATA_T *private, ++int vc_sm_ioctl_alloc_share(struct sm_priv_data_t *private, + struct vmcs_sm_ioctl_alloc_share *ioparam) + { + struct sm_resource_t *resource, *shared_resource; +@@ -1617,7 +1617,7 @@ int vc_sm_ioctl_alloc_share(struct SM_PRIV_DATA_T *private, + } + + /* Free a previously allocated shared memory handle and block.*/ +-static int vc_sm_ioctl_free(struct SM_PRIV_DATA_T *private, ++static int vc_sm_ioctl_free(struct sm_priv_data_t *private, + struct vmcs_sm_ioctl_free *ioparam) + { + struct sm_resource_t *resource = +@@ -1643,7 +1643,7 @@ static int vc_sm_ioctl_free(struct SM_PRIV_DATA_T *private, + } + + /* Resize a previously allocated shared memory handle and block. */ +-static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, ++static int vc_sm_ioctl_resize(struct sm_priv_data_t *private, + struct vmcs_sm_ioctl_resize *ioparam) + { + int ret = 0; +@@ -1728,7 +1728,7 @@ static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + } + + /* Lock a previously allocated shared memory handle and block. */ +-static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, ++static int vc_sm_ioctl_lock(struct sm_priv_data_t *private, + struct vmcs_sm_ioctl_lock_unlock *ioparam, + int change_cache, enum vmcs_sm_cache_e cache_type, + unsigned int vc_addr) +@@ -1894,7 +1894,7 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + } + + /* Unlock a previously allocated shared memory handle and block.*/ +-static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, ++static int vc_sm_ioctl_unlock(struct sm_priv_data_t *private, + struct vmcs_sm_ioctl_lock_unlock *ioparam, + int flush, int wait_reply, int no_vc_unlock) + { +@@ -2071,7 +2071,7 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + } + + /* Import a contiguous block of memory to be shared with VC. */ +-int vc_sm_ioctl_import_dmabuf(struct SM_PRIV_DATA_T *private, ++int vc_sm_ioctl_import_dmabuf(struct sm_priv_data_t *private, + struct vmcs_sm_ioctl_import_dmabuf *ioparam, + struct dma_buf *src_dma_buf) + { +@@ -2204,8 +2204,8 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + { + int ret = 0; + unsigned int cmdnr = _IOC_NR(cmd); +- struct SM_PRIV_DATA_T *file_data = +- (struct SM_PRIV_DATA_T *)file->private_data; ++ struct sm_priv_data_t *file_data = ++ (struct sm_priv_data_t *)file->private_data; + struct sm_resource_t *resource = NULL; + + /* Validate we can work with this device. */ + +From 690f12efc4e225040a0512c60ae14025883e18df Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Tue, 5 Sep 2017 10:18:33 +0100 +Subject: [PATCH 198/199] vcsm: Replace SM_PDE_T with sm_pde_t + +Follows the Linux kernel coding style + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 22 +++++++++++----------- + 1 file changed, 11 insertions(+), 11 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 9f1ea8269385b9c2cf4f7ab0ca6ba99b3ca12b6c..160e109d780a7badda9e5474a9d38fa9794d0298 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -101,7 +101,7 @@ static const char *const sm_stats_human_read[] = { + }; + + typedef int (*VC_SM_SHOW) (struct seq_file *s, void *v); +-struct SM_PDE_T { ++struct sm_pde_t { + VC_SM_SHOW show; /* Debug fs function hookup. */ + struct dentry *dir_entry; /* Debug fs directory entry. */ + void *priv_data; /* Private data */ +@@ -164,8 +164,8 @@ struct sm_priv_data_t { + pid_t pid; /* PID of creator. */ + + struct dentry *dir_pid; /* Debug fs entries root. */ +- struct SM_PDE_T dir_stats; /* Debug fs entries statistics sub-tree. */ +- struct SM_PDE_T dir_res; /* Debug fs resource sub-tree. */ ++ struct sm_pde_t dir_stats; /* Debug fs entries statistics sub-tree. */ ++ struct sm_pde_t dir_res; /* Debug fs resource sub-tree. */ + + int restart_sys; /* Tracks restart on interrupt. */ + enum vc_sm_msg_type int_action; /* Interrupted action. */ +@@ -179,8 +179,8 @@ struct sm_state_t { + struct sm_instance *sm_handle; /* Handle for videocore service. */ + struct dentry *dir_root; /* Debug fs entries root. */ + struct dentry *dir_alloc; /* Debug fs entries allocations. */ +- struct SM_PDE_T dir_stats; /* Debug fs entries statistics sub-tree. */ +- struct SM_PDE_T dir_state; /* Debug fs entries state sub-tree. */ ++ struct sm_pde_t dir_stats; /* Debug fs entries statistics sub-tree. */ ++ struct sm_pde_t dir_state; /* Debug fs entries state sub-tree. */ + struct dentry *debug; /* Debug fs entries debug. */ + + struct mutex map_lock; /* Global map lock. */ +@@ -636,9 +636,9 @@ static int vc_sm_statistics_show(struct seq_file *s, void *v) + struct sm_priv_data_t *file_data; + struct sm_resource_t *resource; + int res_count = 0; +- struct SM_PDE_T *p_pde; ++ struct sm_pde_t *p_pde; + +- p_pde = (struct SM_PDE_T *)(s->private); ++ p_pde = (struct sm_pde_t *)(s->private); + file_data = (struct sm_priv_data_t *)(p_pde->priv_data); + + if (file_data == NULL) +@@ -693,9 +693,9 @@ static int vc_sm_alloc_show(struct seq_file *s, void *v) + struct sm_priv_data_t *file_data; + struct sm_resource_t *resource; + int alloc_count = 0; +- struct SM_PDE_T *p_pde; ++ struct sm_pde_t *p_pde; + +- p_pde = (struct SM_PDE_T *)(s->private); ++ p_pde = (struct sm_pde_t *)(s->private); + file_data = (struct sm_priv_data_t *)(p_pde->priv_data); + + if (!file_data) +@@ -738,9 +738,9 @@ static int vc_sm_alloc_show(struct seq_file *s, void *v) + + static int vc_sm_seq_file_show(struct seq_file *s, void *v) + { +- struct SM_PDE_T *sm_pde; ++ struct sm_pde_t *sm_pde; + +- sm_pde = (struct SM_PDE_T *)(s->private); ++ sm_pde = (struct sm_pde_t *)(s->private); + + if (sm_pde && sm_pde->show) + sm_pde->show(s, v); + +From 30db193f6e05590ca820269fd68d4ac19016ebbc Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 5 Sep 2017 16:24:03 +0100 +Subject: [PATCH 199/199] vcsm: Handle the clean+invalidate case directly + +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 66 +++++++++++++++++++++-------------- + 1 file changed, 39 insertions(+), 27 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 160e109d780a7badda9e5474a9d38fa9794d0298..034ae2f27f870621af9f49453501f1cde051f32a 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -218,6 +218,32 @@ static const char *const sm_cache_map_vector[] = { + }; + #endif + ++typedef void cache_flush_op_fn(const void *, const void *); ++ ++#if defined(CONFIG_CPU_CACHE_V7) ++extern cache_flush_op_fn v7_dma_inv_range; ++extern cache_flush_op_fn v7_dma_clean_range; ++static cache_flush_op_fn * const flushops[4] = ++{ ++ 0, ++ v7_dma_inv_range, ++ v7_dma_clean_range, ++ v7_dma_flush_range, ++}; ++#elif defined(CONFIG_CPU_CACHE_V6) ++extern cache_flush_op_fn v6_dma_inv_range; ++extern cache_flush_op_fn v6_dma_clean_range; ++static cache_flush_op_fn * const flushops[4] = ++{ ++ 0, ++ v6_dma_inv_range, ++ v6_dma_clean_range, ++ v6_dma_flush_range, ++}; ++#else ++#error Unknown cache config ++#endif ++ + /* ---- Private Function Prototypes -------------------------------------- */ + + /* ---- Private Functions ------------------------------------------------ */ +@@ -2984,7 +3010,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + ret = -EFAULT; + goto out; + } +- block = kcalloc(ioparam.op_count, ++ block = kmalloc(ioparam.op_count * + sizeof(struct vmcs_sm_ioctl_clean_invalid_block), + GFP_KERNEL); + if (!block) { +@@ -3000,35 +3026,21 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + } + + for (i = 0; i < ioparam.op_count; i++) { +- struct vmcs_sm_ioctl_clean_invalid_block *op = block + i; ++ const struct vmcs_sm_ioctl_clean_invalid_block * const op = block + i; ++ cache_flush_op_fn * const op_fn = flushops[op->invalidate_mode & 3]; + +- for (j = 0; j < op->block_count; ++j) { ++ if ((op->invalidate_mode & ~3) != 0) { ++ ret = -EINVAL; ++ break; ++ } + ++ if (op_fn == 0) ++ continue; + +- extern void v6_dma_inv_range(void *start, void *end); +- extern void v6_dma_clean_range(void *start, void *end); +- unsigned long base = (unsigned long)op->start_address + j * op->inter_block_stride; +- unsigned long end = base + op->block_size; +- /* L1/L2 cache clean */ +- if (op->invalidate_mode & 2) { +-#if defined(CONFIG_CPU_CACHE_V7) +- extern void v7_dma_clean_range(void *start, void *end); +- v7_dma_clean_range((void *)base, (void *)end); +-#elif defined(CONFIG_CPU_CACHE_V6) +- extern void v6_dma_clean_range(void *start, void *end); +- v6_dma_clean_range((void *)base, (void *)end); +-#endif +- /* L1/L2 cache invalidate */ +- } +- if (op->invalidate_mode & 1) { +-#if defined(CONFIG_CPU_CACHE_V7) +- extern void v7_dma_inv_range(void *start, void *end); +- v7_dma_inv_range((void *)base, (void *)end); +-#elif defined(CONFIG_CPU_CACHE_V6) +- extern void v6_dma_inv_range(void *start, void *end); +- v6_dma_inv_range((void *)base, (void *)end); +-#endif +- } ++ for (j = 0; j < op->block_count; ++j) { ++ const char * const base = (const char *)op->start_address + j * op->inter_block_stride; ++ const char * const end = base + op->block_size; ++ op_fn(base, end); + } + } + kfree(block);