pda_power: only register available psu

pda_power: only register available psu

Currently pda-power adds both ac and usb power supply units.
This patch fixes it so that psu are added only if they are enabled.

Signed-off-by: Dmitry Baryshkov <b6edad08270b2e4ffbcb0879e25a0e29a48c5275@gmail.com>
Signed-off-by: Anton Vorontsov <3d4412bea4b4b5bb6ad28995d4e9c3e958df972b@mail.ru>

--- drivers/power/pda_power.c
+++ drivers/power/pda_power.c
@@ -168,66 +168,74 @@
 		pda_power_supplies[1].num_supplicants = pdata->num_supplicants;
 	}

-	ret = power_supply_register(&pdev->dev, &pda_power_supplies[0]);
-	if (ret) {
-		dev_err(dev, "failed to register %s power supply\n",
-			pda_power_supplies[0].name);
-		goto supply0_failed;
-	}
-
-	ret = power_supply_register(&pdev->dev, &pda_power_supplies[1]);
-	if (ret) {
-		dev_err(dev, "failed to register %s power supply\n",
-			pda_power_supplies[1].name);
-		goto supply1_failed;
-	}
-
-	if (ac_irq) {
-		ret = request_irq(ac_irq->start, power_changed_isr,
-				  get_irq_flags(ac_irq), ac_irq->name,
-				  &pda_power_supplies[0]);
+	if (pdata->is_ac_online) {
+		ret = power_supply_register(&pdev->dev, &pda_power_supplies[0]);
 		if (ret) {
-			dev_err(dev, "request ac irq failed\n");
-			goto ac_irq_failed;
-		}
-	}
-
-	if (usb_irq) {
-		ret = request_irq(usb_irq->start, power_changed_isr,
-				  get_irq_flags(usb_irq), usb_irq->name,
-				  &pda_power_supplies[1]);
+			dev_err(dev, "failed to register %s power supply\n",
+				pda_power_supplies[0].name);
+			goto ac_supply_failed;
+		}
+
+		if (ac_irq) {
+			ret = request_irq(ac_irq->start, power_changed_isr,
+					  get_irq_flags(ac_irq), ac_irq->name,
+					  &pda_power_supplies[0]);
+			if (ret) {
+				dev_err(dev, "request ac irq failed\n");
+				goto ac_irq_failed;
+			}
+		}
+	}
+
+	if (pdata->is_usb_online) {
+		ret = power_supply_register(&pdev->dev, &pda_power_supplies[1]);
 		if (ret) {
-			dev_err(dev, "request usb irq failed\n");
-			goto usb_irq_failed;
-		}
-	}
-
-	goto success;
+			dev_err(dev, "failed to register %s power supply\n",
+				pda_power_supplies[1].name);
+			goto usb_supply_failed;
+		}
+
+		if (usb_irq) {
+			ret = request_irq(usb_irq->start, power_changed_isr,
+					  get_irq_flags(usb_irq),
+					  usb_irq->name,
+					  &pda_power_supplies[1]);
+			if (ret) {
+				dev_err(dev, "request usb irq failed\n");
+				goto usb_irq_failed;
+			}
+		}
+	}
+
+	return 0;

 usb_irq_failed:
-	if (ac_irq)
+	if (pdata->is_usb_online)
+		power_supply_unregister(&pda_power_supplies[1]);
+usb_supply_failed:
+	if (pdata->is_ac_online && ac_irq)
 		free_irq(ac_irq->start, &pda_power_supplies[0]);
 ac_irq_failed:
-	power_supply_unregister(&pda_power_supplies[1]);
-supply1_failed:
-	power_supply_unregister(&pda_power_supplies[0]);
-supply0_failed:
+	if (pdata->is_ac_online)
+		power_supply_unregister(&pda_power_supplies[0]);
+ac_supply_failed:
 noirqs:
 wrongid:
-success:
 	return ret;
 }

 static int pda_power_remove(struct platform_device *pdev)
 {
-	if (usb_irq)
+	if (pdata->is_usb_online && usb_irq)
 		free_irq(usb_irq->start, &pda_power_supplies[1]);
-	if (ac_irq)
+	if (pdata->is_ac_online && ac_irq)
 		free_irq(ac_irq->start, &pda_power_supplies[0]);
 	del_timer_sync(&charger_timer);
 	del_timer_sync(&supply_timer);
-	power_supply_unregister(&pda_power_supplies[1]);
-	power_supply_unregister(&pda_power_supplies[0]);
+	if (pdata->is_usb_online)
+		power_supply_unregister(&pda_power_supplies[1]);
+	if (pdata->is_ac_online)
+		power_supply_unregister(&pda_power_supplies[0]);
 	return 0;
 }


rtc: rtc-davinci: use devm_ioremap_resource()

Use devm_ioremap_resource() in order to make the code simpler, and
remove redundant return value check of platform_get_resource() because
the value is checked by devm_ioremap_resource().

Signed-off-by: Jingoo Han <fc379137a64feb86ce38ec5811a14280acc1ccfc@samsung.com>
Cc: Kevin Hilman <f9849b02abe18c1ece6bd40346458ed53f49d31b@linaro.org>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>


rtc: rtc-s35390a: use devm_*() functions

Use devm_*() functions to make cleanup paths simpler.

Signed-off-by: Jingoo Han <fc379137a64feb86ce38ec5811a14280acc1ccfc@samsung.com>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- drivers/rtc/rtc-s35390a.c
+++ drivers/rtc/rtc-s35390a.c
@@ -338,7 +338,8 @@
 		goto exit;
 	}

-	s35390a = kzalloc(sizeof(struct s35390a), GFP_KERNEL);
+	s35390a = devm_kzalloc(&client->dev, sizeof(struct s35390a),
+				GFP_KERNEL);
 	if (!s35390a) {
 		err = -ENOMEM;
 		goto exit;
@@ -386,8 +387,9 @@

 	device_set_wakeup_capable(&client->dev, 1);

-	s35390a->rtc = rtc_device_register(s35390a_driver.driver.name,
-				&client->dev, &s35390a_rtc_ops, THIS_MODULE);
+	s35390a->rtc = devm_rtc_device_register(&client->dev,
+					s35390a_driver.driver.name,
+					&s35390a_rtc_ops, THIS_MODULE);

 	if (IS_ERR(s35390a->rtc)) {
 		err = PTR_ERR(s35390a->rtc);
@@ -399,7 +401,6 @@
 	for (i = 1; i < 8; ++i)
 		if (s35390a->client[i])
 			i2c_unregister_device(s35390a->client[i]);
-	kfree(s35390a);

 exit:
 	return err;
@@ -408,14 +409,11 @@
 static int s35390a_remove(struct i2c_client *client)
 {
 	unsigned int i;
-
 	struct s35390a *s35390a = i2c_get_clientdata(client);
+
 	for (i = 1; i < 8; ++i)
 		if (s35390a->client[i])
 			i2c_unregister_device(s35390a->client[i]);
-
-	rtc_device_unregister(s35390a->rtc);
-	kfree(s35390a);

 	return 0;
 }


Refine Test Framework

Refine Test Framework

--- SctPkg/TestInfrastructure/SCT/Framework/Execute/Execute.c
+++ SctPkg/TestInfrastructure/SCT/Framework/Execute/Execute.c
@@ -35,12 +35,12 @@
   DOCUMENT, WHETHER OR NOT SUCH PARTY HAD ADVANCE NOTICE OF
   THE POSSIBILITY OF SUCH DAMAGES.

-  Copyright 2006 - 2014 Unified EFI, Inc. All
+  Copyright 2006 - 2016 Unified EFI, Inc. All
   Rights Reserved, subject to all existing rights in all
   matters included within this Test Suite, to which United
   EFI, Inc. makes no claim of right.

-  Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.

+  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.

 --*/
 /*++
@@ -947,20 +947,13 @@
 --*/
 {
   EFI_STATUS            Status;
-  UINTN                 Index;
-  UINTN                 NoInstance;
-  UINTN                 InstanceIndex;
   UINTN                 NoHandles;
   EFI_HANDLE            *HandleBuffer;
   EFI_GUID              *Guid;
-  SCT_LIST_ENTRY        *Link;
-  MDK_LIBRARY_INSTANCE  *MdkLibInstance;
   VOID                  *Interface;
   EFI_BB_TEST_PROTOCOL  *BbTest;
   UINTN                 HandleIndex;
   CHAR16                *FileName;
-
-  MdkLibInstance = NULL;

   //
   // Check parameters
@@ -1220,79 +1213,6 @@
         ExecuteInfo->Index ++;
       }
     }
-
-    //
-    // Search this GUID from configuration table
-    //
-    for (Index = 0; Index < tST->NumberOfTableEntries; Index++) {
-      if (SctCompareGuid (Guid, &tST->ConfigurationTable[Index].VendorGuid) == 0) {
-        //
-	    // Get library instance No.
-        //
-        Link = (SCT_LIST_ENTRY *) tST->ConfigurationTable[Index].VendorTable;
-
-        NoInstance = GetLibInstanceNo(Link);
-
-        SctPrint (L"\nNumber of library instance: %hd\n", NoInstance);
-
-        while (ExecuteInfo->Index < NoInstance) {
-          //
-          // Get the library instance from link list based on the InstanceIndex
-          //
-          InstanceIndex = 0;
-          Link = ((SCT_LIST_ENTRY *) tST->ConfigurationTable[Index].VendorTable)->ForwardLink;
-          for (InstanceIndex = 0; InstanceIndex < ExecuteInfo->Index; InstanceIndex ++) {
-            Link = Link->ForwardLink;
-          }
-          MdkLibInstance = CR (Link, MDK_LIBRARY_INSTANCE, Link, MDK_LIBRARY_INSTANCE_SIGNATURE);
-
-          //
-          // Print out the library instance name
-          //
-          SctPrint (L"\n\n");
-          SctPrint (L"************************************************************\n");
-          SctPrint (L"Library instance name: %hs\n", MdkLibInstance->Name);
-          SctPrint (L"************************************************************\n");
-          SctPrint (L"\n");
-
-          while (ExecuteInfo->Iteration < ExecuteInfo->TestCase->Iterations) {
-            //
-            // Configuration table item test
-            //
-            if (ExecuteInfo->State == EFI_SCT_LOG_STATE_FINISHED) {
-              EFI_SCT_DEBUG ((EFI_SCT_D_DEBUG, L"Recovery finished"));
-              ExecuteInfo->State = EFI_SCT_LOG_STATE_UNKNOWN;
-              ExecuteInfo->Iteration ++;
-              continue;
-            }
-
-            //
-            // Process information
-            //
-            SctPrint (L"  Configuration table item test: %hs\n", ExecuteInfo->TestCase->Name);
-            SctPrint (L"  Library instance name: %hs\n", MdkLibInstance->Name);
-            SctPrint (L"  Instances: %hd/%hd\n", ExecuteInfo->Index + 1, NoInstance);
-            SctPrint (L"  Iterations: %hd/%hd\n", ExecuteInfo->Iteration + 1, ExecuteInfo->TestCase->Iterations);
-
-            //
-            // Start the test case with configuration table item
-            //
-            Status = ExecuteBbTestInstance (ExecuteInfo, MdkLibInstance->Interface, NULL);
-            if (EFI_ERROR (Status)) {
-              EFI_SCT_DEBUG ((EFI_SCT_D_ERROR, L"Execute a BB test instance - %r", Status));
-              return Status;
-            }
-
-            ExecuteInfo->State = EFI_SCT_LOG_STATE_UNKNOWN;
-          ExecuteInfo->Iteration ++;
-        }
-
-        ExecuteInfo->Iteration = 0;
-        ExecuteInfo->Index ++;
-        }
-        break;
-      }
-    }
   }
   //
   // Done


[S390] dasd: use a generic wait_queue for sleep_on

Use a generic wait_queue to prevent the wait_queue in dasd_sleep_on_
functions from being referenced by callback_data while it does not
exist any more.

Signed-off-by: Stefan Haberland  <9e6a0bb809a7918e8f27f36fc1281e79ae9e5bd0@de.ibm.com>
Signed-off-by: Martin Schwidefsky <52616596d8f5df0d597e85ab515377f92f939c68@de.ibm.com>

--- drivers/s390/block/dasd.c
+++ drivers/s390/block/dasd.c
@@ -63,6 +63,7 @@
  */
 static wait_queue_head_t dasd_init_waitq;
 static wait_queue_head_t dasd_flush_wq;
+static wait_queue_head_t generic_waitq;

 /*
  * Allocate memory for a new device structure.
@@ -1151,11 +1152,15 @@
 	struct list_head *l, *n;
 	struct dasd_ccw_req *cqr;
 	struct dasd_block *block;
+	void (*callback)(struct dasd_ccw_req *, void *data);
+	void *callback_data;

 	list_for_each_safe(l, n, final_queue) {
 		cqr = list_entry(l, struct dasd_ccw_req, devlist);
 		list_del_init(&cqr->devlist);
 		block = cqr->block;
+		callback = cqr->callback;
+		callback_data = cqr->callback_data;
 		if (block)
 			spin_lock_bh(&block->queue_lock);
 		switch (cqr->status) {
@@ -1176,7 +1181,7 @@
 			BUG();
 		}
 		if (cqr->callback != NULL)
-			(cqr->callback)(cqr, cqr->callback_data);
+			(callback)(cqr, callback_data);
 		if (block)
 			spin_unlock_bh(&block->queue_lock);
 	}
@@ -1406,17 +1411,15 @@
  */
 int dasd_sleep_on(struct dasd_ccw_req *cqr)
 {
-	wait_queue_head_t wait_q;
 	struct dasd_device *device;
 	int rc;

 	device = cqr->startdev;

-	init_waitqueue_head (&wait_q);
 	cqr->callback = dasd_wakeup_cb;
-	cqr->callback_data = (void *) &wait_q;
+	cqr->callback_data = (void *) &generic_waitq;
 	dasd_add_request_tail(cqr);
-	wait_event(wait_q, _wait_for_wakeup(cqr));
+	wait_event(generic_waitq, _wait_for_wakeup(cqr));

 	/* Request status is either done or failed. */
 	rc = (cqr->status == DASD_CQR_DONE) ? 0 : -EIO;
@@ -1429,20 +1432,18 @@
  */
 int dasd_sleep_on_interruptible(struct dasd_ccw_req *cqr)
 {
-	wait_queue_head_t wait_q;
 	struct dasd_device *device;
 	int rc;

 	device = cqr->startdev;
-	init_waitqueue_head (&wait_q);
 	cqr->callback = dasd_wakeup_cb;
-	cqr->callback_data = (void *) &wait_q;
+	cqr->callback_data = (void *) &generic_waitq;
 	dasd_add_request_tail(cqr);
-	rc = wait_event_interruptible(wait_q, _wait_for_wakeup(cqr));
+	rc = wait_event_interruptible(generic_waitq, _wait_for_wakeup(cqr));
 	if (rc == -ERESTARTSYS) {
 		dasd_cancel_req(cqr);
 		/* wait (non-interruptible) for final status */
-		wait_event(wait_q, _wait_for_wakeup(cqr));
+		wait_event(generic_waitq, _wait_for_wakeup(cqr));
 	}
 	rc = (cqr->status == DASD_CQR_DONE) ? 0 : -EIO;
 	return rc;
@@ -1466,7 +1467,6 @@

 int dasd_sleep_on_immediatly(struct dasd_ccw_req *cqr)
 {
-	wait_queue_head_t wait_q;
 	struct dasd_device *device;
 	int rc;

@@ -1478,9 +1478,8 @@
 		return rc;
 	}

-	init_waitqueue_head (&wait_q);
 	cqr->callback = dasd_wakeup_cb;
-	cqr->callback_data = (void *) &wait_q;
+	cqr->callback_data = (void *) &generic_waitq;
 	cqr->status = DASD_CQR_QUEUED;
 	list_add(&cqr->devlist, &device->ccw_queue);

@@ -1489,7 +1488,7 @@

 	spin_unlock_irq(get_ccwdev_lock(device->cdev));

-	wait_event(wait_q, _wait_for_wakeup(cqr));
+	wait_event(generic_waitq, _wait_for_wakeup(cqr));

 	/* Request status is either done or failed. */
 	rc = (cqr->status == DASD_CQR_DONE) ? 0 : -EIO;
@@ -2430,6 +2429,7 @@

 	init_waitqueue_head(&dasd_init_waitq);
 	init_waitqueue_head(&dasd_flush_wq);
+	init_waitqueue_head(&generic_waitq);

 	/* register 'common' DASD debug area, used for all DBF_XXX calls */
 	dasd_debug_area = debug_register("dasd", 1, 1, 8 * sizeof(long));


[S390] dasd: call cleanup_cqr with request_queue_lock

__dasd_cleanup_cqr should be called with request_queue_lock held and
__dasd_block_process_erp with queue_lock

Signed-off-by: Stefan Haberland <9e6a0bb809a7918e8f27f36fc1281e79ae9e5bd0@de.ibm.com>
Signed-off-by: Martin Schwidefsky <52616596d8f5df0d597e85ab515377f92f939c68@de.ibm.com>

--- drivers/s390/block/dasd.c
+++ drivers/s390/block/dasd.c
@@ -1898,15 +1898,19 @@
 		wait_event(dasd_flush_wq, (cqr->status < DASD_CQR_QUEUED));
 		/* Process finished ERP request. */
 		if (cqr->refers) {
+			spin_lock_bh(&block->queue_lock);
 			__dasd_block_process_erp(block, cqr);
+			spin_unlock_bh(&block->queue_lock);
 			/* restart list_for_xx loop since dasd_process_erp
 			 * might remove multiple elements */
 			goto restart_cb;
 		}
 		/* call the callback function */
+		spin_lock_irq(&block->request_queue_lock);
 		cqr->endclk = get_clock();
 		list_del_init(&cqr->blocklist);
 		__dasd_cleanup_cqr(cqr);
+		spin_unlock_irq(&block->request_queue_lock);
 	}
 	return rc;
 }


[PATCH] sata_sil24: exit early from softreset if SStatus reports no device

sata_sil24 softreset routine used to check sata_dev_present() after
SRST is complete in the hope that SRST may do some good even when
SStatus reports no device.  This is okay as long as SRST timeout is
short (> 100ms in the current code) but it seems that not all SATA
devices are happy with short SRST timeout.

This patch makes softreset exit early without performing actual SRST
if SStatus reports no device in preparation for lengthening SRST
timeout.

Signed-off-by: Tejun Heo <ccfba69985e72fbcd9ba8bbb6db43d42971ad06d@gmail.com>
Signed-off-by: Jeff Garzik <f3e731dfa293c7a83119d8aacfa41b5d2d780be9@garzik.org>

--- drivers/scsi/sata_sil24.c
+++ drivers/scsi/sata_sil24.c
@@ -440,6 +440,12 @@

 	DPRINTK("ENTER\n");

+	if (!sata_dev_present(ap)) {
+		DPRINTK("PHY reports no device\n");
+		*class = ATA_DEV_NONE;
+		goto out;
+	}
+
 	/* temporarily turn off IRQs during SRST */
 	irq_enable = readl(port + PORT_IRQ_ENABLE_SET);
 	writel(irq_enable, port + PORT_IRQ_ENABLE_CLR);
@@ -469,18 +475,18 @@
 	/* restore IRQs */
 	writel(irq_enable, port + PORT_IRQ_ENABLE_SET);

-	if (sata_dev_present(ap)) {
-		if (!(irq_stat & PORT_IRQ_COMPLETE)) {
-			DPRINTK("EXIT, srst failed\n");
-			return -EIO;
-		}
-
-		sil24_update_tf(ap);
-		*class = ata_dev_classify(&pp->tf);
-	}
+	if (!(irq_stat & PORT_IRQ_COMPLETE)) {
+		DPRINTK("EXIT, srst failed\n");
+		return -EIO;
+	}
+
+	sil24_update_tf(ap);
+	*class = ata_dev_classify(&pp->tf);
+
 	if (*class == ATA_DEV_UNKNOWN)
 		*class = ATA_DEV_NONE;

+ out:
 	DPRINTK("EXIT, class=%u\n", *class);
 	return 0;
 }


[SCSI] scsi_error.c should #include "scsi_transport_api.h"

Every file should #include the headers containing the prototypes for its
global functions (in this case for scsi_schedule_eh()).

Signed-off-by: Adrian Bunk <0b86548ef377da0031a3ff3f0c4e06f016e20105@stusta.de>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: James Bottomley <407b36959ca09543ccda8f8e06721c791bc53435@SteelEye.com>

--- drivers/scsi/scsi_error.c
+++ drivers/scsi/scsi_error.c
@@ -37,6 +37,7 @@

 #include "scsi_priv.h"
 #include "scsi_logging.h"
+#include "scsi_transport_api.h"

 #define SENSE_TIMEOUT		(10*HZ)


spi/dw_spi: mmio code style fixups

spi/dw_spi: mmio code style fixups

Minor code style cleanups following comments by Wolfram Sang

Signed-off-by: Jean-Hugues Deschenes <56ff85aef699dd6c74b6398134aee4caf19999b0@octasic.com>
Signed-off-by: Grant Likely <9069e6f5a2b566e2674a0ba1e2bf39c12c195fad@secretlab.ca>

--- drivers/spi/dw_spi_mmio.c
+++ drivers/spi/dw_spi_mmio.c
@@ -17,8 +17,8 @@
 #define DRIVER_NAME "dw_spi_mmio"

 struct dw_spi_mmio {
-	struct dw_spi	dws;
-	struct clk		*clk;
+	struct dw_spi  dws;
+	struct clk     *clk;
 };

 static int __devinit dw_spi_mmio_probe(struct platform_device *pdev)
@@ -134,13 +134,12 @@
 {
 	return platform_driver_probe(&dw_spi_mmio_driver, dw_spi_mmio_probe);
 }
+module_init(dw_spi_mmio_init);

 static void __exit dw_spi_mmio_exit(void)
 {
 	platform_driver_unregister(&dw_spi_mmio_driver);
 }
-
-module_init(dw_spi_mmio_init);
 module_exit(dw_spi_mmio_exit);

 MODULE_AUTHOR("Jean-Hugues Deschenes <jean-hugues.deschenes@octasic.com>");


spi: bcm2835: fix overflow in calculation of transfer time

This resulted in the use of polling mode when other approaches
(dma or interrupts) would have been more appropriate.

Happened for transfers longer than 477 bytes.

Reported-by: Noralf Tronnes <6e3f2b5231d1dd0276248606e5046c3a59392fa8@tronnes.org>
Signed-off-by: Martin Sperl <c65a0fb7e74ffd2c9fc3a0f9aacb0f6a24b0a68b@martin.sperl.org>
Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@kernel.org>


spi/s3c64xx: Drop extra calls to spi_master_get in suspend/remove functions

Suspend and resume functions call spi_master_get() without matching
spi_master_put(). The extra references are unnecessary and cause subsequent
module unload attempts to fail. Drop the calls.

Signed-off-by: Guenter Roeck <ba324ca7b1c77fc20bb970d5aff6eea9377918a5@roeck-us.net>
Acked-by: Kukjin Kim <3fc711f4e08bc570a586748633ff7c76d0e1e253@samsung.com>
Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@opensource.wolfsonmicro.com>

--- drivers/spi/spi-s3c64xx.c
+++ drivers/spi/spi-s3c64xx.c
@@ -1409,7 +1409,7 @@
 #ifdef CONFIG_PM
 static int s3c64xx_spi_suspend(struct device *dev)
 {
-	struct spi_master *master = spi_master_get(dev_get_drvdata(dev));
+	struct spi_master *master = dev_get_drvdata(dev);
 	struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);

 	spi_master_suspend(master);
@@ -1428,7 +1428,7 @@

 static int s3c64xx_spi_resume(struct device *dev)
 {
-	struct spi_master *master = spi_master_get(dev_get_drvdata(dev));
+	struct spi_master *master = dev_get_drvdata(dev);
 	struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
 	struct s3c64xx_spi_info *sci = sdd->cntrlr_info;

@@ -1452,7 +1452,7 @@
 #ifdef CONFIG_PM_RUNTIME
 static int s3c64xx_spi_runtime_suspend(struct device *dev)
 {
-	struct spi_master *master = spi_master_get(dev_get_drvdata(dev));
+	struct spi_master *master = dev_get_drvdata(dev);
 	struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);

 	clk_disable(sdd->clk);
@@ -1463,7 +1463,7 @@

 static int s3c64xx_spi_runtime_resume(struct device *dev)
 {
-	struct spi_master *master = spi_master_get(dev_get_drvdata(dev));
+	struct spi_master *master = dev_get_drvdata(dev);
 	struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);

 	clk_enable(sdd->src_clk);


spi/s3c64xx: Take runtime PM reference even if DMA is not supported

We always need the device to be runtime PM enabled to use it so just skip
the DMA initialisation not the entire prepare when polling.

Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@linaro.org>

--- drivers/spi/spi-s3c64xx.c
+++ drivers/spi/spi-s3c64xx.c
@@ -429,27 +429,26 @@
 	dma_cap_mask_t mask;
 	int ret;

-	if (is_polling(sdd))
-		return 0;
-
-	dma_cap_zero(mask);
-	dma_cap_set(DMA_SLAVE, mask);
-
-	/* Acquire DMA channels */
-	sdd->rx_dma.ch = dma_request_slave_channel_compat(mask, filter,
-				(void *)sdd->rx_dma.dmach, dev, "rx");
-	if (!sdd->rx_dma.ch) {
-		dev_err(dev, "Failed to get RX DMA channel\n");
-		ret = -EBUSY;
-		goto out;
-	}
-
-	sdd->tx_dma.ch = dma_request_slave_channel_compat(mask, filter,
-				(void *)sdd->tx_dma.dmach, dev, "tx");
-	if (!sdd->tx_dma.ch) {
-		dev_err(dev, "Failed to get TX DMA channel\n");
-		ret = -EBUSY;
-		goto out_rx;
+	if (!is_polling(sdd)) {
+		dma_cap_zero(mask);
+		dma_cap_set(DMA_SLAVE, mask);
+
+		/* Acquire DMA channels */
+		sdd->rx_dma.ch = dma_request_slave_channel_compat(mask, filter,
+				   (void *)sdd->rx_dma.dmach, dev, "rx");
+		if (!sdd->rx_dma.ch) {
+			dev_err(dev, "Failed to get RX DMA channel\n");
+			ret = -EBUSY;
+			goto out;
+		}
+
+		sdd->tx_dma.ch = dma_request_slave_channel_compat(mask, filter,
+				   (void *)sdd->tx_dma.dmach, dev, "tx");
+		if (!sdd->tx_dma.ch) {
+			dev_err(dev, "Failed to get TX DMA channel\n");
+			ret = -EBUSY;
+			goto out_rx;
+		}
 	}

 	ret = pm_runtime_get_sync(&sdd->pdev->dev);


USB: usblp: "Big cleanup" breaks O_NONBLOCK

I found the first regresson in the rewritten ("all dynamic" and "no races")
driver. If application uses O_NONBLOCK, I return -EAGAIN despite the URB
being submitted successfuly. This causes the application to resubmit the
same data erroneously.

The fix is to pretend that the transfer has succeeded even if URB was
merely queued. It is the same behaviour as with the old version.

Signed-off-by: Pete Zaitcev <775c8ea1f82a8ffb8cf58861cc6286708292a786@redhat.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/usb/class/usblp.c
+++ drivers/usb/class/usblp.c
@@ -741,10 +741,11 @@
 		 */
 		rv = usblp_wwait(usblp, !!(file->f_flags&O_NONBLOCK));
 		if (rv < 0) {
-			/*
-			 * If interrupted, we simply leave the URB to dangle,
-			 * so the ->release will call usb_kill_urb().
-			 */
+			if (rv == -EAGAIN) {
+				/* Presume that it's going to complete well. */
+				writecount += transfer_length;
+			}
+			/* Leave URB dangling, to be cleaned on close. */
 			goto collect_error;
 		}


usb: class: Use USB_CLASS_PRINTER instead of number 7

Kernel provides very nice defines for USB device class
so it's a good idea to use them in suitable places.
It is much easier to grep for such define instead of 7.

Signed-off-by: Krzysztof Opasiak <8064eda6f94b3817252b7d7649cf754592f63500@samsung.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>


usb: dwc2: gadget: initialize op_state for peripheral only configuration

ID status change interrupt will not be handled in peripheral only
configuration. So initialize op_state during gadget init.

Signed-off-by: Mian Yousaf Kaukab <6d039e1e5c9c8db5c8b5fcee2b837cd67fbfc930@intel.com>
Tested-by: Robert Baldyga <72b1db3d98bf139199de36aba5da00140727c571@samsung.com>
Tested-by: Dinh Nguyen <a48724738fc762a7f206428dfcaf7ede2fd84d0f@opensource.altera.com>
Tested-by: John Youn <d42a4eb72e2ed398cd02c138cc1131a66e2fa0de@synopsys.com>
Acked-by: John Youn <d42a4eb72e2ed398cd02c138cc1131a66e2fa0de@synopsys.com>
Signed-off-by: Felipe Balbi <94dddeeef08b001e003cce128ddc162a4e2c6cd2@ti.com>


usb: dwc3: gadget: don't return anything on prepare trbs

all that function does is setup a TRB to be sent
to HW later. There's no need to return anything
actually.

Signed-off-by: Felipe Balbi <94dddeeef08b001e003cce128ddc162a4e2c6cd2@ti.com>


[PATCH] USB: gadget zero and dma-coherent buffers

This makes sure that the correct length is reported when freeing
a dma-coherent buffer; some platforms complain if that's wrong.
It also makes two parameters readonly in sysfs, as they're not
safe to change while tests are running.

Signed-off-by: David Brownell <a0d09457d62acbdeb1fae1223575100ccbfffdf9@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/usb/gadget/zero.c
+++ drivers/usb/gadget/zero.c
@@ -165,8 +165,8 @@
 static unsigned qlen = 32;
 static unsigned pattern = 0;

-module_param (buflen, uint, S_IRUGO|S_IWUSR);
-module_param (qlen, uint, S_IRUGO|S_IWUSR);
+module_param (buflen, uint, S_IRUGO);
+module_param (qlen, uint, S_IRUGO);
 module_param (pattern, uint, S_IRUGO|S_IWUSR);

 /*
@@ -1127,8 +1127,10 @@
 	DBG (dev, "unbind\n");

 	/* we've already been disconnected ... no i/o is active */
-	if (dev->req)
+	if (dev->req) {
+		dev->req->length = USB_BUFSIZ;
 		free_ep_req (gadget->ep0, dev->req);
+	}
 	del_timer_sync (&dev->resume);
 	kfree (dev);
 	set_gadget_data (gadget, NULL);


UAS: Free status URB when we can't find the SCSI tag.

In the UAS status URB completion handler, we need to free the URB, no
matter what happens.  Fix a bug where we would leak the URB (and its
buffer) if we couldn't find a SCSI command that is associated with this
status phase.

Signed-off-by: Sarah Sharp <d4c4fc5069677be84f589aa6e14eedffef9ba12f@linux.intel.com>
Cc: Matthew Wilcox <990c37a323daf1549bdd24197927625080ee16b8@linux.intel.com>
Signed-off-by: Sebastian Andrzej Siewior <265264fed90bdf8e813a354375ec16f47ebdb1c5@linutronix.de>

--- drivers/usb/storage/uas.c
+++ drivers/usb/storage/uas.c
@@ -246,8 +246,10 @@
 		cmnd = sdev->current_cmnd;
 	else
 		cmnd = scsi_find_tag(sdev, tag);
-	if (!cmnd)
+	if (!cmnd) {
+		usb_free_urb(urb);
 		return;
+	}

 	switch (iu->iu_id) {
 	case IU_ID_STATUS:


Mesh rotation

Mesh rotation

--- code/source/editor/editor.c
+++ code/source/editor/editor.c
@@ -21,7 +21,7 @@
 { return screen_to_world_size((V2i) {5, 0}).x; }

 internal
-V3d cursor_delta_in_tf_coords(T3d tf)
+V3f cursor_delta_in_tf_coords(T3d tf)
 {
 	UiContext *ctx= g_env.uicontext;
 	V3d cur_wp= v2d_to_v3d(screen_to_world_point(ctx->dev.cursor_pos));
@@ -34,7 +34,21 @@
 						(T3d) {	{1, 1, 1},
 								identity_qd(),
 								prev_wp}).pos;
-	return sub_v3d(cur, prev);
+	return v3d_to_v3f(sub_v3d(cur, prev));
+}
+
+internal
+Qf cursor_rot_delta_in_tf_coords(T3d tf)
+{
+	V3d center= tf.pos;
+	/// @todo Correct return with 3d rot
+
+	UiContext *ctx= g_env.uicontext;
+	V3d cur_wp= v2d_to_v3d(screen_to_world_point(ctx->dev.cursor_pos));
+	V3d prev_wp= v2d_to_v3d(screen_to_world_point(ctx->dev.prev_cursor_pos));
+	V3f v1= v3d_to_v3f(sub_v3d(prev_wp, center));
+	V3f v2= v3d_to_v3f(sub_v3d(cur_wp, center));
+	return qf_by_from_to(v1, v2);
 }

 internal
@@ -190,7 +204,7 @@
 }

 internal
-void translate_mesh(ModelEntity *m, V3d delta, bool uv)
+void transform_mesh(ModelEntity *m, T3f tf, bool uv)
 {
 	if (m->has_own_mesh) {
 		debug_print("@todo Modify unique mesh");
@@ -211,11 +225,11 @@
 		if (!v->selected)
 			continue;
 		if (uv) {
-			v->uv= add_v3f(v3d_to_v3f(delta), v->uv);
+			v->uv= transform_v3f(tf, v->uv);
 			v->uv.x= CLAMP(v->uv.x, 0.0, 1.0);
 			v->uv.y= CLAMP(v->uv.y, 0.0, 1.0);
 		} else {
-			v->pos= add_v3f(v3d_to_v3f(delta), v->pos);
+			v->pos= transform_v3f(tf, v->pos);
 		}
 	}

@@ -289,8 +303,13 @@
 		// Move selected uv coords
 		V3d cur= pix_to_uv(ctx->dev.cursor_pos, pix_pos, pix_size);
 		V3d prev= pix_to_uv(ctx->dev.prev_cursor_pos, pix_pos, pix_size);
-		V3d delta= sub_v3d(cur, prev);
-		translate_mesh(m, delta, true);
+		T3f delta= {{1, 1, 1}, identity_qf(), v3d_to_v3f(sub_v3d(cur, prev))};
+		transform_mesh(m, delta, true);
+	}
+
+	if (ctx->dev.rotating == gui_id(box_label)) {
+		debug_print("@todo Uv rotating");
+		ctx->dev.rotating= 0;
 	}

 	V2i padding= {20, 20};
@@ -356,10 +375,6 @@
 		return;

 	if (*is_edit_mode) {
-		if (ctx->dev.grabbing == gui_id(box_label)) {
-			translate_mesh(m, cursor_delta_in_tf_coords(m->tf), false);
-		}
-
 		if (ctx->dev.toggle_select_all) {
 			bool some_selected= false;
 			for (U32 i= 0; i < m->mesh_v_count; ++i) {
@@ -370,6 +385,16 @@
 				m->vertices[i].selected= !some_selected;
 			}
 		}
+	}
+
+	if (*is_edit_mode && (ctx->dev.grabbing || ctx->dev.rotating)) {
+		T3f delta= {{1, 1, 1}, identity_qf(), {0, 0, 0}};
+		if (ctx->dev.grabbing == gui_id(box_label)) {
+			delta.pos= cursor_delta_in_tf_coords(m->tf);
+		} else if (ctx->dev.rotating == gui_id(box_label)) {
+			delta.rot= cursor_rot_delta_in_tf_coords(m->tf);
+		}
+		transform_mesh(m, delta, false);
 	}

 	if (*is_edit_mode && state.pressed) {
@@ -425,13 +450,12 @@
 {
 	UiContext *ctx= g_env.uicontext;
 	V3d cur_wp= v2d_to_v3d(screen_to_world_point(ctx->dev.cursor_pos));
-	V3d prev_wp= v2d_to_v3d(screen_to_world_point(ctx->dev.prev_cursor_pos));

 	const char *box_label= "armature_overlay_box";
 	EditorBoxState state=
 		gui_editorbox(box_label, (V2i) {0, 0}, g_env.device->win_size, true);

-	if (!*is_edit_mode) { // Mesh select mode
+	if (!*is_edit_mode) {
 		if (state.down)
 			*comp_h= find_compentity_at_pixel(ctx->dev.cursor_pos);
 	}
@@ -445,6 +469,19 @@
 	T3d global_pose[MAX_ARMATURE_JOINT_COUNT];
 	calc_global_pose(global_pose, entity);

+	if (*is_edit_mode) {
+		if (ctx->dev.toggle_select_all) {
+			bool some_selected= false;
+			for (U32 i= 0; i < a->joint_count; ++i) {
+				if (a->joints[i].selected)
+					some_selected= true;
+			}
+			for (U32 i= 0; i < a->joint_count; ++i)
+				a->joints[i].selected= false;
+			a->joints[0].selected= !some_selected;
+		}
+	}
+
 	if (*is_edit_mode && (ctx->dev.grabbing || ctx->dev.rotating)) {
 		if (!a->res.is_runtime_res) {
 			a= create_rt_armature(a);
@@ -462,7 +499,7 @@
 				if (super_i != NULL_JOINT_ID)
 					coords= global_pose[super_i];

-				V3f translation= v3d_to_v3f(cursor_delta_in_tf_coords(coords));
+				V3f translation= cursor_delta_in_tf_coords(coords);

 				{ // `translation` from cur pose coords to bind pose coords
 					T3f to_bind= inv_t3f(entity->pose.tf[i]);
@@ -474,10 +511,7 @@
 				V3f *bind_pos= &a->joints[i].bind_pose.pos;
 				*bind_pos= add_v3f(*bind_pos, translation);
 			} else if (ctx->dev.rotating == gui_id(box_label)) {
-				V3d center= global_pose[i].pos;
-				V3f v1= v3d_to_v3f(sub_v3d(prev_wp, center));
-				V3f v2= v3d_to_v3f(sub_v3d(cur_wp, center));
-				Qf rot= qf_by_from_to(v1, v2);
+				Qf rot= cursor_rot_delta_in_tf_coords(global_pose[i]);

 				/// @todo Won't work with 3d animations (?)
 				Qf *bind_rot= &a->joints[i].bind_pose.rot;
@@ -545,13 +579,12 @@
 		return;

 	bool tab_pressed= g_env.device->key_pressed[KEY_TAB];
-	if (tab_pressed) {
+	if (tab_pressed)
 		toggle_bool(&e->is_edit_mode);
-		if (e->state == EditorState_mesh && e->cur_model_h == NULL_HANDLE)
-			e->is_edit_mode= false;
-		if (e->state == EditorState_armature && e->cur_comp_h == NULL_HANDLE)
-			e->is_edit_mode= false;
-	}
+	if (e->state == EditorState_mesh && e->cur_model_h == NULL_HANDLE)
+		e->is_edit_mode= false;
+	if (e->state == EditorState_armature && e->cur_comp_h == NULL_HANDLE)
+		e->is_edit_mode= false;

 	switch (e->state) {
 	case EditorState_mesh: {


Hopefully getting close to fixing win

Hopefully getting close to fixing win

git-svn-id: bf5cd6ccde378db821296732a091cfbcf5285fbd@159104 bbb929c8-8fbe-4397-9dbb-9b2b20218538

--- Source/platform/audio/chromium/AudioDestinationChromium.h
+++ Source/platform/audio/chromium/AudioDestinationChromium.h
@@ -35,6 +35,7 @@
 #include "platform/audio/AudioSourceProvider.h"
 #include "public/platform/WebAudioDevice.h"
 #include "public/platform/WebVector.h"
+#include "wtf/Noncopyable.h"

 namespace WebCore {

@@ -44,6 +45,7 @@
 // An AudioDestination using Chromium's audio system

 class PLATFORM_EXPORT AudioDestinationChromium : public AudioDestination, public WebKit::WebAudioDevice::RenderCallback, public AudioSourceProvider {
+    WTF_MAKE_NONCOPYABLE(AudioDestinationChromium);
 public:
     AudioDestinationChromium(AudioIOCallback&, const String& inputDeviceId, unsigned numberOfInputChannels, unsigned numberOfOutputChannels, float sampleRate);
     virtual ~AudioDestinationChromium();


Remove unnecessary declarations of static functions

These functions don't need to be declared in advance at all.

--- codec/encoder/core/inc/md.h
+++ codec/encoder/core/inc/md.h
@@ -111,9 +111,6 @@

 } SMeRefinePointer;

-static void md_intra_init (sWelsEncCtx* pEncCtx, SWelsMD* pWelsMd, SMB* pCurMb);
-static void md_inter_init (sWelsEncCtx* pEncCtx, SWelsMD* pWelsMd, SMB* pCurMb);
-
 void FillNeighborCacheIntra (SMbCache* pMbCache, SMB* pCurMb, int32_t iMbWidth/*, bool constrained_intra_pred_flag*/);
 void FillNeighborCacheInterWithoutBGD (SMbCache* pMbCache, SMB* pCurMb, int32_t iMbWidth,
                                        int8_t* pVaaBgMbFlag); //BGD spatial func


ARM: shmobile: r8a7791: Declare SCIF register base and IRQ as resources

Passing the register base address and IRQ through platform data is
deprecated. Use resources instead.

Signed-off-by: Laurent Pinchart <ae960578cc5eca7b9b1dbc37d9caa6cb634f35e0@ideasonboard.com>
Signed-off-by: Simon Horman <9662bddcc379be37df16f02a449c344b4718c1a1@verge.net.au>


Circuit genetics operators rewritten

Circuit genetics operators rewritten

--- eacirc/circuit/genetics.h
+++ eacirc/circuit/genetics.h
@@ -15,21 +15,52 @@
         return dst(g);
     }

-    template <class Generator> static function generate_function(Generator &g) {
-// TODO
-#error TODO
-    }
-
     template <class Generator>
     static connectors<Def> generate_connetors(Generator &g, std::size_t size) {
-// TODO
-#error TODO
+        std::uniform_int_distribution<connectors<Def>> dst(0, (1u << size) - 1);
+        return dst(g);
     }
 };

-template <class Generator, class Def> struct basic_mutator final : mutator {
-    basic_mutator(Generator &g)
-        : _g(g) {}
+template <class Def, class Generator>
+struct basic_initializer final : initializer {
+    basic_initializer(Generator &g, const sample_pool<function> &function_pool)
+        : _g(g)
+        , _function_pool(function_pool) {}
+
+    void apply(backend &bck) override {
+        auto circ = dynamic_cast<circuit<Def> &>(bck);
+
+        // for the first layer...
+        for (unsigned i = 0; i != Def::x; ++i) {
+            auto node = circ[0][i];
+
+            node.connectors = (i < Def::in) ? 1u << i : 0;
+            node.function = function::XOR;
+            node.argument = helper<Def>::generate_argument(_g);
+        }
+
+        // for the rest layers...
+        for (unsigned i = 1; i != Def::y; ++i)
+            for (auto node : circ[i]) {
+                node.connectors = helper<Def>::generate_connectors(_g, Def::x);
+                node.function = _function_pool(_g);
+                node.argument = helper<Def>::generate_argument(_g);
+            }
+    }
+
+private:
+    Generator &_g;
+    sample_pool<function> _function_pool;
+};
+
+template <class Def, class Generator> struct basic_mutator final : mutator {
+    basic_mutator(Generator &g, const sample_pool<function> &function_pool)
+        : _g(g)
+        , _function_pool(function_pool)
+        , _function_distance(2)
+        , _argument_distance(2)
+        , _connector_distance(3) {}

     void apply(backend &bck) override {
         using node_distribution = std::uniform_int_distribution<std::size_t>;
@@ -38,15 +69,16 @@
         node_distribution dst{0, circuit<Def>::num_of_nodes};

         for (std::size_t i = 0; i != _function_distance; ++i)
-            circ.node(dst(g)).function = helper<Def>::generate_function(_g);
+            circ.node(dst(_g)).function = _function_pool(_g);
         for (std::size_t i = 0; i != _argument_distance; ++i)
-            circ.node(dst(g)).argument = helper<Def>::generate_argument(_g);
+            circ.node(dst(_g)).argument = helper<Def>::generate_argument(_g);
         for (std::size_t i = 0; i != _connector_distance; ++i)
             mutate_connectors(circ, node_dst(_g));
     }

 private:
     Generator &_g;
+    sample_pool<function> _function_pool;
     std::size_t _function_distance;
     std::size_t _argument_distance;
     std::size_t _connector_distance;
@@ -79,7 +111,7 @@
         std::transform(_in_b.begin(), _in_b.end(),
                        std::back_inserter(_out_b.begin()), kernel);

-        return 1. - _chisqr(_out_a, _out_b);
+        return 1.0 - _chisqr(_out_a, _out_b);
     }

 private:


Lost a file in last check-in.

Lost a file in last check-in.

git-svn-id: 5648d1bec6962b0a6d1d1b40eba8cf5cdb62da3d@11101 6f19259b-4bc3-4df7-8a09-765794883524

error: pathspec 'UefiCpuPkg/Library/SecPeiDxeTimerLibUefiCpu/IpfTimerLib.c' did not match any file(s) known to git

--- UefiCpuPkg/Library/SecPeiDxeTimerLibUefiCpu/IpfTimerLib.c
+++ UefiCpuPkg/Library/SecPeiDxeTimerLibUefiCpu/IpfTimerLib.c
@@ -0,0 +1,172 @@
+/** @file
+  Timer Library functions built upon ITC on IPF.
+
+  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php.
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include <Base.h>
+#include <Library/TimerLib.h>
+#include <Library/BaseLib.h>
+#include <Library/PalLib.h>
+
+
+/**
+  Performs a delay measured as number of ticks.
+
+  An internal function to perform a delay measured as number of ticks. It's
+  invoked by MicroSecondDelay() and NanoSecondDelay().
+
+  @param  Delay The number of ticks to delay.
+
+**/
+VOID
+EFIAPI
+InternalIpfDelay (
+  IN      INT64                     Delay
+  )
+{
+  INT64                             Ticks;
+
+  //
+  // The target timer count is calculated here
+  //
+  Ticks = (INT64)AsmReadItc () + Delay;
+
+  //
+  // Wait until time out
+  // Delay > 2^63 could not be handled by this function
+  // Timer wrap-arounds are handled correctly by this function
+  //
+  while (Ticks - (INT64)AsmReadItc() >= 0);
+}
+
+/**
+  Stalls the CPU for at least the given number of microseconds.
+
+  Stalls the CPU for the number of microseconds specified by MicroSeconds.
+
+  @param  MicroSeconds  The minimum number of microseconds to delay.
+
+  @return The value of MicroSeconds inputted.
+
+**/
+UINTN
+EFIAPI
+MicroSecondDelay (
+  IN      UINTN                     MicroSeconds
+  )
+{
+  InternalIpfDelay (
+    GetPerformanceCounterProperties (NULL, NULL) *
+    MicroSeconds /
+    1000000
+    );
+  return MicroSeconds;
+}
+
+/**
+  Stalls the CPU for at least the given number of nanoseconds.
+
+  Stalls the CPU for the number of nanoseconds specified by NanoSeconds.
+
+  @param  NanoSeconds The minimum number of nanoseconds to delay.
+
+  @return The value of NanoSeconds inputted.
+
+**/
+UINTN
+EFIAPI
+NanoSecondDelay (
+  IN      UINTN                     NanoSeconds
+  )
+{
+  InternalIpfDelay (
+    GetPerformanceCounterProperties (NULL, NULL) *
+    NanoSeconds /
+    1000000000
+    );
+  return NanoSeconds;
+}
+
+/**
+  Retrieves the current value of a 64-bit free running performance counter.
+
+  The counter can either count up by 1 or count down by 1. If the physical
+  performance counter counts by a larger increment, then the counter values
+  must be translated. The properties of the counter can be retrieved from
+  GetPerformanceCounterProperties().
+
+  @return The current value of the free running performance counter.
+
+**/
+UINT64
+EFIAPI
+GetPerformanceCounter (
+  VOID
+  )
+{
+  return AsmReadItc ();
+}
+
+/**
+  Retrieves the 64-bit frequency in Hz and the range of performance counter
+  values.
+
+  If StartValue is not NULL, then the value that the performance counter starts
+  with immediately after is it rolls over is returned in StartValue. If
+  EndValue is not NULL, then the value that the performance counter end with
+  immediately before it rolls over is returned in EndValue. The 64-bit
+  frequency of the performance counter in Hz is always returned. If StartValue
+  is less than EndValue, then the performance counter counts up. If StartValue
+  is greater than EndValue, then the performance counter counts down. For
+  example, a 64-bit free running counter that counts up would have a StartValue
+  of 0 and an EndValue of 0xFFFFFFFFFFFFFFFF. A 24-bit free running counter
+  that counts down would have a StartValue of 0xFFFFFF and an EndValue of 0.
+
+  @param  StartValue  The value the performance counter starts with when it
+                      rolls over.
+  @param  EndValue    The value that the performance counter ends with before
+                      it rolls over.
+
+  @return The frequency in Hz.
+
+**/
+UINT64
+EFIAPI
+GetPerformanceCounterProperties (
+  OUT      UINT64                    *StartValue,  OPTIONAL
+  OUT      UINT64                    *EndValue     OPTIONAL
+  )
+{
+  PAL_CALL_RETURN                   PalRet;
+  UINT64                            BaseFrequence;
+
+  if (StartValue != NULL) {
+    *StartValue = 0;
+  }
+
+  if (EndValue != NULL) {
+    *EndValue = (UINT64)(-1);
+  }
+
+  PalRet = PalCall (PAL_FREQ_BASE, 0, 0, 0);
+  if (PalRet.Status != 0) {
+    return 1000000;
+  }
+  BaseFrequence = PalRet.r9;
+
+  PalRet = PalCall (PAL_FREQ_RATIOS, 0, 0, 0);
+  if (PalRet.Status != 0) {
+    return 1000000;
+  }
+
+  return BaseFrequence * (PalRet.r11 >> 32) / (UINT32)PalRet.r11;
+}


removed unused backup variable

removed unused backup variable

git-svn-id: ab66a9de07fa9d47c5829c82992f5279466c775f@1770 63c20433-aa62-49bd-875c-5a186b69a8fb

--- src/compositor/svg_paint_servers.c
+++ src/compositor/svg_paint_servers.c
@@ -244,7 +244,7 @@

 static void svg_update_gradient(SVG_GradientStack *st, GF_ChildNodeItem *children, Bool linear)
 {
-	SVGPropertiesPointers *svgp;
+	SVGPropertiesPointers *svgp, *backup;
 	GF_Node *node = st->txh.owner;
 	GF_TraverseState *tr_state = st->txh.compositor->traverse_state;


fix wrong importing from ReactiveCocoa to ReactiveObjC

--- XLReactiveCocoaExtensions/XLReactiveCocoaExtensions.h
+++ XLReactiveCocoaExtensions/XLReactiveCocoaExtensions.h
@@ -9,7 +9,7 @@
 #ifndef CMDPUserLogin_XLReactiveCocoaExtension_h
 #define CMDPUserLogin_XLReactiveCocoaExtension_h

-#import <ReactiveCocoa/ReactiveCocoa.h>
+#import <ReactiveObjC/ReactiveObjC.h>

 // RACExtensions
 #import <XLReactiveCocoaExtensions/RACSignal+ValueValidation.h>


mod_hmh: better schedule related messages

--- src/mod_hmh.c
+++ src/mod_hmh.c
@@ -276,12 +276,20 @@
 		if(update_schedule()) last_schedule_update = now;
 	}

+	enum { SCHED_UNKNOWN = 0, SCHED_OFF = (1 << 0), SCHED_OLD = (1 << 1) };
+
+	uint32_t schedule_flags = 0;
 	int index = -1;
 	for(int i = 0; i < DAYS_IN_WEEK; ++i){
-		if(schedule[i] == 0 || schedule[i] == -1) continue;
-		if(schedule[i] > (now - (90*60))){
+		if(schedule[i] == 0) continue;
+
+		if(schedule[i] == -1){
+			schedule_flags |= SCHED_OFF;
+		} else if(schedule[i] > (now - (90*60))){
 			index = i;
 			break;
+		} else {
+			schedule_flags |= SCHED_OLD;
 		}
 	}

@@ -293,7 +301,13 @@
 		// add 15 mins since the note marks the end of the prestream.
 		diff += (15*60);
 	} else if(index == -1){
-		ctx->send_msg(chan, "No more streams scheduled, try checking handmadehero.org or @handmade_hero on twitter");
+		if(schedule_flags & SCHED_OLD){
+			ctx->send_msg(chan, "No more streams this week.");
+		} else if(schedule_flags & SCHED_OFF){
+			ctx->send_msg(chan, "The stream is off this week, see twitter for details.");
+		} else {
+			ctx->send_msg(chan, "The schedule hasn't been updated yet.");
+		}
 		return;
 	} else {
 		note_time = 0;
@@ -304,9 +318,9 @@
 		int until = -diff;

 		if(until / (60*60*24) == 1){
-			ctx->send_msg(chan, "Next stream tomorrow.");
+			ctx->send_msg(chan, "No stream today, next one tomorrow.");
 		} else if(until / (60*60*24) > 1){
-			ctx->send_msg(chan, "Next stream in %d days.", until / (60*60*24));
+			ctx->send_msg(chan, "No stream today, next one in %d days.", until / (60*60*24));
 		} else {
 			char  time_buf[256];
 			char* time_ptr = time_buf;


hopefully this is it for #472

hopefully this is it for #472

--- tests/integration/integration.h
+++ tests/integration/integration.h
@@ -49,7 +49,7 @@
       ss << "cd " << working_directory_ << "; ";

     if(path_ != "")
-      ss << "PATH=$PATH:" << path_ << " ";
+      ss << "PATH=" << path_ << ":$PATH ";

     ss << code;
     ss << " >/dev/null";
@@ -81,12 +81,12 @@
   set_working_dir("examples/tutorial");

   // Build and test original program
-  EXPECT_EQ(0, shell("make clean orig"));
-  EXPECT_EQ(42752, shell("./a.out 90000000", &diff_1));
+  EXPECT_EQ(0ull, shell("make clean orig"));
+  EXPECT_EQ(42752ull, shell("./a.out 90000000", &diff_1));

   // Run make extract, testcase
-  EXPECT_EQ(0, shell("make extract"));
-  EXPECT_EQ(0, shell("make testcase"));
+  EXPECT_EQ(0ull, shell("make extract"));
+  EXPECT_EQ(0ull, shell("make testcase"));

   // In 10 tries, search should succeed at least once...
   size_t good = 0;
@@ -99,10 +99,10 @@
   EXPECT_GT(good, (size_t)0);

   // Run make replace
-  EXPECT_EQ(0, shell("make replace"));
+  EXPECT_EQ(0ull, shell("make replace"));

   // Test new program
-  EXPECT_EQ(42752, shell("./a.out 90000000", &diff_2));
+  EXPECT_EQ(42752ull, shell("./a.out 90000000", &diff_2));

   // There should have been at least a 20% speedup.
   // Usually we see a 10x speedup.
@@ -110,7 +110,7 @@
   EXPECT_GT(diff_1*100, diff_2*120);

   // Cleanup
-  EXPECT_EQ(0, shell("make clean"));
+  EXPECT_EQ(0ull, shell("make clean"));

 }

@@ -128,12 +128,12 @@
   set_working_dir("examples/pairity");

   // Build and test original program
-  EXPECT_EQ(0, shell("make clean orig"));
+  EXPECT_EQ(0ull, shell("make clean orig"));

-  EXPECT_EQ(0, shell("./a.out 1000000000", &diff_1));
+  EXPECT_EQ(0ull, shell("./a.out 1000000000", &diff_1));

   // Run make extract
-  EXPECT_EQ(0, shell("make extract"));
+  EXPECT_EQ(0ull, shell("make extract"));

   // In 10 tries, search should succeed at least once...
   size_t good = 0;
@@ -148,12 +148,12 @@
   EXPECT_GT(good, (size_t)0);

   // Run make replace
-  EXPECT_EQ(0, shell("make replace"));
+  EXPECT_EQ(0ull, shell("make replace"));

   // Test new program
-  EXPECT_EQ(0, shell("./a.out 1000000000", &diff_2));
+  EXPECT_EQ(0ull, shell("./a.out 1000000000", &diff_2));

   // Cleanup
-  EXPECT_EQ(0, shell("make clean"));
+  EXPECT_EQ(0ull, shell("make clean"));

 }


Redis Admin Rewrite Fixes

Redis Admin Rewrite Fixes

--- lib/include/redis_admin.h
+++ lib/include/redis_admin.h
@@ -1,4 +1,4 @@
-#include "hiredis.h"
+#include <hiredis.h>
 #include "factory/redis_interface.h"
 #include <string.h>
 #include <string>


Fixed doc.error.

Fixed doc.error.

git-svn-id: de15d415ffb1bc5d91a165b5b7d2093897d104a2@6087 35acf78f-673a-0410-8e92-d51de3d6d3f4

--- os/ports/GCC/ARMCMx/STM32F3xx/cmparams.h
+++ os/ports/GCC/ARMCMx/STM32F3xx/cmparams.h
@@ -20,7 +20,7 @@

 /**
  * @file    GCC/ARMCMx/STM32F3xx/cmparams.h
- * @brief   ARM Cortex-M3 parameters for the STM32F3xx.
+ * @brief   ARM Cortex-M4 parameters for the STM32F3xx.
  *
  * @defgroup ARMCMx_STM32F3xx STM32F3xx Specific Parameters
  * @ingroup ARMCMx_SPECIFIC


in_disk: estimate data size with sector number

Signed-off-by: Takahiro YAMASHITA <8b9f03f78cb27351a99f79113f99e589b65190d5@gmail.com>

--- plugins/in_disk/in_disk.c
+++ plugins/in_disk/in_disk.c
@@ -91,12 +91,12 @@
                     skip_line = FLB_TRUE;
                 }
                 break;
-            case 4: /* read size */
+            case 6: /* sectors read */
                 temp_total = strtoull(buf, NULL, 10);
                 ctx->prev_read_total[i_entry] = ctx->read_total[i_entry];
                 ctx->read_total[i_entry] = temp_total;
                 break;
-            case 8: /* write size */
+            case 10: /* sectors written */
                 temp_total = strtoull(buf, NULL, 10);
                 ctx->prev_write_total[i_entry] = ctx->write_total[i_entry];
                 ctx->write_total[i_entry] = temp_total;
@@ -123,8 +123,8 @@
     (void) *i_ins;
     (void) *config;

-    uint64_t read_total = 0;
-    uint64_t write_total = 0;
+    unsigned long  read_total = 0; /* The type of sector size is unsigned long in kernel source */
+    unsigned long  write_total = 0;/* The type of sector size is unsigned long in kernel source */
     int entry = ctx->entry;
     int i;
     int num_map = 2;/* write, read */
@@ -138,7 +138,7 @@
         else {
             /* Overflow */
             read_total += ctx->read_total[i] +
-                (UINT64_MAX - ctx->prev_read_total[i]);
+                (ULONG_MAX - ctx->prev_read_total[i]);
         }

         if (ctx->write_total[i] >= ctx->prev_write_total[i]) {
@@ -147,9 +147,12 @@
         else {
             /* Overflow */
             write_total += ctx->write_total[i] +
-                (UINT64_MAX - ctx->prev_write_total[i]);
-        }
-    }
+                (ULONG_MAX - ctx->prev_write_total[i]);
+        }
+    }
+
+    read_total  *= 512;
+    write_total *= 512;

     msgpack_pack_array(&i_ins->mp_pck, 2);
     msgpack_pack_uint64(&i_ins->mp_pck, time(NULL));


in_head: release sbuffer at cb_exit

in_head: release sbuffer at cb_exit

Signed-off-by: Takahiro YAMASHITA <8b9f03f78cb27351a99f79113f99e589b65190d5@gmail.com>

--- plugins/in_head/in_head.c
+++ plugins/in_head/in_head.c
@@ -228,6 +228,8 @@
     (void) *config;
     struct flb_in_head_config *head_config = data;

+    msgpack_sbuffer_destroy(&head_config->mp_sbuf);
+
     delete_head_config(head_config);

     return 0;


USB: add picdem device to ldusb

USB: add picdem device to ldusb

Hi Greg:

I have found that  /drivers/usb/misc/ldusb.c  works with the "PICDEM Full
Speed USB"
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en021940

Signed-off-by: Joey S Goncalves <fbb595f050cc4d34438cf1adc10bac348305484a@peragrin.com>
Cc: Michael Hund <4621569a13e0890fe477cc989afb7fcf57cd4069@LD-Didactic.de>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/usb/misc/ldusb.c
+++ drivers/usb/misc/ldusb.c
@@ -62,6 +62,8 @@
 #define USB_DEVICE_ID_VERNIER_SKIP	0x0003
 #define USB_DEVICE_ID_VERNIER_CYCLOPS	0x0004

+#define USB_VENDOR_ID_MICROCHIP		0x04d8
+#define USB_DEVICE_ID_PICDEM		0x000c

 #ifdef CONFIG_USB_DYNAMIC_MINORS
 #define USB_LD_MINOR_BASE	0
@@ -89,6 +91,7 @@
 	{ USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP) },
 	{ USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) },
 	{ USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_CYCLOPS) },
+	{ USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICDEM) },
 	{ }					/* Terminating entry */
 };
 MODULE_DEVICE_TABLE(usb, ld_usb_table);


fix for C89

fix for C89

--- bench.c
+++ bench.c
@@ -21,6 +21,7 @@
 int main(void) {
     const long input_size = strlen(INPUT);

+    int i;
     char *res;
     int size_of_res = sizeof(char) * strlen(INPUT) * 6 + 1;
     res = (char *)malloc(size_of_res);
@@ -28,7 +29,7 @@
     float phe_elapsed;
     {
         time_t begin = clock();
-        for (int i = 0; i < 10000000; i++) {
+        for (i = 0; i < 10000000; i++) {
             phe_escape_html(res, INPUT, input_size);
         }
         time_t end = clock();
@@ -39,7 +40,7 @@
     float simple_elapsed;
     {
         time_t begin = clock();
-        for (int i = 0; i < 10000000; i++) {
+        for (i = 0; i < 10000000; i++) {
             simple_escape_html(res, INPUT, input_size);
         }
         time_t end = clock();


video: simplefb: use dev_get_platdata()

video: simplefb: use dev_get_platdata()

Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly. This is a cosmetic change
to make the code simpler and enhance the readability.

Signed-off-by: Jingoo Han <fc379137a64feb86ce38ec5811a14280acc1ccfc@samsung.com>
Signed-off-by: Tomi Valkeinen <e1ca4dbb8be1acaf20734fecd2da10ed1d46a9bb@ti.com>


[POWERPC] XilinxFB: Make missing pdata structure non-fatal

Missing pdata structure is not a fatal error.  The device can still be
initialized without it.

Signed-off-by: Grant Likely <9069e6f5a2b566e2674a0ba1e2bf39c12c195fad@secretlab.ca>

--- drivers/video/xilinxfb.c
+++ drivers/video/xilinxfb.c
@@ -349,15 +349,9 @@
 {
 	struct xilinxfb_platform_data *pdata;
 	struct resource *res;
-	int width_mm;
-	int height_mm;
-	int rotate;
-
-	pdata = pdev->dev.platform_data;
-	if (!pdata) {
-		dev_err(&pdev->dev, "Missing pdata structure\n");
-		return -ENODEV;
-	}
+	int width_mm = 0;
+	int height_mm = 0;
+	int rotate = 0;

 	/* Find the registers address */
 	res = platform_get_resource(pdev, IORESOURCE_IO, 0);
@@ -366,9 +360,13 @@
 		return -ENODEV;
 	}

-	height_mm = pdata->screen_height_mm;
-	width_mm = pdata->screen_width_mm;
-	rotate = pdata->rotate_screen ? 1 : 0;
+	/* If a pdata structure is provided, then extract the parameters */
+	pdata = pdev->dev.platform_data;
+	if (pdata) {
+		height_mm = pdata->screen_height_mm;
+		width_mm = pdata->screen_width_mm;
+		rotate = pdata->rotate_screen ? 1 : 0;
+	}

 	return xilinxfb_assign(&pdev->dev, res->start, width_mm, height_mm,
 			       rotate);


Better test for presence of __sync_swap().

--- gc_boehm.c
+++ gc_boehm.c
@@ -58,7 +58,10 @@
 #include <gc/gc.h>
 #include <gc/gc_typed.h>

-#ifndef __clang__
+#ifndef __has_builtin
+#	define __has_builtin(x) 0
+#endif
+#if __has_builtin(__sync_swap)
 #define __sync_swap __sync_lock_test_and_set
 #endif


Extend the documentation a little

Extend the documentation a little

svn path=/trunk/KDE/kdelibs/interfaces/ktexteditor/; revision=981963

--- ktexteditor/codecompletionmodelcontrollerinterface.h
+++ ktexteditor/codecompletionmodelcontrollerinterface.h
@@ -139,7 +139,7 @@
      * This function decides if the completion should be aborted.
      * Called after every change to the range (eg. when user entered text)
      *
-     * The default implementation will return true when any special character was entered.
+     * The default implementation will return true when any special character was entered, or when the range is empty.
      *
      * The smart-mutex is not locked when this is called.
      *
@@ -171,7 +171,7 @@
   public:
     enum MatchReaction {
       None,
-      HideListIfAutomaticInvocation
+      HideListIfAutomaticInvocation /** If this is returned, the completion-list is hidden if it was invoked automatically */
     };
     /**
      * Called whenever an item in the completion-list perfectly matches the current filter text.


tpm2_evictcontrol: fix bug in password handling

Passing -P to tpm2_evictcontrol exits immediately because of mishandling the
return value of password_util_copy_password.

Fixes #249

Signed-off-by: William Roberts <60148e894dabf0b83bde1d460768794cd453c455@intel.com>

--- tools/tpm2_evictcontrol.c
+++ tools/tpm2_evictcontrol.c
@@ -155,7 +155,7 @@
         case 'P': {
             bool result = password_util_copy_password(optarg, "authenticating",
                     &ctx->session_data.hmac);
-            if (result) {
+            if (!result) {
                 return false;
             }
             flags.P = 1;


u_calculator 1.1.2: port to librmc-1.3.0 types

--- src/utils/u_calculator.c
+++ src/utils/u_calculator.c
@@ -10,7 +10,7 @@
 #include "constants.h"

 const char* package = "u_s calculator";
-const char* version = "1.1.1";
+const char* version = "1.1.2";
 const char* progname = NULL;

 /* indexes of two elements to multiply */
@@ -156,13 +156,13 @@
         }
         switch (k) {
         case 'p':
-            sscanf(optarg, "%lu", &p);
+            sscanf(optarg, "%u", &p);
             break;
         case 'l':
-            sscanf(optarg, "%lu", &l);
+            sscanf(optarg, "%u", &l);
             break;
         case 'L':
-            sscanf(optarg, "%lu", &lambda);
+            sscanf(optarg, "%u", &lambda);
             break;
         case 'i':
             sscanf(optarg, "%llu", &i);


unittests: Fix printf float test BUFSIZE

Fixes the following error from GCC 7.2.0 with a recent newlib

In file included from /usr/arm-none-eabi/include/stdio.h:800:0,
                 from /home/jgn/work/src/riot/tests/unittests/tests-printf_float/tests-printf_float.c:21:
/home/jgn/work/src/riot/tests/unittests/tests-printf_float/tests-printf_float.c: In function ‘sfprintf_float’:
/home/jgn/work/src/riot/tests/unittests/tests-printf_float/tests-printf_float.c:39:28: error: ‘%f’ directive output truncated writing 11 bytes into a region of size 10 [-Werror=format-truncation=]
     snprintf(str, BUFSIZE, "%f", in0);
                            ^
/home/jgn/work/src/riot/tests/unittests/tests-printf_float/tests-printf_float.c:39:5: note: ‘__builtin_snprintf’ output 12 bytes into a destination of size 10
     snprintf(str, BUFSIZE, "%f", in0);
     ^
cc1: all warnings being treated as errors

--- tests/unittests/tests-printf_float/tests-printf_float.c
+++ tests/unittests/tests-printf_float/tests-printf_float.c
@@ -25,7 +25,7 @@

 #include "tests-printf_float.h"

-#define BUFSIZE             (10)
+#define BUFSIZE             (12)

 static const double in0 = 2016.0349;
 static const double in1 = 123.4567;
@@ -37,7 +37,7 @@
     char *str = tmp;

     snprintf(str, BUFSIZE, "%f", in0);
-    TEST_ASSERT_EQUAL_STRING("2016.0349", str);
+    TEST_ASSERT_EQUAL_STRING("2016.034900", str);

     snprintf(str, BUFSIZE, "%.2f", in0);
     TEST_ASSERT_EQUAL_STRING("2016.03", str);


Escape both the `in` and `out` characters in the `parenthetical()` function.

--- generate.c
+++ generate.c
@@ -272,12 +272,12 @@
     for ( indent=1,size=0; indent; size++ ) {
 	if ( (c = pull(f)) == EOF )
 	    return EOF;
+	else if ( (c == '\\') && (peek(f,1) == out || peek(f,1) == in) ) {
+	    ++size;
+	    pull(f);
+	}
 	else if ( c == in )
 	    ++indent;
-	else if ( (c == '\\') && (peek(f,1) == out) ) {
-	    ++size;
-	    pull(f);
-	}
 	else if ( c == out )
 	    --indent;
     }


fixed a double free()

fixed a double free()

git-svn-id: 9f3514be25e8c4f808c923faecc75db62e18396e@2086 ce7afbd9-0f25-0410-bca2-9054d3de1fdb

--- einit/src/modules/mount.c
+++ einit/src/modules/mount.c
@@ -978,7 +978,10 @@
     free (comb);
    }

-   free (tmp_split);
+   if (tmp_split) {
+    free (tmp_split);
+    tmp_split = NULL;
+   }

 /* same game, but with the device and not the mountpoint */
    struct stree *t = streefind (((struct device_data *)(s->value))->mountpoints, s->key, tree_find_first);
@@ -1006,7 +1009,6 @@

    tmpxt = (char **)setadd ((void **)tmpxt, (void *)"root", SET_TYPE_STRING);

-
    if (tmpxt) {
     tmpx = set2str ('|', (const char **)tmpxt);
    }
@@ -1017,7 +1019,11 @@
     free (tmpx);
    }

-   free (tmp_split);
+   if (tmp_split) {
+    free (tmp_split);
+    tmp_split = NULL;
+   }
+
 //   free (tmpxt);
   }


added new file

added new file

git-svn-id: e171abefef93db0a74257c7d87d5b6400fe00c1f@2856 f22100f3-aa73-48fe-a4fb-fd497bb32605

--- trunk/extension/include/wx/extension/report/report.h
+++ trunk/extension/include/wx/extension/report/report.h
@@ -1,6 +1,6 @@
 /******************************************************************************\
 * File:          report.h
-* Purpose:       Include file for most all wxExtension report classes
+* Purpose:       Include file for all wxExtension report classes
 * Author:        Anton van Wezenbeek
 * RCS-ID:        $Id$
 *
@@ -18,6 +18,7 @@
 #include <wx/extension/report/frame.h>
 #include <wx/extension/report/listitem.h>
 #include <wx/extension/report/listview.h>
+#include <wx/extension/report/listviewfile.h>
 #include <wx/extension/report/process.h>
 #include <wx/extension/report/stc.h>
 #include <wx/extension/report/textfile.h>


Update RandMath.h

Update RandMath.h

--- math/RandMath.h
+++ math/RandMath.h
@@ -42,7 +42,7 @@
 /**
  * @brief factorial
  * Calculate n! using table values for small n <= 255
- * and Moivre-Stirling formula for large n > 255
+ * and built-in gamma function for large n > 255
  * @param n non-negative integer number
  * @return n!
  */


Added functions to multiply arrays in place.

--- rsl/IECoreRI/ArrayAlgo.h
+++ rsl/IECoreRI/ArrayAlgo.h
@@ -117,4 +117,26 @@
 	return 1;
 }

+/// Multiplies all the elements of an array in place.
+void ieArrayMultiply( output color array[]; color multiplier )
+{
+	uniform float l = ieArrayLength( array );
+	uniform float i = 0;
+	for( i=0; i<l; i+=1 )
+	{
+		array[i] *= multiplier;
+	}
+}
+
+/// Multiplies all the elements of an array in place.
+void ieArrayMultiply( output float array[]; float multiplier )
+{
+	uniform float l = ieArrayLength( array );
+	uniform float i = 0;
+	for( i=0; i<l; i+=1 )
+	{
+		array[i] *= multiplier;
+	}
+}
+
 #endif // IECORERI_ARRAYALGO_H


Capitalization, header level adjustment

Capitalization, header level adjustment

--- rtos/ConditionVariable.h
+++ rtos/ConditionVariable.h
@@ -53,7 +53,7 @@
  * - Acquire a lock on the mutex used to construct the condition variable.
  * - Execute `notify_one` or `notify_all` on the condition variable.
  *
- * ### Defined behavior
+ * #### Defined behavior
  * - All threads waiting on the condition variable wake when
  *   `ConditionVariable::notify_all` is called.
  * - At least one thread waiting on the condition variable wakes
@@ -63,18 +63,18 @@
  * - The ConditionVariable reacquires the mutex lock before exiting the wait
  *   function.
  *
- * ### Undefined behavior
+ * #### Undefined behavior
  * - The thread that is unblocked on `ConditionVariable::notify_one` is
  *   undefined if there are multiple waiters.
  * - Calling wait if the mutex is not locked by the current thread is undefined
  *   behavior.
  * - The order in which waiting threads acquire the condition variable's
- *   mutex after ConditionVariable::notify_all is called is undefined.
- * - When ConditionVariable::notify_one or ConditionVariable::notify_all is
+ *   mutex after `ConditionVariable::notify_all` is called is undefined.
+ * - When `ConditionVariable::notify_one` or `ConditionVariable::notify_all` is
  *   called and there are one or more waiters, and one or more threads
  *   attempting to acquire the condition variable's mutex, the order in which the mutex is
  *   acquired is undefined.
- * - The behavior of ConditionVariable::wait and ConditionVariable::wait_for
+ * - The behavior of `ConditionVariable::wait` and `ConditionVariable::wait_for`
  *   is undefined if the condition variable's mutex is locked more than once by
  *   the calling thread.
  * - Spurious notifications (not triggered by the application) can occur,
@@ -194,8 +194,8 @@
      * variable is notified, or a specific time given by millisec parameter is
      * reached.
      *
-     * @param   millisec  absolute end time referenced to Kernel::get_ms_count()
-     * @return  true if a timeout occurred, false otherwise.
+     * @param   millisec  Absolute end time referenced to `Kernel::get_ms_count()`
+     * @return  True if a timeout occurred, false otherwise.
      *
      * @note - The thread calling this function must be the owner of the
      * ConditionVariable's mutex, and it must be locked exactly once.
@@ -205,7 +205,7 @@
      * been met.
      *
      * @note - The current thread releases the lock while inside the wait
-     * function and reacquire it upon exiting the function.
+     * function and reacquires it upon exiting the function.
      *
      * Example:
      * @code
@@ -235,8 +235,8 @@
      * variable receives a notification from another thread, or the timeout
      * specified by the millisec parameter is reached.
      *
-     * @param   millisec  timeout value or osWaitForever in case of no timeout.
-     * @return  true if a timeout occurred, false otherwise.
+     * @param   millisec  Timeout value or osWaitForever in case of no timeout.
+     * @return  True if a timeout occurred, false otherwise.
      *
      * @note - The thread calling this function must be the owner of the
      * ConditionVariable's mutex, and it must be locked exactly once.


Coverity: fix possible leak.

Coverity: fix possible leak.

git-svn-id: acec3fd5b7ea1eb9e79d6329d318e8118ee2e14f@44562 27541ba8-7e3a-0410-8455-c3a389f83636

--- graf2d/asimage/src/libAfterImage/bmp.c
+++ graf2d/asimage/src/libAfterImage/bmp.c
@@ -515,7 +515,10 @@
 		size_t ret;
 		cmap = safemalloc( cmap_entries * cmap_entry_size );
 		ret = fread(cmap, sizeof (CARD8), cmap_entries * cmap_entry_size, infile);
-		if (ret != cmap_entries * cmap_entry_size) return NULL;
+		if (ret != cmap_entries * cmap_entry_size) {
+         if (cmap) free(cmap);
+		   return NULL;
+	   }
 	}

 	if( add_colormap )


tests: Bluetooth: bsim_advx_test: Add some tests for scan response

This adds few tests for handling scan response in ext commands:
- trying to set scan response on non-scannable instance should fail
- it should be possible to create scannable instance, set scan data,
  enable and then disable set

Signed-off-by: Andrzej Kaczmarek <e629a10adbe722145f074acb1ca27e72d94cfcb5@codecoup.pl>

--- tests/bluetooth/bsim_bt/bsim_test_advx/src/main.c
+++ tests/bluetooth/bsim_bt/bsim_test_advx/src/main.c
@@ -23,6 +23,7 @@
 #include "bstests.h"

 #define HANDLE          0x0000
+#define EVT_PROP_SCAN   BIT(1)
 #define EVT_PROP_ANON   BIT(5)
 #define EVT_PROP_TXP    BIT(6)
 #define ADV_INTERVAL    0x20
@@ -80,6 +81,10 @@
 		2, BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR),
 	};

+static uint8_t sr_data[] = {
+		7, BT_DATA_NAME_COMPLETE, 'Z', 'e', 'p', 'h', 'y', 'r',
+	};
+
 static struct bt_conn *default_conn;
 static bool volatile is_connected, is_disconnected;

@@ -474,6 +479,58 @@
 		goto exit;
 	}
 	printk("success.\n");
+
+	printk("Adding scan response data on non-scannable set...");
+	err = ll_adv_aux_sr_data_set(handle, AD_OP, AD_FRAG_PREF,
+				     sizeof(sr_data), (void *)sr_data);
+	if (err != BT_HCI_ERR_INVALID_PARAM) {
+		goto exit;
+	}
+	printk("success.\n");
+
+	printk("Removing adv aux set that's created and disabled ...");
+	err = ll_adv_aux_set_remove(handle);
+	if (err) {
+		goto exit;
+	}
+	printk("success.\n");
+
+	printk("Creating new adv set (scannable)...");
+	err = ll_adv_params_set(handle, EVT_PROP_SCAN, ADV_INTERVAL, adv_type,
+				OWN_ADDR_TYPE, PEER_ADDR_TYPE, PEER_ADDR,
+				ADV_CHAN_MAP, FILTER_POLICY, ADV_TX_PWR,
+				phy_p, ADV_SEC_SKIP, phy_s, ADV_SID,
+				SCAN_REQ_NOT);
+	if (err) {
+		goto exit;
+	}
+	printk("success.\n");
+
+	printk("Adding scan response data...");
+	err = ll_adv_aux_sr_data_set(handle, AD_OP, AD_FRAG_PREF,
+				     sizeof(sr_data), (void *)sr_data);
+	if (err) {
+		goto exit;
+	}
+	printk("success.\n");
+
+	printk("Enabling non-conn scan with scan response data...");
+	err = ll_adv_enable(handle, 1, 0, 0);
+	if (err) {
+		goto exit;
+	}
+	printk("success.\n");
+
+	k_sleep(K_MSEC(400));
+
+	printk("Disabling...");
+	err = ll_adv_enable(handle, 0, 0, 0);
+	if (err) {
+		goto exit;
+	}
+	printk("success.\n");
+
+	k_sleep(K_MSEC(400));

 	printk("Removing adv aux set that's created and disabled ...");
 	err = ll_adv_aux_set_remove(handle);


Removed unnecessary #include statement

Removed unnecessary #include statement

This was removed by the following commit in Qt:
0c8d49ca Added support for video surfaces to Phonon MMF backend

For some reason this change was not propagated to the Phonon
repository.  This commit brings the two repositories in sync.

Reviewed-by: trustme

--- mmf/abstractaudioeffect.h
+++ mmf/abstractaudioeffect.h
@@ -28,7 +28,6 @@
 #include "audioplayer.h"
 #include "effectparameter.h"
 #include "mmf_medianode.h"
-#include "mmf_videoplayer.h"

 class CMdaAudioOutputStream;


emage jpeg: better code

emage jpeg: better code

--- emage/modules/emage_jpg.c
+++ emage/modules/emage_jpg.c
@@ -224,22 +224,38 @@
 	cinfo.dct_method = JDCT_ISLOW; // JDCT_FLOAT JDCT_IFAST(quality loss)
 	cinfo.dither_mode = JDITHER_ORDERED;

+	switch (cinfo.jpeg_color_space)
+	{
+	 case JCS_RGB:
+	 case JCS_YCbCr:
+		 cinfo.out_color_space = JCS_RGB;
+		 break;
+	 case JCS_CMYK:
+	 case JCS_YCCK:
+		 cinfo.out_color_space = JCS_CMYK;
+		 break;
+	 case JCS_GRAYSCALE:
+	 case JCS_UNKNOWN:
+	 default:
+		 break;
+	}
+
 	jpeg_calc_output_dimensions(&(cinfo));
 	jpeg_start_decompress(&cinfo);

 	enesim_buffer_data_get(buffer, &data);
-	sdata = data.argb8888.plane0;
+	sdata = data.bgr888.plane0;

 	stride = cinfo.output_width * cinfo.output_components;
 	row = (*cinfo.mem->alloc_sarray)
 		((j_common_ptr) &cinfo, JPOOL_IMAGE, stride, 1);
 	line = (uint8_t *)sdata;
-	printf(" %d %d\n", stride, data.argb8888.plane0_stride);
+	printf(" %d %d\n", stride, data.bgr888.plane0_stride);
 	while (cinfo.output_scanline < cinfo.output_height)
 	{
 		row[0] = line;
 		jpeg_read_scanlines(&cinfo, row, 1);
-		line += data.argb8888.plane0_stride;
+		line += data.bgr888.plane0_stride;
 	}
 	jpeg_destroy_decompress(&cinfo);
 	fclose(f);


add: 389 solution

add: 389 solution

error: pathspec '389_Find_the_Difference_1.c' did not match any file(s) known to git

--- 389_Find_the_Difference_1.c
+++ 389_Find_the_Difference_1.c
@@ -0,0 +1,25 @@
+char findTheDifference(char* s, char* t)
+{
+    unsigned int count[26] = {0};
+    int i;
+
+    while(*t)
+    {
+        count[*(t++) - 'a']++;
+    }
+
+    while(*s)
+    {
+        count[*(s++) - 'a']--;
+    }
+
+    for(i = 0; i < 26; i++)
+    {
+        if(count[i])
+        {
+            break;
+        }
+    }
+
+    return i + 'a';
+}


py, compile: Reduce size of compiler structure.

--- py/compile.c
+++ py/compile.c
@@ -50,12 +50,12 @@
     int break_continue_except_level;
     uint16_t cur_except_level; // increased for SETUP_EXCEPT, SETUP_FINALLY; decreased for POP_BLOCK, POP_EXCEPT

-    int n_arg_keyword;
+    uint16_t n_arg_keyword;
     uint8_t star_flags;
-    bool have_bare_star;
-    int param_pass;
-    int param_pass_num_dict_params;
-    int param_pass_num_default_params;
+    uint8_t have_bare_star;
+    uint8_t param_pass;
+    uint16_t param_pass_num_dict_params;
+    uint16_t param_pass_num_default_params;

     scope_t *scope_head;
     scope_t *scope_cur;
@@ -905,10 +905,10 @@
     }

     // save variables (probably don't need to do this, since we can't have nested definitions..?)
-    bool old_have_bare_star = comp->have_bare_star;
-    int old_param_pass = comp->param_pass;
-    int old_param_pass_num_dict_params = comp->param_pass_num_dict_params;
-    int old_param_pass_num_default_params = comp->param_pass_num_default_params;
+    uint old_have_bare_star = comp->have_bare_star;
+    uint old_param_pass = comp->param_pass;
+    uint old_param_pass_num_dict_params = comp->param_pass_num_dict_params;
+    uint old_param_pass_num_default_params = comp->param_pass_num_default_params;

     // compile default parameters

@@ -2223,7 +2223,7 @@
     }
 #endif

-    int old_n_arg_keyword = comp->n_arg_keyword;
+    uint old_n_arg_keyword = comp->n_arg_keyword;
     uint old_star_flags = comp->star_flags;
     comp->n_arg_keyword = 0;
     comp->star_flags = 0;


Use default constructor for read_type.

Use default constructor for read_type.

--- types/include/type/view.h
+++ types/include/type/view.h
@@ -116,7 +116,7 @@
 	struct read_type {
 		friend class view_type;
 	public:
-		read_type() : view(nullptr) {}
+		read_type() = default;
 		read_type(const read_type &) = delete;
 		read_type(read_type &&) = default;
 		read_type &operator=(const read_type &) = delete;


suggest: add learner_ prefix

suggest: add learner_ prefix

--- plugins/suggest/suggest.c
+++ plugins/suggest/suggest.c
@@ -720,7 +720,8 @@
 }

 static void
-learn_for_complete_and_correcnt(grn_ctx *ctx, grn_suggest_learner *learner)
+learner_learn_for_complete_and_correcnt(grn_ctx *ctx,
+                                        grn_suggest_learner *learner)
 {
   grn_obj *pre_item, *post_item, *pre_events;
   grn_obj pre_type, pre_time;
@@ -774,7 +775,7 @@
 }

 static void
-learn_for_suggest(grn_ctx *ctx, grn_suggest_learner *learner)
+learner_learn_for_suggest(grn_ctx *ctx, grn_suggest_learner *learner)
 {
   char keybuf[GRN_TABLE_MAX_KEY_SIZE];
   int keylen = grn_table_get_key(ctx, learner->items, learner->post_item_id,
@@ -823,8 +824,8 @@
     if (learner->post_type_id) {
       learner_init_submit_learn(ctx, learner);
       learner_increment_item_freq(ctx, learner, learner->items_freq2);
-      learn_for_complete_and_correcnt(ctx, learner);
-      learn_for_suggest(ctx, learner);
+      learner_learn_for_complete_and_correcnt(ctx, learner);
+      learner_learn_for_suggest(ctx, learner);
       learner_fin_submit_learn(ctx, learner);
     }
     learner_append_post_event(ctx, learner);


時間切れinvoice削除後のcommit忘れ

時間切れinvoice削除後のcommit忘れ

--- ucoin/src/ln/ln_db_lmdb.c
+++ ucoin/src/ln/ln_db_lmdb.c
@@ -1184,7 +1184,7 @@
         lmdb_cursor_t *p_cur = (lmdb_cursor_t *)pCur;
         mdb_cursor_close(p_cur->cursor);
         if (p_cur->txn != NULL) {
-            MDB_TXN_ABORT(p_cur->txn);
+            MDB_TXN_COMMIT(p_cur->txn);
         }
     }
 }


Remove unused typedef (traits<MatrixPowerProduct>::PlainObject) for brevity.

--- unsupported/Eigen/src/MatrixFunctions/MatrixPowerBase.h
+++ unsupported/Eigen/src/MatrixFunctions/MatrixPowerBase.h
@@ -152,7 +152,6 @@
   typedef MatrixXpr XprKind;
   typedef typename remove_all<_Lhs>::type Lhs;
   typedef typename remove_all<_Rhs>::type Rhs;
-  typedef typename remove_all<MatrixPowerProduct<Derived,_Lhs,_Rhs> >::type PlainObject;
   typedef typename scalar_product_traits<typename Lhs::Scalar, typename Rhs::Scalar>::ReturnType Scalar;
   typedef Dense StorageKind;
   typedef typename promote_index_type<typename Lhs::Index, typename Rhs::Index>::type Index;


26 dgraph in STL, compile and unit test pass

error: pathspec 'Libs/Core/Testing/Cpp/ctkDependencyGraphTestHelper.h' did not match any file(s) known to git

--- Libs/Core/Testing/Cpp/ctkDependencyGraphTestHelper.h
+++ Libs/Core/Testing/Cpp/ctkDependencyGraphTestHelper.h
@@ -0,0 +1,46 @@
+/*=========================================================================
+
+  Library:   CTK
+
+  Copyright (c) Kitware Inc.
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0.txt
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+=========================================================================*/
+
+#ifndef __ctkDependencyGraphTestHelper_h
+#define __ctkDependencyGraphTestHelper_h
+
+#include <list>
+#include <iostream>
+
+namespace
+{
+
+void printIntegerList(const char* msg, const std::list<int>& list, bool endl = true)
+{
+  std::cerr << msg;
+  std::list<int>::const_iterator iter;
+  for (iter = list.begin(); iter != list.end(); iter++)
+    {
+    std::cerr << *iter << " ";
+    }
+  if (endl)
+    {
+    std::cerr << std::endl;
+    }
+}
+
+}
+
+#endif // end __ctkDependencyGraphTestHelper_h


py/ringbuf.h: Add reusable ring buffer class.

Features inline get/put operations for the highest performance. Locking
is not part of implementation, operation should be wrapped with locking
externally as needed.

error: pathspec 'py/ringbuf.h' did not match any file(s) known to git

--- py/ringbuf.h
+++ py/ringbuf.h
@@ -0,0 +1,72 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2016 Paul Sokolovsky
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#ifndef __MICROPY_INCLUDED_PY_RINGBUF_H__
+#define __MICROPY_INCLUDED_PY_RINGBUF_H__
+
+typedef struct _ringbuf_t {
+    uint8_t *buf;
+    uint16_t size;
+    uint16_t iget;
+    uint16_t iput;
+} ringbuf_t;
+
+// Static initalization:
+// byte buf_array[N];
+// ringbuf_t buf = {buf_array, sizeof(buf_array)};
+
+// Dynamic initialization. This creates root pointer!
+#define ringbuf_alloc(r, sz) \
+{ \
+    (r)->buf = m_new(uint8_t, sz); \
+    (r)->size = sz; \
+    (r)->iget = (r)->iput = 0; \
+}
+
+static inline int ringbuf_get(ringbuf_t *r) {
+    if (r->iget == r->iput) {
+        return -1;
+    }
+    uint8_t v = r->buf[r->iget++];
+    if (r->iget >= r->size) {
+        r->iget = 0;
+    }
+    return v;
+}
+
+static inline int ringbuf_put(ringbuf_t *r, uint8_t v) {
+    uint32_t iput_new = r->iput + 1;
+    if (iput_new >= r->size) {
+        iput_new = 0;
+    }
+    if (iput_new == r->iget) {
+        return -1;
+    }
+    r->buf[r->iput] = v;
+    r->iput = iput_new;
+    return 0;
+}
+
+#endif // __MICROPY_INCLUDED_PY_RINGBUF_H__


py: Minor improvement to unichar_isxdigit

This drops the size of unicode_isxdigit from 0x1e + 0x02 filler to
0x14 bytes (so net code reduction of 12 bytes) and will make
unicode_is_xdigit perform slightly faster.

--- py/unicode.c
+++ py/unicode.c
@@ -35,14 +35,17 @@
 #define FL_ALPHA (0x08)
 #define FL_UPPER (0x10)
 #define FL_LOWER (0x20)
+#define FL_XDIGIT (0x40)

 // shorthand character attributes
 #define AT_PR (FL_PRINT)
 #define AT_SP (FL_SPACE | FL_PRINT)
-#define AT_DI (FL_DIGIT | FL_PRINT)
+#define AT_DI (FL_DIGIT | FL_PRINT | FL_XDIGIT)
 #define AT_AL (FL_ALPHA | FL_PRINT)
 #define AT_UP (FL_UPPER | FL_ALPHA | FL_PRINT)
 #define AT_LO (FL_LOWER | FL_ALPHA | FL_PRINT)
+#define AT_UX (FL_UPPER | FL_ALPHA | FL_PRINT | FL_XDIGIT)
+#define AT_LX (FL_LOWER | FL_ALPHA | FL_PRINT | FL_XDIGIT)

 // table of attributes for ascii characters
 STATIC const uint8_t attr[] = {
@@ -54,11 +57,11 @@
     AT_PR, AT_PR, AT_PR, AT_PR, AT_PR, AT_PR, AT_PR, AT_PR,
     AT_DI, AT_DI, AT_DI, AT_DI, AT_DI, AT_DI, AT_DI, AT_DI,
     AT_DI, AT_DI, AT_PR, AT_PR, AT_PR, AT_PR, AT_PR, AT_PR,
-    AT_PR, AT_UP, AT_UP, AT_UP, AT_UP, AT_UP, AT_UP, AT_UP,
+    AT_PR, AT_UX, AT_UX, AT_UX, AT_UX, AT_UX, AT_UX, AT_UP,
     AT_UP, AT_UP, AT_UP, AT_UP, AT_UP, AT_UP, AT_UP, AT_UP,
     AT_UP, AT_UP, AT_UP, AT_UP, AT_UP, AT_UP, AT_UP, AT_UP,
     AT_UP, AT_UP, AT_UP, AT_PR, AT_PR, AT_PR, AT_PR, AT_PR,
-    AT_PR, AT_LO, AT_LO, AT_LO, AT_LO, AT_LO, AT_LO, AT_LO,
+    AT_PR, AT_LX, AT_LX, AT_LX, AT_LX, AT_LX, AT_LX, AT_LO,
     AT_LO, AT_LO, AT_LO, AT_LO, AT_LO, AT_LO, AT_LO, AT_LO,
     AT_LO, AT_LO, AT_LO, AT_LO, AT_LO, AT_LO, AT_LO, AT_LO,
     AT_LO, AT_LO, AT_LO, AT_PR, AT_PR, AT_PR, AT_PR, 0
@@ -139,7 +142,7 @@
 }

 bool unichar_isxdigit(unichar c) {
-    return unichar_isdigit(c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
+    return c < 128 && (attr[c] & FL_XDIGIT) != 0;
 }

 /*


zlibWrapper: better description of ZWRAP_useZSTDcompression

--- zlibWrapper/zstd_zlibwrapper.h
+++ zlibWrapper/zstd_zlibwrapper.h
@@ -30,7 +30,13 @@

 /*** COMPRESSION ***/
-/* enables/disables zstd compression during runtime */
+/* ZWRAP_useZSTDcompression() enables/disables zstd compression during runtime.
+   By default zstd compression is disabled. To enable zstd compression please use one of the methods:
+   - compilation with the additional option -DZWRAP_USE_ZSTD=1
+   - using '#define ZWRAP_USE_ZSTD 1' in source code before '#include "zstd_zlibwrapper.h"'
+   - calling ZWRAP_useZSTDcompression(1)
+   All above-mentioned methods will enable zstd compression for all threads.
+   Be aware that ZWRAP_useZSTDcompression() is not thread-safe and may lead to a race condition. */
 void ZWRAP_useZSTDcompression(int turn_on);

 /* checks if zstd compression is turned on */
@@ -54,7 +60,11 @@
 /*** DECOMPRESSION ***/
 typedef enum { ZWRAP_FORCE_ZLIB, ZWRAP_AUTO } ZWRAP_decompress_type;

-/* enables/disables automatic recognition of zstd/zlib compressed data during runtime */
+/* ZWRAP_setDecompressionType() enables/disables automatic recognition of zstd/zlib compressed data during runtime.
+   By default auto-detection of zstd and zlib streams in enabled (ZWRAP_AUTO).
+   Forcing zlib decompression with ZWRAP_setDecompressionType(ZWRAP_FORCE_ZLIB) slightly improves
+   decompression speed of zlib-encoded streams.
+   Be aware that ZWRAP_setDecompressionType() is not thread-safe and may lead to a race condition. */
 void ZWRAP_setDecompressionType(ZWRAP_decompress_type type);

 /* checks zstd decompression type */


#define z_const if not defined

#define z_const if not defined

--- zlibWrapper/zstd_zlibwrapper.h
+++ zlibWrapper/zstd_zlibwrapper.h
@@ -40,6 +40,9 @@
 #define Z_PREFIX
 #include <zlib.h>

+#if !defined(z_const)
+#  define z_const const
+#endif

 void useZSTD(int turn_on);
 int isUsingZSTD();


Fix - Can't apply folder setting from category.

--- uget-gtk/UgDownloadForm.c
+++ uget-gtk/UgDownloadForm.c
@@ -600,7 +600,10 @@
 	combo = GTK_COMBO_BOX (dform->folder_combo);
 	for (;  folder_list;  folder_list = folder_list->next)
 		gtk_combo_box_append_text (combo, folder_list->data);
+	// set default folder
+	dform->changed.enable = FALSE;
 	gtk_combo_box_set_active (combo, 0);
+	dform->changed.enable = TRUE;
 }

 void	ug_download_form_get_folder_list (UgDownloadForm* dform, GList** folder_list)


Move definition of EFI_PARTITION_ENTRY_STATUS from IndustryStandard in MDE Package to implementation of PartitionDxe module.

git-svn-id: 5648d1bec6962b0a6d1d1b40eba8cf5cdb62da3d@6156 6f19259b-4bc3-4df7-8a09-765794883524

--- MdeModulePkg/Universal/Disk/PartitionDxe/Partition.h
+++ MdeModulePkg/Universal/Disk/PartitionDxe/Partition.h
@@ -85,6 +85,15 @@
                                    (((UINT8 *) a)[2] << 16) |    \
                                    (((UINT8 *) a)[3] << 24) )

+
+//
+// GPT Partition Entry Status
+//
+typedef struct {
+  BOOLEAN OutOfRange;
+  BOOLEAN Overlap;
+} EFI_PARTITION_ENTRY_STATUS;
+
 //
 // Function Prototypes
 //


Rewrite function date_conversion

Rewrite function date_conversion

--- pyswisseph.c
+++ pyswisseph.c
@@ -426,24 +426,32 @@
 /* swisseph.date_conversion */
 PyDoc_STRVAR(pyswe_date_conversion__doc__,
 "Calculate Julian day number with check wether date is correct.\n\n"
-"Args: int year, int month, int day, float hour=12.0, char cal='g'\n"
-"Return: tuple (int result, float jd)");
+"Args: int year, int month, int day, float hour=12.0, str cal='g'\n"
+"Return: (int result, float jd)\n\n"
+" - year, month, day: input date\n"
+" - hour: input time, decimal with fraction\n"
+" - cal: calendar type, gregorian (g) or julian (j)\n"
+" - result: is either 0 if the input date and time are legal, else -1\n"
+" - jd: returned Julian day number\n\n"
+"This function can raise an exception (swisseph.Error) if cal is invalid.");

 static PyObject * pyswe_date_conversion FUNCARGS_KEYWDS
 {
     int year, month, day, ret;
     double jd, hour = 12.0;
-    char cal = 'g';
+    char* cal = "g";
+    char c;
     static char *kwlist[] = {"year", "month", "day", "hour", "cal", NULL};
-    if (!PyArg_ParseTupleAndKeywords(args, keywds, "iii|dc", kwlist,
+    if (!PyArg_ParseTupleAndKeywords(args, keywds, "iii|ds", kwlist,
         &year, &month, &day, &hour, &cal))
         return NULL;
-    if (cal != 'g' && cal != 'j') {
-        PyErr_SetString(pyswe_Error,
-            "swisseph.date_conversion: Invalid calendar (g/j)");
-        return NULL;
-    }
-    ret = swe_date_conversion(year, month, day, hour, cal, &jd);
+    c = tolower(cal[0]);
+    if (strlen(cal) != 1 || (c != 'g' && c != 'j')) {
+        PyErr_Format(pyswe_Error, "swisseph.date_conversion:"
+            " Invalid calendar '%s', must be 'g' or 'j'", cal);
+        return NULL;
+    }
+    ret = swe_date_conversion(year, month, day, hour, c, &jd);
     return Py_BuildValue("id", ret, jd);
 }


TCPMv2: Hard reset on PR swap interruption

When a PR swap is interrupted, send a hard reset.  Since Vbus is turning
off, a soft reset wouldn't restore our Vbus and connection state for
this protocol error.

BRANCH=zork
BUG=b:184764468
TEST=on jelboz, connect problematic dock which interrupts PR swap and
ensure connection can recover successfully

Signed-off-by: Diana Z <cb2016afc7183e5356c690dc63b4ba817470501a@chromium.org>
Change-Id: I901c5a99af3f8cfae038d447bac8e0f37fedc9c2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2880811
Reviewed-by: Edward Hill <db1406b34e091703092b6b136bdfeb2c8125fc0e@chromium.org>

--- common/usbc/usb_pe_drp_sm.c
+++ common/usbc/usb_pe_drp_sm.c
@@ -4355,6 +4355,17 @@

 static void pe_prs_src_snk_transition_to_off_run(int port)
 {
+	/*
+	 * This is a non-interruptible AMS and power is transitioning - hard
+	 * reset on interruption.
+	 */
+	if (PE_CHK_FLAG(port, PE_FLAGS_MSG_RECEIVED)) {
+		PE_CLR_FLAG(port, PE_FLAGS_MSG_RECEIVED);
+
+		tc_pr_swap_complete(port, 0);
+		set_state_pe(port, PE_SRC_HARD_RESET);
+	}
+
 	/* Give time for supply to power off */
 	if (pd_timer_is_expired(port, PE_TIMER_PS_SOURCE) &&
 	    pd_check_vbus_level(port, VBUS_SAFE0V))


Improve doc of split_deg().

Improve doc of split_deg().

--- pyswisseph.c
+++ pyswisseph.c
@@ -2566,9 +2566,10 @@

 /* swisseph.split_deg */
 static char pyswe_split_deg__doc__[] =
-"Split centiseconds in degrees, minutes, seconds, fraction of seconds, zodiac sign number.\n\n"
+"Provide sign or nakshatra, degree, minutes, seconds and fraction of second"
+" from decimal degree. Can also round to seconds, minutes, degrees.\n\n"
 "Args: float ddeg, int roundflag\n"
-"Return: tuple";
+"Return: tuple (deg, min, sec, secfr, sign)";

 static PyObject * pyswe_split_deg FUNCARGS_KEYWDS
 {


Adopt commit 7a1ead3 from master: Merge pull request #841 from hversche/revert-changes-to-algorithm

commit 7a1ead3c1496c37164a7443ea4a0cf58373635b5
Merge: a1bd07a 6689ea3
Author: Henry Verschell <hverschell@bloomberg.net>
Date:   Tue Nov 8 00:40:47 2016 -0500

    Merge pull request #841 from hversche/revert-changes-to-algorithm

    Revert additions to bsl_algorithm

commit 6689ea31ed288d83077e17ea219115dd353ef7df
Author: (Henry) Mike Verschell <hverschell@bloomberg.net>
Date:   Tue Nov 8 00:38:45 2016 -0500

    Revert additions to bsl_algorithm

commit a1bd07ab1dfd75816a5de534df94202723cd0902
Author: Henry Verschell <hverschell@bloomberg.net>
Date:   Mon Nov 7 16:00:00 2016 -0500

    Update bsl_algorithm.h

--- groups/bsl/bsl+bslhdrs/bsl_algorithm.h
+++ groups/bsl/bsl+bslhdrs/bsl_algorithm.h
@@ -17,10 +17,6 @@
 // implementation of the C++ standard type (if one exists).  Finally, place the
 // included symbols from the 'std' namespace (if any) into the 'bsl' namespace.

-#ifndef INCLUDED_BSLS_COMPILERFEATURES
-#include <bsls_compilerfeatures.h>
-#endif
-
 #ifndef INCLUDED_BSLS_NATIVESTD
 #include <bsls_nativestd.h>
 #endif
@@ -31,24 +27,13 @@

 #include <algorithm>

-#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_ALGORITHMS
-    #define USING_CPP11_NATIVE_STD(algo) using native_std::algo;
-#else
-    #define USING_CPP11_NATIVE_STD(algo)
-#endif
-
 namespace bsl {

     // Import selected symbols into bsl namespace
-    USING_CPP11_NATIVE_STD(all_of)
     using native_std::adjacent_find;
-    USING_CPP11_NATIVE_STD(any_of)
     using native_std::binary_search;
     using native_std::copy;
     using native_std::copy_backward;
-    USING_CPP11_NATIVE_STD(copy_if)
-    // USING_CPP11_NATIVE_STD(copy_n)
-    // copy_n is implemented separately.

     // 'count' and 'count_if' are provided in 'bslstl_algorithmworkaround' in
     // order to work-around the Sun standard library, libCstd.
@@ -64,18 +49,11 @@
     using native_std::find_end;
     using native_std::find_first_of;
     using native_std::find_if;
-    USING_CPP11_NATIVE_STD(find_if_not)
     using native_std::for_each;
     using native_std::generate;
     using native_std::generate_n;
     using native_std::includes;
     using native_std::inplace_merge;
-    USING_CPP11_NATIVE_STD(iota)
-    USING_CPP11_NATIVE_STD(is_heap)
-    USING_CPP11_NATIVE_STD(is_partitioned)
-    USING_CPP11_NATIVE_STD(is_permutation)
-    USING_CPP11_NATIVE_STD(is_sorted)
-    USING_CPP11_NATIVE_STD(is_sorted_until)
     using native_std::iter_swap;
     using native_std::lexicographical_compare;
     using native_std::lower_bound;
@@ -84,20 +62,13 @@
     using native_std::max_element;
     using native_std::merge;
     using native_std::min;
-    USING_CPP11_NATIVE_STD(minmax)
-    USING_CPP11_NATIVE_STD(minmax_element)
     using native_std::min_element;
     using native_std::mismatch;
-    USING_CPP11_NATIVE_STD(move)
-    USING_CPP11_NATIVE_STD(move_backward)
     using native_std::next_permutation;
-    USING_CPP11_NATIVE_STD(none_of)
     using native_std::nth_element;
     using native_std::partial_sort;
     using native_std::partial_sort_copy;
     using native_std::partition;
-    USING_CPP11_NATIVE_STD(partition_copy)
-    USING_CPP11_NATIVE_STD(partition_point)
     using native_std::pop_heap;
     using native_std::prev_permutation;
     using native_std::push_heap;
@@ -121,7 +92,6 @@
     using native_std::set_new_handler;
     using native_std::set_symmetric_difference;
     using native_std::set_union;
-    USING_CPP11_NATIVE_STD(shuffle)
     using native_std::sort;
     using native_std::sort_heap;
     using native_std::stable_partition;
@@ -129,14 +99,12 @@
     using native_std::swap;
     using native_std::swap_ranges;
     using native_std::transform;
-    USING_CPP11_NATIVE_STD(uninitialized_copy_n)
     using native_std::unique;
     using native_std::unique_copy;
     using native_std::upper_bound;

 }  // close package namespace

-#undef USING_CPP11_NATIVE_STD

 // Include Bloomberg's implementation, unless compilation is configured to
 // override native types in the 'std' namespace with Bloomberg's


Added missing accessors to fixed sized tensors

--- unsupported/Eigen/CXX11/src/Tensor/TensorFixedSize.h
+++ unsupported/Eigen/CXX11/src/Tensor/TensorFixedSize.h
@@ -128,7 +128,6 @@
       return m_storage.data()[0];
     }

-
 #ifdef EIGEN_HAS_VARIADIC_TEMPLATES
     template<typename... IndexTypes>
     EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar& operator()(Index firstIndex, IndexTypes... otherIndices) const
@@ -137,7 +136,53 @@
       EIGEN_STATIC_ASSERT(sizeof...(otherIndices) + 1 == NumIndices, YOU_MADE_A_PROGRAMMING_MISTAKE)
       return this->operator()(array<Index, NumIndices>{{firstIndex, otherIndices...}});
     }
-#endif
+#else
+    EIGEN_DEVICE_FUNC
+    EIGEN_STRONG_INLINE const Scalar& operator()(Index i0, Index i1) const
+    {
+      if (Options&RowMajor) {
+        const Index index = i1 + i0 * m_storage.dimensions()[1];
+        return m_storage.data()[index];
+      } else {
+        const Index index = i0 + i1 * m_storage.dimensions()[0];
+        return m_storage.data()[index];
+      }
+    }
+    EIGEN_DEVICE_FUNC
+    EIGEN_STRONG_INLINE const Scalar& operator()(Index i0, Index i1, Index i2) const
+    {
+      if (Options&RowMajor) {
+         const Index index = i2 + m_storage.dimensions()[2] * (i1 + m_storage.dimensions()[1] * i0);
+         return m_storage.data()[index];
+      } else {
+         const Index index = i0 + m_storage.dimensions()[0] * (i1 + m_storage.dimensions()[1] * i2);
+        return m_storage.data()[index];
+      }
+    }
+    EIGEN_DEVICE_FUNC
+    EIGEN_STRONG_INLINE const Scalar& operator()(Index i0, Index i1, Index i2, Index i3) const
+    {
+      if (Options&RowMajor) {
+        const Index index = i3 + m_storage.dimensions()[3] * (i2 + m_storage.dimensions()[2] * (i1 + m_storage.dimensions()[1] * i0));
+        return m_storage.data()[index];
+      } else {
+        const Index index = i0 + m_storage.dimensions()[0] * (i1 + m_storage.dimensions()[1] * (i2 + m_storage.dimensions()[2] * i3));
+        return m_storage.data()[index];
+      }
+    }
+    EIGEN_DEVICE_FUNC
+    EIGEN_STRONG_INLINE const Scalar& operator()(Index i0, Index i1, Index i2, Index i3, Index i4) const
+    {
+      if (Options&RowMajor) {
+        const Index index = i4 + m_storage.dimensions()[4] * (i3 + m_storage.dimensions()[3] * (i2 + m_storage.dimensions()[2] * (i1 + m_storage.dimensions()[1] * i0)));
+        return m_storage.data()[index];
+      } else {
+        const Index index = i0 + m_storage.dimensions()[0] * (i1 + m_storage.dimensions()[1] * (i2 + m_storage.dimensions()[2] * (i3 + m_storage.dimensions()[3] * i4)));
+        return m_storage.data()[index];
+      }
+    }
+#endif
+

     EIGEN_DEVICE_FUNC
     EIGEN_STRONG_INLINE const Scalar& operator()(const array<Index, NumIndices>& indices) const
@@ -175,6 +220,51 @@
       // The number of indices used to access a tensor coefficient must be equal to the rank of the tensor.
       EIGEN_STATIC_ASSERT(sizeof...(otherIndices) + 1 == NumIndices, YOU_MADE_A_PROGRAMMING_MISTAKE)
       return operator()(array<Index, NumIndices>{{firstIndex, otherIndices...}});
+    }
+#else
+    EIGEN_DEVICE_FUNC
+    EIGEN_STRONG_INLINE Scalar& operator()(Index i0, Index i1)
+    {
+       if (Options&RowMajor) {
+         const Index index = i1 + i0 * m_storage.dimensions()[1];
+        return m_storage.data()[index];
+      } else {
+        const Index index = i0 + i1 * m_storage.dimensions()[0];
+        return m_storage.data()[index];
+      }
+    }
+    EIGEN_DEVICE_FUNC
+    EIGEN_STRONG_INLINE Scalar& operator()(Index i0, Index i1, Index i2)
+    {
+       if (Options&RowMajor) {
+         const Index index = i2 + m_storage.dimensions()[2] * (i1 + m_storage.dimensions()[1] * i0);
+        return m_storage.data()[index];
+      } else {
+         const Index index = i0 + m_storage.dimensions()[0] * (i1 + m_storage.dimensions()[1] * i2);
+        return m_storage.data()[index];
+      }
+    }
+    EIGEN_DEVICE_FUNC
+    EIGEN_STRONG_INLINE Scalar& operator()(Index i0, Index i1, Index i2, Index i3)
+    {
+      if (Options&RowMajor) {
+        const Index index = i3 + m_storage.dimensions()[3] * (i2 + m_storage.dimensions()[2] * (i1 + m_storage.dimensions()[1] * i0));
+        return m_storage.data()[index];
+      } else {
+        const Index index = i0 + m_storage.dimensions()[0] * (i1 + m_storage.dimensions()[1] * (i2 + m_storage.dimensions()[2] * i3));
+        return m_storage.data()[index];
+      }
+    }
+    EIGEN_DEVICE_FUNC
+    EIGEN_STRONG_INLINE Scalar& operator()(Index i0, Index i1, Index i2, Index i3, Index i4)
+    {
+      if (Options&RowMajor) {
+        const Index index = i4 + m_storage.dimensions()[4] * (i3 + m_storage.dimensions()[3] * (i2 + m_storage.dimensions()[2] * (i1 + m_storage.dimensions()[1] * i0)));
+        return m_storage.data()[index];
+      } else {
+        const Index index = i0 + m_storage.dimensions()[0] * (i1 + m_storage.dimensions()[1] * (i2 + m_storage.dimensions()[2] * (i3 + m_storage.dimensions()[3] * i4)));
+        return m_storage.data()[index];
+      }
     }
 #endif