Skip to content

Commit

Permalink
mm: zpool: constify the zpool_ops
Browse files Browse the repository at this point in the history
The structure zpool_ops is not modified so make the pointer to it a
pointer to const.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
Acked-by: Dan Streetman <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
krzk authored and torvalds committed Sep 8, 2015
1 parent 5b999aa commit 7867277
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions include/linux/zpool.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ enum zpool_mapmode {
};

struct zpool *zpool_create_pool(char *type, char *name,
gfp_t gfp, struct zpool_ops *ops);
gfp_t gfp, const struct zpool_ops *ops);

char *zpool_get_type(struct zpool *pool);

Expand Down Expand Up @@ -81,7 +81,7 @@ struct zpool_driver {
atomic_t refcount;
struct list_head list;

void *(*create)(char *name, gfp_t gfp, struct zpool_ops *ops,
void *(*create)(char *name, gfp_t gfp, const struct zpool_ops *ops,
struct zpool *zpool);
void (*destroy)(void *pool);

Expand Down
4 changes: 2 additions & 2 deletions mm/zbud.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ struct zbud_pool {
struct zbud_ops *ops;
#ifdef CONFIG_ZPOOL
struct zpool *zpool;
struct zpool_ops *zpool_ops;
const struct zpool_ops *zpool_ops;
#endif
};

Expand Down Expand Up @@ -138,7 +138,7 @@ static struct zbud_ops zbud_zpool_ops = {
};

static void *zbud_zpool_create(char *name, gfp_t gfp,
struct zpool_ops *zpool_ops,
const struct zpool_ops *zpool_ops,
struct zpool *zpool)
{
struct zbud_pool *pool;
Expand Down
4 changes: 2 additions & 2 deletions mm/zpool.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct zpool {

struct zpool_driver *driver;
void *pool;
struct zpool_ops *ops;
const struct zpool_ops *ops;

struct list_head list;
};
Expand Down Expand Up @@ -115,7 +115,7 @@ static void zpool_put_driver(struct zpool_driver *driver)
* Returns: New zpool on success, NULL on failure.
*/
struct zpool *zpool_create_pool(char *type, char *name, gfp_t gfp,
struct zpool_ops *ops)
const struct zpool_ops *ops)
{
struct zpool_driver *driver;
struct zpool *zpool;
Expand Down
3 changes: 2 additions & 1 deletion mm/zsmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,8 @@ static void record_obj(unsigned long handle, unsigned long obj)

#ifdef CONFIG_ZPOOL

static void *zs_zpool_create(char *name, gfp_t gfp, struct zpool_ops *zpool_ops,
static void *zs_zpool_create(char *name, gfp_t gfp,
const struct zpool_ops *zpool_ops,
struct zpool *zpool)
{
return zs_create_pool(name, gfp);
Expand Down
2 changes: 1 addition & 1 deletion mm/zswap.c
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ static void zswap_frontswap_invalidate_area(unsigned type)
zswap_trees[type] = NULL;
}

static struct zpool_ops zswap_zpool_ops = {
static const struct zpool_ops zswap_zpool_ops = {
.evict = zswap_writeback_entry
};

Expand Down

0 comments on commit 7867277

Please sign in to comment.