nvdimm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] acpi, nfit: Move acpi_nfit_get_security_ops() to generic location
@ 2018-09-27  2:22 Dan Williams
  2018-09-27 15:48 ` Dave Jiang
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Williams @ 2018-09-27  2:22 UTC (permalink / raw)
  To: dave.jiang; +Cc: linux-nvdimm

In anticipation of other DIMMs adding security operations support, don't
require them to edit intel.h. Instead have intel.h optionally arrange
for intel_security_ops to be NULL or not based on build parameters.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/acpi/nfit/core.c  |   10 ++++++++++
 drivers/acpi/nfit/intel.c |    3 ++-
 drivers/acpi/nfit/intel.h |   18 +++---------------
 3 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
index e5f7c664a7c8..b7773c70ee81 100644
--- a/drivers/acpi/nfit/core.c
+++ b/drivers/acpi/nfit/core.c
@@ -1835,6 +1835,16 @@ static void shutdown_dimm_notify(void *data)
 	mutex_unlock(&acpi_desc->init_mutex);
 }
 
+static const struct nvdimm_security_ops *acpi_nfit_get_security_ops(int family)
+{
+        switch (family) {
+        case NVDIMM_FAMILY_INTEL:
+                return intel_security_ops;
+        default:
+                return NULL;
+        }
+}
+
 static int acpi_nfit_register_dimms(struct acpi_nfit_desc *acpi_desc)
 {
 	struct nfit_mem *nfit_mem;
diff --git a/drivers/acpi/nfit/intel.c b/drivers/acpi/nfit/intel.c
index 70bccb0c57e2..8d2413810a5f 100644
--- a/drivers/acpi/nfit/intel.c
+++ b/drivers/acpi/nfit/intel.c
@@ -358,7 +358,7 @@ static int intel_dimm_security_state(struct nvdimm *nvdimm,
 	return rc;
 }
 
-const struct nvdimm_security_ops intel_security_ops = {
+static const struct nvdimm_security_ops __intel_security_ops = {
 	.state = intel_dimm_security_state,
 	.unlock = intel_dimm_security_unlock,
 	.change_key = intel_dimm_security_update_passphrase,
@@ -366,3 +366,4 @@ const struct nvdimm_security_ops intel_security_ops = {
 	.freeze_lock = intel_dimm_security_freeze_lock,
 	.erase = intel_dimm_security_erase,
 };
+const struct nvdimm_security_ops *intel_security_ops = &__intel_security_ops;
diff --git a/drivers/acpi/nfit/intel.h b/drivers/acpi/nfit/intel.h
index f9ac718776ca..f831084f95fa 100644
--- a/drivers/acpi/nfit/intel.h
+++ b/drivers/acpi/nfit/intel.h
@@ -8,7 +8,7 @@
 
 #ifdef CONFIG_X86
 
-extern const struct nvdimm_security_ops intel_security_ops;
+extern const struct nvdimm_security_ops *intel_security_ops;
 
 #define ND_INTEL_STATUS_SIZE		4
 #define ND_INTEL_PASSPHRASE_SIZE	32
@@ -64,19 +64,7 @@ struct nd_intel_overwrite {
 struct nd_intel_query_overwrite {
 	u32 status;
 } __packed;
+#else /* CONFIG_X86 */
+#define intel_security_ops (NULL)
 #endif /* CONFIG_X86 */
-
-static inline const struct nvdimm_security_ops *
-acpi_nfit_get_security_ops(int family)
-{
-	switch (family) {
-#ifdef CONFIG_X86
-	case NVDIMM_FAMILY_INTEL:
-		return &intel_security_ops;
-#endif
-	default:
-		return NULL;
-	}
-}
-
 #endif

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] acpi, nfit: Move acpi_nfit_get_security_ops() to generic location
  2018-09-27  2:22 [PATCH] acpi, nfit: Move acpi_nfit_get_security_ops() to generic location Dan Williams
@ 2018-09-27 15:48 ` Dave Jiang
  0 siblings, 0 replies; 2+ messages in thread
From: Dave Jiang @ 2018-09-27 15:48 UTC (permalink / raw)
  To: Dan Williams; +Cc: linux-nvdimm



On 09/26/2018 07:22 PM, Dan Williams wrote:
> In anticipation of other DIMMs adding security operations support, don't
> require them to edit intel.h. Instead have intel.h optionally arrange
> for intel_security_ops to be NULL or not based on build parameters.
> 
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>

Reviewed-by: Dave Jiang <dave.jiang@intel.com>

> ---
>  drivers/acpi/nfit/core.c  |   10 ++++++++++
>  drivers/acpi/nfit/intel.c |    3 ++-
>  drivers/acpi/nfit/intel.h |   18 +++---------------
>  3 files changed, 15 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
> index e5f7c664a7c8..b7773c70ee81 100644
> --- a/drivers/acpi/nfit/core.c
> +++ b/drivers/acpi/nfit/core.c
> @@ -1835,6 +1835,16 @@ static void shutdown_dimm_notify(void *data)
>  	mutex_unlock(&acpi_desc->init_mutex);
>  }
>  
> +static const struct nvdimm_security_ops *acpi_nfit_get_security_ops(int family)
> +{
> +        switch (family) {
> +        case NVDIMM_FAMILY_INTEL:
> +                return intel_security_ops;
> +        default:
> +                return NULL;
> +        }
> +}
> +
>  static int acpi_nfit_register_dimms(struct acpi_nfit_desc *acpi_desc)
>  {
>  	struct nfit_mem *nfit_mem;
> diff --git a/drivers/acpi/nfit/intel.c b/drivers/acpi/nfit/intel.c
> index 70bccb0c57e2..8d2413810a5f 100644
> --- a/drivers/acpi/nfit/intel.c
> +++ b/drivers/acpi/nfit/intel.c
> @@ -358,7 +358,7 @@ static int intel_dimm_security_state(struct nvdimm *nvdimm,
>  	return rc;
>  }
>  
> -const struct nvdimm_security_ops intel_security_ops = {
> +static const struct nvdimm_security_ops __intel_security_ops = {
>  	.state = intel_dimm_security_state,
>  	.unlock = intel_dimm_security_unlock,
>  	.change_key = intel_dimm_security_update_passphrase,
> @@ -366,3 +366,4 @@ const struct nvdimm_security_ops intel_security_ops = {
>  	.freeze_lock = intel_dimm_security_freeze_lock,
>  	.erase = intel_dimm_security_erase,
>  };
> +const struct nvdimm_security_ops *intel_security_ops = &__intel_security_ops;
> diff --git a/drivers/acpi/nfit/intel.h b/drivers/acpi/nfit/intel.h
> index f9ac718776ca..f831084f95fa 100644
> --- a/drivers/acpi/nfit/intel.h
> +++ b/drivers/acpi/nfit/intel.h
> @@ -8,7 +8,7 @@
>  
>  #ifdef CONFIG_X86
>  
> -extern const struct nvdimm_security_ops intel_security_ops;
> +extern const struct nvdimm_security_ops *intel_security_ops;
>  
>  #define ND_INTEL_STATUS_SIZE		4
>  #define ND_INTEL_PASSPHRASE_SIZE	32
> @@ -64,19 +64,7 @@ struct nd_intel_overwrite {
>  struct nd_intel_query_overwrite {
>  	u32 status;
>  } __packed;
> +#else /* CONFIG_X86 */
> +#define intel_security_ops (NULL)
>  #endif /* CONFIG_X86 */
> -
> -static inline const struct nvdimm_security_ops *
> -acpi_nfit_get_security_ops(int family)
> -{
> -	switch (family) {
> -#ifdef CONFIG_X86
> -	case NVDIMM_FAMILY_INTEL:
> -		return &intel_security_ops;
> -#endif
> -	default:
> -		return NULL;
> -	}
> -}
> -
>  #endif
> 
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-09-27 15:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-27  2:22 [PATCH] acpi, nfit: Move acpi_nfit_get_security_ops() to generic location Dan Williams
2018-09-27 15:48 ` Dave Jiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).