Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
ffc843fc
Commit
ffc843fc
authored
Oct 09, 2023
by
Rafael J. Wysocki
Browse files
Options
Browse Files
Download
Plain Diff
Merge back earlier system-wide PM changes for v6.7.
parents
b21f18ef
7bf770f7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
25 deletions
+38
-25
include/linux/pm.h
include/linux/pm.h
+29
-14
kernel/power/snapshot.c
kernel/power/snapshot.c
+7
-9
kernel/power/swap.c
kernel/power/swap.c
+2
-2
No files found.
include/linux/pm.h
View file @
ffc843fc
...
@@ -374,24 +374,39 @@ const struct dev_pm_ops name = { \
...
@@ -374,24 +374,39 @@ const struct dev_pm_ops name = { \
RUNTIME_PM_OPS(runtime_suspend_fn, runtime_resume_fn, idle_fn) \
RUNTIME_PM_OPS(runtime_suspend_fn, runtime_resume_fn, idle_fn) \
}
}
#ifdef CONFIG_PM
#define _EXPORT_PM_OPS(name, license, ns) \
#define _EXPORT_DEV_PM_OPS(name, license, ns) \
const struct dev_pm_ops name; \
const struct dev_pm_ops name; \
__EXPORT_SYMBOL(name, license, ns); \
__EXPORT_SYMBOL(name, license, ns); \
const struct dev_pm_ops name
const struct dev_pm_ops name
#define EXPORT_PM_FN_GPL(name) EXPORT_SYMBOL_GPL(name)
#define EXPORT_PM_FN_NS_GPL(name, ns) EXPORT_SYMBOL_NS_GPL(name, ns)
#define _DISCARD_PM_OPS(name, license, ns) \
#else
#define _EXPORT_DEV_PM_OPS(name, license, ns) \
static __maybe_unused const struct dev_pm_ops __static_##name
static __maybe_unused const struct dev_pm_ops __static_##name
#ifdef CONFIG_PM
#define _EXPORT_DEV_PM_OPS(name, license, ns) _EXPORT_PM_OPS(name, license, ns)
#define EXPORT_PM_FN_GPL(name) EXPORT_SYMBOL_GPL(name)
#define EXPORT_PM_FN_NS_GPL(name, ns) EXPORT_SYMBOL_NS_GPL(name, ns)
#else
#define _EXPORT_DEV_PM_OPS(name, license, ns) _DISCARD_PM_OPS(name, license, ns)
#define EXPORT_PM_FN_GPL(name)
#define EXPORT_PM_FN_GPL(name)
#define EXPORT_PM_FN_NS_GPL(name, ns)
#define EXPORT_PM_FN_NS_GPL(name, ns)
#endif
#endif
#define EXPORT_DEV_PM_OPS(name) _EXPORT_DEV_PM_OPS(name, "", "")
#ifdef CONFIG_PM_SLEEP
#define EXPORT_GPL_DEV_PM_OPS(name) _EXPORT_DEV_PM_OPS(name, "GPL", "")
#define _EXPORT_DEV_SLEEP_PM_OPS(name, license, ns) _EXPORT_PM_OPS(name, license, ns)
#define EXPORT_NS_DEV_PM_OPS(name, ns) _EXPORT_DEV_PM_OPS(name, "", #ns)
#else
#define EXPORT_NS_GPL_DEV_PM_OPS(name, ns) _EXPORT_DEV_PM_OPS(name, "GPL", #ns)
#define _EXPORT_DEV_SLEEP_PM_OPS(name, license, ns) _DISCARD_PM_OPS(name, license, ns)
#endif
#define EXPORT_DEV_PM_OPS(name) _EXPORT_DEV_PM_OPS(name, "", "")
#define EXPORT_GPL_DEV_PM_OPS(name) _EXPORT_DEV_PM_OPS(name, "GPL", "")
#define EXPORT_NS_DEV_PM_OPS(name, ns) _EXPORT_DEV_PM_OPS(name, "", #ns)
#define EXPORT_NS_GPL_DEV_PM_OPS(name, ns) _EXPORT_DEV_PM_OPS(name, "GPL", #ns)
#define EXPORT_DEV_SLEEP_PM_OPS(name) _EXPORT_DEV_SLEEP_PM_OPS(name, "", "")
#define EXPORT_GPL_DEV_SLEEP_PM_OPS(name) _EXPORT_DEV_SLEEP_PM_OPS(name, "GPL", "")
#define EXPORT_NS_DEV_SLEEP_PM_OPS(name, ns) _EXPORT_DEV_SLEEP_PM_OPS(name, "", #ns)
#define EXPORT_NS_GPL_DEV_SLEEP_PM_OPS(name, ns) _EXPORT_DEV_SLEEP_PM_OPS(name, "GPL", #ns)
/*
/*
* Use this if you want to use the same suspend and resume callbacks for suspend
* Use this if you want to use the same suspend and resume callbacks for suspend
...
@@ -404,19 +419,19 @@ const struct dev_pm_ops name = { \
...
@@ -404,19 +419,19 @@ const struct dev_pm_ops name = { \
_DEFINE_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL)
_DEFINE_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL)
#define EXPORT_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
#define EXPORT_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
EXPORT_DEV_PM_OPS(name) = { \
EXPORT_DEV_
SLEEP_
PM_OPS(name) = { \
SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
}
}
#define EXPORT_GPL_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
#define EXPORT_GPL_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
EXPORT_GPL_DEV_PM_OPS(name) = { \
EXPORT_GPL_DEV_
SLEEP_
PM_OPS(name) = { \
SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
}
}
#define EXPORT_NS_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn, ns) \
#define EXPORT_NS_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn, ns) \
EXPORT_NS_DEV_PM_OPS(name, ns) = { \
EXPORT_NS_DEV_
SLEEP_
PM_OPS(name, ns) = { \
SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
}
}
#define EXPORT_NS_GPL_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn, ns) \
#define EXPORT_NS_GPL_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn, ns) \
EXPORT_NS_GPL_DEV_PM_OPS(name, ns) = { \
EXPORT_NS_GPL_DEV_
SLEEP_
PM_OPS(name, ns) = { \
SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
}
}
...
...
kernel/power/snapshot.c
View file @
ffc843fc
...
@@ -2545,8 +2545,9 @@ static void *get_highmem_page_buffer(struct page *page,
...
@@ -2545,8 +2545,9 @@ static void *get_highmem_page_buffer(struct page *page,
pbe
->
copy_page
=
tmp
;
pbe
->
copy_page
=
tmp
;
}
else
{
}
else
{
/* Copy of the page will be stored in normal memory */
/* Copy of the page will be stored in normal memory */
kaddr
=
safe_pages_list
;
kaddr
=
__get_safe_page
(
ca
->
gfp_mask
);
safe_pages_list
=
safe_pages_list
->
next
;
if
(
!
kaddr
)
return
ERR_PTR
(
-
ENOMEM
);
pbe
->
copy_page
=
virt_to_page
(
kaddr
);
pbe
->
copy_page
=
virt_to_page
(
kaddr
);
}
}
pbe
->
next
=
highmem_pblist
;
pbe
->
next
=
highmem_pblist
;
...
@@ -2750,8 +2751,9 @@ static void *get_buffer(struct memory_bitmap *bm, struct chain_allocator *ca)
...
@@ -2750,8 +2751,9 @@ static void *get_buffer(struct memory_bitmap *bm, struct chain_allocator *ca)
return
ERR_PTR
(
-
ENOMEM
);
return
ERR_PTR
(
-
ENOMEM
);
}
}
pbe
->
orig_address
=
page_address
(
page
);
pbe
->
orig_address
=
page_address
(
page
);
pbe
->
address
=
safe_pages_list
;
pbe
->
address
=
__get_safe_page
(
ca
->
gfp_mask
);
safe_pages_list
=
safe_pages_list
->
next
;
if
(
!
pbe
->
address
)
return
ERR_PTR
(
-
ENOMEM
);
pbe
->
next
=
restore_pblist
;
pbe
->
next
=
restore_pblist
;
restore_pblist
=
pbe
;
restore_pblist
=
pbe
;
return
pbe
->
address
;
return
pbe
->
address
;
...
@@ -2783,8 +2785,6 @@ int snapshot_write_next(struct snapshot_handle *handle)
...
@@ -2783,8 +2785,6 @@ int snapshot_write_next(struct snapshot_handle *handle)
if
(
handle
->
cur
>
1
&&
handle
->
cur
>
nr_meta_pages
+
nr_copy_pages
+
nr_zero_pages
)
if
(
handle
->
cur
>
1
&&
handle
->
cur
>
nr_meta_pages
+
nr_copy_pages
+
nr_zero_pages
)
return
0
;
return
0
;
handle
->
sync_read
=
1
;
if
(
!
handle
->
cur
)
{
if
(
!
handle
->
cur
)
{
if
(
!
buffer
)
if
(
!
buffer
)
/* This makes the buffer be freed by swsusp_free() */
/* This makes the buffer be freed by swsusp_free() */
...
@@ -2827,7 +2827,6 @@ int snapshot_write_next(struct snapshot_handle *handle)
...
@@ -2827,7 +2827,6 @@ int snapshot_write_next(struct snapshot_handle *handle)
memory_bm_position_reset
(
&
zero_bm
);
memory_bm_position_reset
(
&
zero_bm
);
restore_pblist
=
NULL
;
restore_pblist
=
NULL
;
handle
->
buffer
=
get_buffer
(
&
orig_bm
,
&
ca
);
handle
->
buffer
=
get_buffer
(
&
orig_bm
,
&
ca
);
handle
->
sync_read
=
0
;
if
(
IS_ERR
(
handle
->
buffer
))
if
(
IS_ERR
(
handle
->
buffer
))
return
PTR_ERR
(
handle
->
buffer
);
return
PTR_ERR
(
handle
->
buffer
);
}
}
...
@@ -2837,9 +2836,8 @@ int snapshot_write_next(struct snapshot_handle *handle)
...
@@ -2837,9 +2836,8 @@ int snapshot_write_next(struct snapshot_handle *handle)
handle
->
buffer
=
get_buffer
(
&
orig_bm
,
&
ca
);
handle
->
buffer
=
get_buffer
(
&
orig_bm
,
&
ca
);
if
(
IS_ERR
(
handle
->
buffer
))
if
(
IS_ERR
(
handle
->
buffer
))
return
PTR_ERR
(
handle
->
buffer
);
return
PTR_ERR
(
handle
->
buffer
);
if
(
handle
->
buffer
!=
buffer
)
handle
->
sync_read
=
0
;
}
}
handle
->
sync_read
=
(
handle
->
buffer
==
buffer
);
handle
->
cur
++
;
handle
->
cur
++
;
/* Zero pages were not included in the image, memset it and move on. */
/* Zero pages were not included in the image, memset it and move on. */
...
...
kernel/power/swap.c
View file @
ffc843fc
...
@@ -1513,7 +1513,7 @@ int swsusp_read(unsigned int *flags_p)
...
@@ -1513,7 +1513,7 @@ int swsusp_read(unsigned int *flags_p)
static
void
*
swsusp_holder
;
static
void
*
swsusp_holder
;
/**
/**
* swsusp_check -
Check for swsusp signature in the resume device
* swsusp_check -
Open the resume device and check for the swsusp signature.
* @exclusive: Open the resume device exclusively.
* @exclusive: Open the resume device exclusively.
*/
*/
...
@@ -1564,7 +1564,7 @@ int swsusp_check(bool exclusive)
...
@@ -1564,7 +1564,7 @@ int swsusp_check(bool exclusive)
}
}
/**
/**
* swsusp_close - close
swap
device.
* swsusp_close - close
resume
device.
* @exclusive: Close the resume device which is exclusively opened.
* @exclusive: Close the resume device which is exclusively opened.
*/
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment