| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright(c) 2013-2015 Intel Corporation. All rights reserved. |
|---|
| 3 | | - * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 5 | | - * it under the terms of version 2 of the GNU General Public License as |
|---|
| 6 | | - * published by the Free Software Foundation. |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is distributed in the hope that it will be useful, but |
|---|
| 9 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 10 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 11 | | - * General Public License for more details. |
|---|
| 12 | 4 | */ |
|---|
| 13 | 5 | #include <linux/cpumask.h> |
|---|
| 14 | 6 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 43 | 35 | return rc; |
|---|
| 44 | 36 | |
|---|
| 45 | 37 | if (is_memory(&nd_region->dev)) { |
|---|
| 46 | | - struct resource ndr_res; |
|---|
| 38 | + struct range range = { |
|---|
| 39 | + .start = nd_region->ndr_start, |
|---|
| 40 | + .end = nd_region->ndr_start + nd_region->ndr_size - 1, |
|---|
| 41 | + }; |
|---|
| 47 | 42 | |
|---|
| 48 | 43 | if (devm_init_badblocks(dev, &nd_region->bb)) |
|---|
| 49 | 44 | return -ENODEV; |
|---|
| .. | .. |
|---|
| 52 | 47 | if (!nd_region->bb_state) |
|---|
| 53 | 48 | dev_warn(&nd_region->dev, |
|---|
| 54 | 49 | "'badblocks' notification disabled\n"); |
|---|
| 55 | | - ndr_res.start = nd_region->ndr_start; |
|---|
| 56 | | - ndr_res.end = nd_region->ndr_start + nd_region->ndr_size - 1; |
|---|
| 57 | | - nvdimm_badblocks_populate(nd_region, &nd_region->bb, &ndr_res); |
|---|
| 50 | + nvdimm_badblocks_populate(nd_region, &nd_region->bb, &range); |
|---|
| 58 | 51 | } |
|---|
| 59 | 52 | |
|---|
| 60 | 53 | rc = nd_region_register_namespaces(nd_region, &err); |
|---|
| .. | .. |
|---|
| 110 | 103 | nvdimm_bus_unlock(dev); |
|---|
| 111 | 104 | |
|---|
| 112 | 105 | /* |
|---|
| 113 | | - * Note, this assumes device_lock() context to not race |
|---|
| 106 | + * Note, this assumes nd_device_lock() context to not race |
|---|
| 114 | 107 | * nd_region_notify() |
|---|
| 115 | 108 | */ |
|---|
| 116 | 109 | sysfs_put(nd_region->bb_state); |
|---|
| .. | .. |
|---|
| 129 | 122 | { |
|---|
| 130 | 123 | if (event == NVDIMM_REVALIDATE_POISON) { |
|---|
| 131 | 124 | struct nd_region *nd_region = to_nd_region(dev); |
|---|
| 132 | | - struct resource res; |
|---|
| 133 | 125 | |
|---|
| 134 | 126 | if (is_memory(&nd_region->dev)) { |
|---|
| 135 | | - res.start = nd_region->ndr_start; |
|---|
| 136 | | - res.end = nd_region->ndr_start + |
|---|
| 137 | | - nd_region->ndr_size - 1; |
|---|
| 127 | + struct range range = { |
|---|
| 128 | + .start = nd_region->ndr_start, |
|---|
| 129 | + .end = nd_region->ndr_start + |
|---|
| 130 | + nd_region->ndr_size - 1, |
|---|
| 131 | + }; |
|---|
| 132 | + |
|---|
| 138 | 133 | nvdimm_badblocks_populate(nd_region, |
|---|
| 139 | | - &nd_region->bb, &res); |
|---|
| 134 | + &nd_region->bb, &range); |
|---|
| 140 | 135 | if (nd_region->bb_state) |
|---|
| 141 | 136 | sysfs_notify_dirent(nd_region->bb_state); |
|---|
| 142 | 137 | } |
|---|