From patchwork Tue Jul 25 19:56:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 108676 Delivered-To: patches@linaro.org Received: by 10.182.45.195 with SMTP id p3csp2742obm; Tue, 25 Jul 2017 12:56:41 -0700 (PDT) X-Received: by 10.99.100.194 with SMTP id y185mr20506181pgb.92.1501012601748; Tue, 25 Jul 2017 12:56:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501012601; cv=none; d=google.com; s=arc-20160816; b=dFhBl4eVlWAJZXw1YEfrBIo3R5U0jWg4OEoQfCkOo3bLsN+Dxd+eoAEG7lZ9pO1z8X YaXAQ9yUmSNXdjz1e3yPWmAM1LnYkxUXhEbI0q7mqX+h7guUVr3328A2DXZymHWrdZvb t4CgWX0bB1UDkJw4RI99C1ut+gZZ9GqybiqDzQ4Ij15K4tfII8ADlTSsyrBY0KI7SdtB X+dJJ1DS2gSZZiZ4Nkc6xpnsx/UhMS+TLVPK9x6VyEN1X+dgF/uQyMeQz9MSsdYKNnCi I68GLxMzvkK9sOjbTk2xYlXMh3KVPWoVFb7EJnMVR1oNvVzEEauMkmTwViRAXOGRaVCy Bc0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=hhsmYSN4WbouzL4iJF+bbM2sGPXppUXhOjuuKFNxbEE=; b=LTsDLhb8iGeR//ckdALblnXVBOTjIzW1lIFGC+C4zGjRiAeBYw8PtL0cZ13/I31u9S id7kyKSbUtPpNRi94Yzz+axLje7nMiXddZvhzbuZzUKQdW9S4gylDyWDSFnIU8qH9jjL v6sgVg3VE7ush3RJrpCgvqbV0E4oCnDbSi31b5K+SL/xzBh85MaM4NsuN0fkwFN4DRhe rXJZI4vtZKmVOmrU6d6BZxDoLyjOKzHWNwF5gmlfhvm4qyog0lsqZXDayMATDylGXrD1 YNgBPY4ILFHZ97q47BUz98j+e3vM6rbom39zzIQ7N5p95qhep6z9JDzzcz4SPhYnU29j vN5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=jmNRoknm; spf=pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c00::22d as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-pf0-x22d.google.com (mail-pf0-x22d.google.com. [2607:f8b0:400e:c00::22d]) by mx.google.com with ESMTPS id f2si7253235plk.917.2017.07.25.12.56.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Jul 2017 12:56:41 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c00::22d as permitted sender) client-ip=2607:f8b0:400e:c00::22d; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=jmNRoknm; spf=pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c00::22d as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by mail-pf0-x22d.google.com with SMTP id z129so22645495pfb.3 for ; Tue, 25 Jul 2017 12:56:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=hhsmYSN4WbouzL4iJF+bbM2sGPXppUXhOjuuKFNxbEE=; b=jmNRoknm6qwwVl3CFGdWRlwm7fGniHXH62rPEULc3A2u4g2OFy5K1mBSRHPQzCc6Hn NA2LmSUnqPCa4I2a/jyHoJ315ahrJJDM1jdbJ66B494RrbVzS0RdtsXkcOxCBFEVh3qm fuFcZf4OoTUlwEAx4q9mrX2tJyaqJl33SMUac= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=hhsmYSN4WbouzL4iJF+bbM2sGPXppUXhOjuuKFNxbEE=; b=a/8JeglpdgoMhgcHvKXbMgcRCx4r79Anu0s3E0cSSQuVj+l+E4YyLUZbhAAK92oGjV m457q4MiASIQCAYE+uZdctm4FEqpxFfR0MDFXVdzlP7Fpev/bJ78e12QUBzp0u1AY3NR ngxqbNBol77JObmBjfCBrDctKaLWQ486UlsjdSL9hCKb54p7sDuGdWjjZ6iLg4lhIkad h9Qg0gzbRsdpzDnxGyhdMIaCU8wuXsT0DtC2vv03/0qv6DsVX5L+Uby1N86Ocarpq+C0 ygv0L0KXMRgmYveRad7J1j/aPURb+qO1jic76f1Of3egOKo/filGRHKWqYHhSenVrlPa qraA== X-Gm-Message-State: AIVw111612T0dBwCfatNQRoNJD2KUuqvAL0VLGd1FPKj4zRfjN3e+RDG si9DPvgkNPWlNi78K0w= X-Received: by 10.98.129.3 with SMTP id t3mr20513468pfd.167.1501012601334; Tue, 25 Jul 2017 12:56:41 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:1002:83f0:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id x14sm28827951pfe.83.2017.07.25.12.56.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Jul 2017 12:56:40 -0700 (PDT) From: John Stultz To: Guodong Xu Cc: John Stultz Subject: [PATCH 1/6] HACK: dwc3: Cleanup wakelock bits from hack patch Date: Tue, 25 Jul 2017 12:56:30 -0700 Message-Id: <1501012595-14434-1-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 This should be squished down into the hack patch. Signed-off-by: John Stultz --- drivers/usb/dwc3/dwc3-hisi.c | 10 +++---- drivers/usb/dwc3/dwc3-hisi.h | 4 +-- include/linux/wakelock.h | 67 -------------------------------------------- 3 files changed, 7 insertions(+), 74 deletions(-) delete mode 100644 include/linux/wakelock.h -- 2.7.4 diff --git a/drivers/usb/dwc3/dwc3-hisi.c b/drivers/usb/dwc3/dwc3-hisi.c index 6ec8421..45029a1 100644 --- a/drivers/usb/dwc3/dwc3-hisi.c +++ b/drivers/usb/dwc3/dwc3-hisi.c @@ -741,17 +741,17 @@ static void set_vbus_power(struct hisi_dwc3_device *hisi_dwc3, unsigned int is_o static void hisi_dwc3_wake_lock(struct hisi_dwc3_device *hisi_dwc3) { - if (!wake_lock_active(&hisi_dwc3->wake_lock)) { + if (!(hisi_dwc3->ws.active)) { usb_dbg("usb otg wake lock\n"); - wake_lock(&hisi_dwc3->wake_lock); + __pm_stay_awake(&hisi_dwc3->ws); } } static void hisi_dwc3_wake_unlock(struct hisi_dwc3_device *hisi_dwc3) { - if (wake_lock_active(&hisi_dwc3->wake_lock)) { + if (hisi_dwc3->ws.active) { usb_dbg("usb otg wake unlock\n"); - wake_unlock(&hisi_dwc3->wake_lock); + __pm_relax(&hisi_dwc3->ws); } } @@ -1569,7 +1569,7 @@ int hisi_dwc3_probe(struct platform_device *pdev, spin_lock_init(&hisi_dwc->event_lock); INIT_WORK(&hisi_dwc->event_work, event_work); mutex_init(&hisi_dwc->lock); - wake_lock_init(&hisi_dwc->wake_lock, WAKE_LOCK_SUSPEND, "usb_wake_lock"); + wakeup_source_init(&hisi_dwc->ws, "usb_wake_lock"); ATOMIC_INIT_NOTIFIER_HEAD(&hisi_dwc->charger_type_notifier); event_queue_creat(&hisi_dwc->event_queue, MAX_EVENT_COUNT); hisi_dwc->disable_vdp_src = disable_vdp_src; diff --git a/drivers/usb/dwc3/dwc3-hisi.h b/drivers/usb/dwc3/dwc3-hisi.h index e324f4b..17a5677 100644 --- a/drivers/usb/dwc3/dwc3-hisi.h +++ b/drivers/usb/dwc3/dwc3-hisi.h @@ -2,7 +2,7 @@ #ifndef _DWC3_HISI_H_ #define _DWC3_HISI_H_ -#include +#include #include #include #include @@ -210,7 +210,7 @@ struct hisi_dwc3_device { spinlock_t event_lock; struct mutex lock; - struct wake_lock wake_lock; + struct wakeup_source ws; struct atomic_notifier_head charger_type_notifier; struct work_struct event_work; diff --git a/include/linux/wakelock.h b/include/linux/wakelock.h deleted file mode 100644 index f4a698a..0000000 --- a/include/linux/wakelock.h +++ /dev/null @@ -1,67 +0,0 @@ -/* include/linux/wakelock.h - * - * Copyright (C) 2007-2012 Google, Inc. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#ifndef _LINUX_WAKELOCK_H -#define _LINUX_WAKELOCK_H - -#include -#include - -/* A wake_lock prevents the system from entering suspend or other low power - * states when active. If the type is set to WAKE_LOCK_SUSPEND, the wake_lock - * prevents a full system suspend. - */ - -enum { - WAKE_LOCK_SUSPEND, /* Prevent suspend */ - WAKE_LOCK_TYPE_COUNT -}; - -struct wake_lock { - struct wakeup_source ws; -}; - -static inline void wake_lock_init(struct wake_lock *lock, int type, - const char *name) -{ - wakeup_source_init(&lock->ws, name); -} - -static inline void wake_lock_destroy(struct wake_lock *lock) -{ - wakeup_source_trash(&lock->ws); -} - -static inline void wake_lock(struct wake_lock *lock) -{ - __pm_stay_awake(&lock->ws); -} - -static inline void wake_lock_timeout(struct wake_lock *lock, long timeout) -{ - __pm_wakeup_event(&lock->ws, jiffies_to_msecs(timeout)); -} - -static inline void wake_unlock(struct wake_lock *lock) -{ - __pm_relax(&lock->ws); -} - -static inline int wake_lock_active(struct wake_lock *lock) -{ - return lock->ws.active; -} - -#endif